Skip to content

Fix validation errors and runtime exceptions in podcast generation workflow#24

Open
YosiElias wants to merge 6 commits intoNVIDIA-AI-Blueprints:mainfrom
RHEcosystemAppEng:upstream-fixes
Open

Fix validation errors and runtime exceptions in podcast generation workflow#24
YosiElias wants to merge 6 commits intoNVIDIA-AI-Blueprints:mainfrom
RHEcosystemAppEng:upstream-fixes

Conversation

@YosiElias
Copy link
Copy Markdown

Fix validation errors and runtime exceptions in podcast generation workflow

This PR addresses six bugs that cause validation errors and runtime exceptions during podcast generation. Each fix resolves a specific failure point that prevents successful podcast creation.

Note: Each fix is implemented as a separate commit for easier review.


Bug Fixes

1. Fix Pydantic validation error from missing scratchpad field

Files: frontend/shared/shared/podcast_types.py, shared/shared/podcast_types.py

Bug: The Conversation.scratchpad field was required but not instructed to be provided in the prompt, causing Pydantic validation errors.

Impact: Podcast generation fails with validation error when scratchpad is omitted.

Solution: Added empty string default (scratchpad: str = "") to make the field optional.


2. Fix duration unit mismatch between prompt and Pydantic model

Files: services/AgentService/podcast_prompts.py

Bug: The prompt instructed the LLM to output duration in minutes, but the Pydantic model expected integer seconds. This type mismatch caused validation failures.

Impact: Every outline generation fails with validation error due to incompatible duration units.

Solution: Updated prompt to clearly specify duration must be integer seconds, matching the model's expectation.


3. Fix schema regeneration that discards filename enum

Files: services/AgentService/podcast_flow.py

Bug: Code dynamically added filename enum to schema, then immediately regenerated the schema, discarding the enum modifications.

Impact: Schema regeneration overrides the dynamic modifications, causing the filename enum constraints to not be applied.

Solution: Removed the redundant schema = PodcastOutline.model_json_schema() call that was overriding the enum modifications.


4. Align models.json with llmmanager.py defaults

Files: models.json

Bug: Configuration mismatch between models.json and hardcoded defaults in llmmanager.py:

  • JSON role: models.json used llama-3.1-8b-instruct, code defaults to llama-3.1-70b-instruct
  • Iteration role: models.json used llama-3.1-70b-instruct, code defaults to llama-3.1-405b-instruct

Impact: Using the 8B model for JSON generation causes frequent Pydantic validation errors due to lower model capacity (NVIDIA hosted models).

Solution: Updated models.json to match the code defaults, ensuring consistent model usage.


5. Fix TypeError when recipient field is None

Files: frontend/__main__.py

Bug: The recipient field is None by default unless the user clicks the accordion. Code attempts len(recipient) without null check, causing TypeError: object of type 'NoneType' has no len().

Impact: Podcast generation fails immediately unless user explicitly opens the recipient accordion (even if not providing a value).

Solution: Added null coalescing: recipient = recipient or "" to handle the default None case.


6. Fix Gradio InvalidPathError for audio and transcript files

Files: frontend/__main__.py

Bug: Gradio raises InvalidPathError when attempting to serve generated audio and transcript files.

Impact: Users cannot download generated podcast audio or transcripts through the web UI.

Solution: Resolved path handling to ensure Gradio can correctly serve generated files.


Testing

All fixes have been tested and verified to resolve their respective issues.

Impact Summary

These fixes enable successful end-to-end podcast generation by resolving:

  • 4 Pydantic validation errors
  • 2 runtime exceptions

Without these fixes, the podcast generation workflow fails at multiple points.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant