# abhilashjaiswal0110/pdf-to-podcast architecture

> Architecture diagram of the GitHub repository abhilashjaiswal0110/pdf-to-podcast, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-15). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abhilashjaiswal0110/pdf-to-podcast
- Repository: https://github.com/abhilashjaiswal0110/pdf-to-podcast

## Overview

##### Project type and purpose
- This is a microservices-based AI blueprint (PDF to Podcast) built on NVIDIA NIM.
- It ingests PDFs (target + optional context), uses LLMs to generate a transcript, then converts text to speech.

##### File structure
- Top-level “services” folder contains four independent services, each with its own Dockerfile and startup script:
- APIService – exposes HTTP endpoints (FastAPI/Swagger).
- AgentService – orchestrates LLM calls (monologue/podcast flows).
- PDFService – handles PDF ingestion/extraction (Docling) and offers both API and worker subcomponents.
- TTSService – wraps ElevenLabs text-to-speech API.
- “frontend” holds a Python CLI/utility entry point and shared client libraries.
- “shared” within root and “frontend/shared” contain common proto/types/connection code (api_types, llmmanager, storage).
- docker-compose.yaml orchestrates all services plus auxiliary infra (Redis, MinIO, Jaeger).
- tests/ validates end-to-end flows.

##### README for additional insights
- Describes the flow: Target PDF → PDFService → AgentService (via NIM) → TTSService → audio.
- External dependencies: NVIDIA NIM endpoints, ElevenLabs API, Redis (task queue), MinIO (object storage), optional GPU for Docling.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Edge/Client Layer
    subgraph "Edge/Client" 
        direction TB
        Client_CLI["CLI"]:::service
        Notebook["Notebook"]:::service
        Shared_SDK["Shared SDK"]:::service
    end

    %% API Layer
    subgraph "API Layer"
        direction TB
        API["API Service"]:::service
    end

    %% Processing Services
    subgraph "Processing Services"
        direction TB
        PDF["PDF Service"]:::service
        Agent["Agent Service"]:::service
        TTS["TTS Service"]:::service
    end

    %% Data & Infrastructure
    subgraph "Data & Infrastructure"
        direction TB
        Redis["Redis"]:::queue
        MinIO["MinIO"]:::storage
        Jaeger["Jaeger"]:::service
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        NVIDIA["NVIDIA NIM"]:::external
        ElevenLabs["ElevenLabs API"]:::external
    end

    %% Flows
    Client_CLI -->|"HTTP Request"| API
    Notebook -->|"HTTP Request"| API
    Shared_SDK -->|"gRPC/SDK Call"| API

    API -->|"enqueue PDF ingestion"| Redis
    Redis -->|"task pulled"| PDF
    PDF -->|"store extracted text"| MinIO
    PDF -->|"signal completion"| Redis
    Redis -->|"notify"| API

    API -->|"pass text/context/prompts"| Agent
    Agent -->|"LLM inference"| NVIDIA
    Agent -->|"store transcript"| MinIO
    Agent -->|"enqueue transcript task"| Redis

    API -->|"request TTS conversion"| TTS
    TTS -->|"fetch audio streams"| ElevenLabs
    TTS -->|"store audio files"| MinIO

    API -->|"return download URLs"| Client_CLI
    API -->|"return download URLs"| Notebook
    API -->|"return download URLs"| Shared_SDK

    %% Click Events
    click Client_CLI "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/frontend/__main__.py"
    click Shared_SDK "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/frontend/shared/shared/api_types.py"
    click Shared_SDK "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/frontend/shared/shared/connection.py"
    click Shared_SDK "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/frontend/shared/shared/llmmanager.py"
    click Notebook "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/workbench/PDFtoPodcast.ipynb"
    click API "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/APIService/main.py"
    click API "https://github.com/abhilashjaiswal0110/pdf-to-podcast/tree/main/services/APIService/Dockerfile"
    click PDF "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/PDFService/main.py"
    click Agent "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/AgentService/main.py"
    click Agent "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/AgentService/monologue_flow.py"
    click Agent "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/AgentService/podcast_flow.py"
    click Agent "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/AgentService/monologue_prompts.py"
    click Agent "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/AgentService/podcast_prompts.py"
    click Agent "https://github.com/abhilashjaiswal0110/pdf-to-podcast/tree/main/services/AgentService/Dockerfile"
    click TTS "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/TTSService/main.py"
    click TTS "https://github.com/abhilashjaiswal0110/pdf-to-podcast/tree/main/services/TTSService/Dockerfile"
    click Redis "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/docker-compose.yaml"
    click MinIO "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/docker-compose.yaml"
    click Jaeger "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/docker-compose.yaml"
    click NVIDIA "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/models.json"
    click ElevenLabs "https://github.com/abhilashjaiswal0110/pdf-to-podcast/blob/main/services/TTSService/main.py"

    %% Styles
    classDef service fill:#D0E4F5,stroke:#0366d6,stroke-width:1px;
    classDef storage fill:#C6F6D5,stroke:#2F855A,stroke-width:1px;
    classDef queue fill:#FEEBC8,stroke:#DD6B20,stroke-width:1px;
    classDef external fill:#E2E8F0,stroke:#4A5568,stroke-width:1px;
```
