Transform any topic into a podcast-style audio episode โ powered by LangGraph, NVIDIA LLM, and Pocket TTS.
- Overview
- Architecture
- Workflow Pipeline
- Features
- Tech Stack
- Project Structure
- Prerequisites
- Installation
- Configuration
- Usage
- How It Works
- Data Models
- Voice Mapping
- License
AI Podcast Generator Bot is an intelligent system that converts user queries into fully produced podcast-style audio content. It leverages a multi-phase LangGraph workflow that researches topics via web search, summarizes findings with an LLM, evaluates content relevance, and synthesizes natural-sounding speech โ all through a clean Streamlit interface.
Simply type a topic or question, and the bot will:
- Extract the core topic and language from your query
- Research the topic by searching the web for relevant articles
- Summarize the findings into a structured, podcast-ready script
- Evaluate the relevance of the generated content to your original query
- Refine and repeat if the content doesn't meet the quality threshold
- Synthesize the final script into a downloadable WAV audio file
graph TB
subgraph "User Interface Layer"
UI[Streamlit Web UI]
end
subgraph "Workflow Orchestration Layer"
WG[LangGraph StateGraph]
P1[Phase 1: Query Extraction]
P2[Phase 2: Content Generation]
P3[Phase 3: Relevance Evaluation]
TTS[Phase 4: Audio Synthesis]
RQ[Query Refinement Loop]
end
subgraph "Service Layer"
LLM[NVIDIA LLM Service]
TAV[Tavily Web Search]
PTTS[Pocket TTS Engine]
end
subgraph "Data Layer"
MOD[Pydantic Models]
HL[Helper Utilities]
end
UI --> WG
WG --> P1
WG --> P2
WG --> P3
WG --> TTS
WG --> RQ
P1 --> LLM
P2 --> TAV
P2 --> LLM
P3 --> LLM
TTS --> PTTS
RQ --> LLM
P1 --> MOD
P3 --> MOD
RQ --> MOD
TTS --> HL
The core of the application is a LangGraph StateGraph that orchestrates a multi-phase pipeline with conditional branching and iterative refinement.
flowchart TD
START([User Query]) --> P1
subgraph "Phase 1 โ Query Extraction"
P1[๐ Extract Topic & Language]
end
P1 --> P2
subgraph "Phase 2 โ Content Generation"
P2[๐ Search Web via Tavily\n๐ Summarize Articles via LLM]
end
P2 --> P3
subgraph "Phase 3 โ Relevance Check"
P3[โ๏ธ Score Relevance 0.0 โ 1.0]
end
P3 -->|Score >= 0.8| TTS
P3 -->|Score < 0.8| RQ
subgraph "Query Refinement"
RQ[๐ Refine Query with LLM]
end
RQ -->|Iterations < 3| P1
RQ -->|Iterations >= 3| TTS
subgraph "Phase 4 โ Audio Synthesis"
TTS[๐ Generate Speech via Pocket TTS]
end
TTS --> END([Downloadable WAV Audio])
style P1 fill:#4FC3F7,stroke:#0288D1,color:#000
style P2 fill:#81C784,stroke:#388E3C,color:#000
style P3 fill:#FFB74D,stroke:#F57C00,color:#000
style TTS fill:#E57373,stroke:#D32F2F,color:#fff
style RQ fill:#CE93D8,stroke:#7B1FA2,color:#000
style END fill:#A5D6A7,stroke:#2E7D32,color:#000
| Condition | Action |
|---|---|
| Relevance score โฅ 0.8 | Proceed to TTS audio generation |
| Relevance score < 0.8 and iterations < 3 | Refine query and restart from Phase 1 |
| Iterations โฅ 3 (quality gate) | Force-proceed to TTS to prevent infinite loops |
- Natural Language Input โ Type any question or topic in plain language; the system extracts the core subject and language automatically
- Real-Time Web Research โ Uses Tavily's advanced search to fetch up-to-date, relevant articles from the web
- LLM-Powered Summarization โ Condenses multiple articles into a structured, podcast-ready narrative with headings, key points, and a conclusion
- Quality Gate with Auto-Refinement โ An editorial review phase scores content relevance; if the score is below 0.8, the query is automatically refined and the pipeline restarts (up to 3 iterations)
- Multi-Language TTS โ Supports English, French, German, Spanish, Italian, and Portuguese with dedicated voice profiles
- Interactive Web UI โ Built with Streamlit for a seamless, browser-based experience with audio playback and one-click download
- Structured Output โ Uses Pydantic models for type-safe, predictable LLM responses throughout the pipeline
| Component | Technology | Purpose |
|---|---|---|
| UI Framework | Streamlit 1.30+ | Interactive web interface |
| Workflow Engine | LangGraph 0.2+ | Stateful multi-phase orchestration |
| LLM Provider | NVIDIA NIM via LangChain | Query extraction, summarization, scoring, refinement |
| Web Search | Tavily 0.5+ | Real-time article retrieval |
| Text-to-Speech | Pocket TTS 0.1+ | Neural speech synthesis |
| Data Validation | Pydantic 2.0+ | Structured LLM output parsing |
| Audio I/O | SciPy 1.11+ | WAV file writing |
| Python | 3.10+ | Runtime environment |
AI-Podcast-Generator-Bot/
โโโ main.py # Application entry point
โโโ pyproject.toml # Project metadata and dependencies (PEP 621)
โโโ requirements.txt # Pip-compatible dependency list
โโโ README.md # This file
โโโ app/
โโโ __init__.py
โโโ models/
โ โโโ __init__.py
โ โโโ query.py # Pydantic data models
โโโ services/
โ โโโ __init__.py
โ โโโ llm_service.py # NVIDIA LLM integration (LangChain)
โ โโโ tavily_service.py # Tavily web search client
โ โโโ tts_service.py # Pocket TTS audio synthesis
โโโ workflow/
โ โโโ __init__.py
โ โโโ podcast_workflow.py # LangGraph state machine & pipeline
โโโ ui/
โ โโโ __init__.py
โ โโโ streamlit_app.py # Streamlit frontend
โโโ utils/
โโโ __init__.py
โโโ helpers.py # Audio base64 encoding utility
Before getting started, make sure you have the following:
| Prerequisite | Details |
|---|---|
| Python | Version 3.10 or higher |
| NVIDIA API Key | Obtain from build.nvidia.com โ used for LLM inference |
| Tavily API Key | Obtain from tavily.com โ used for web search |
git clone https://github.com/armanjscript/AI-Podcast-Generator-Bot.git
cd AI-Podcast-Generator-Botpython -m venv venv
source venv/bin/activate # Linux / macOS
# venv\Scripts\activate # Windowspip install -r requirements.txtThe application requires two API keys, which can be provided in two ways:
Launch the app and enter your keys in the sidebar under API Configuration. They will be stored in the session state for the duration of your session.
Create a .env file in the project root:
NVIDIA_API_KEY=your_nvidia_api_key_here
TAVILY_API_KEY=your_tavily_api_key_hereThen load them in your shell:
export $(grep -v '^#' .env | xargs)Start the Streamlit application:
streamlit run main.pyThe app will open in your browser (typically at http://localhost:8501). From there:
- Enter your API keys in the sidebar and click Register API Keys
- Type your topic or question in the text area (e.g., "Tell me about the latest developments in AI technology")
- Click "Generate Podcast" and wait for the pipeline to complete
- Review the generated content summary, relevance score, and topic/language extraction
- Listen to the audio directly in the browser or download the
.wavfile
The user's natural language input is passed to the NVIDIA LLM with structured output parsing. The LLM extracts two key pieces of information:
- Topic: The core subject of the query
- Language: The desired output language (defaults to the user's input language if not specified)
These are captured in a UserQueryExtraction Pydantic model for type safety.
The extracted topic is used to perform an advanced web search via the Tavily API, retrieving up to 5 relevant articles with full content. The articles are then passed to the LLM, which generates a well-structured markdown summary containing:
- A main title
- An introduction section
- Key points from each article
- A conclusion
The summary is generated in the user's requested language.
The generated summary is evaluated by the LLM, which assigns a relevance score between 0.0 and 1.0 based on how well the content aligns with the original topic. This acts as an editorial quality gate:
- Score โฅ 0.8 โ Content is relevant enough; proceed to audio synthesis
- Score < 0.8 โ Content needs improvement; the query is refined and the pipeline restarts
To prevent infinite loops, the system tracks iteration count and forces TTS generation after 3 iterations regardless of the score.
The approved summary text is converted to speech using Pocket TTS, a neural text-to-speech model. The system automatically selects a voice profile based on the detected language, generates the audio waveform, and saves it as a .wav file using SciPy's wavfile module.
The application uses Pydantic v2 models for structured, validated LLM outputs:
classDiagram
class UserQueryExtraction {
+str topic
+str language
}
class BinaryScore {
+float relevance_score [0.0, 1.0]
}
class QueryRefinement {
+str sentence
}
class PodcastState {
+str user_query
+str nvidia_api_key
+str tavily_api_key
+str topic
+str language
+list articles
+str summarized_content
+float relevance_score
+str refined_query
+str audio_path
+int iteration_count
}
UserQueryExtraction --> PodcastState : used in Phase 1
BinaryScore --> PodcastState : used in Phase 3
QueryRefinement --> PodcastState : used in Refinement
| Model | Fields | Used In |
|---|---|---|
UserQueryExtraction |
topic: str, language: str |
Phase 1 โ Query parsing |
BinaryScore |
relevance_score: float (0.0โ1.0) |
Phase 3 โ Relevance evaluation |
QueryRefinement |
sentence: str |
Refinement loop โ Query rewriting |
PodcastState |
11 fields (see diagram) | LangGraph state โ carries data across all phases |
Pocket TTS provides distinct voice profiles for different languages. The system automatically selects the appropriate voice based on the detected language:
| Language | Voice Name | Description |
|---|---|---|
| ๐ฌ๐ง English | alba |
Default English female voice |
| ๐ซ๐ท French | estelle |
French female voice |
| ๐ฉ๐ช German | juergen |
German male voice |
| ๐ช๐ธ Spanish | lola |
Spanish female voice |
| ๐ฎ๐น Italian | giovanni |
Italian male voice |
| ๐ต๐น Portuguese | rafael |
Portuguese male voice |
Note: If the detected language is not in the mapping, the system defaults to
alba(English).
This project is licensed under the MIT License.
Built with โค๏ธ using LangGraph, NVIDIA NIM, Tavily, and Pocket TTS