# srujangowda5/finance-assistant2 architecture

> Architecture diagram of the GitHub repository srujangowda5/finance-assistant2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/srujangowda5/finance-assistant2
- Repository: https://github.com/srujangowda5/finance-assistant2

## Overview

##### Project type and purpose
- This is a full-stack, modular, microservices-based financial assistant.
- Purpose: deliver daily Asia tech market briefings via a voice-enabled Streamlit frontend, powered by multiple FastAPI “agents.”

##### File structure
- Top-level directories:
- agents/ (each subfolder is a FastAPI microservice)
- orchestrator/ (router that ties agents together)
- streamlit_app/ (frontend UI)
- data_ingestion/ (ETL pipelines for raw data)
- docs/, requirements.txt, Docker config files
- Each agent folder contains its own main.py, helper modules, and possibly data.
- The orchestrator routes requests to the correct agent endpoint.
- streamlit_app drives the UX and makes HTTP calls to orchestrator.
- External dependencies and configs are in requirements.txt, .devcontainer, Dockerfile.

##### README insights
- Architecture overview table explicitly lists each agent and its role.
- Technologies: FastAPI, Streamlit, OpenAI GPT-3.5, FAISS, yFinance, gTTS, Whisper.
- Data flows: user → Streamlit → orchestrator → agents → external APIs/DBs → orchestrator → Streamlit → TTS.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        User["User\n(Browser/Mic)"]:::frontend
        subgraph "Streamlit App"
            StreamlitMain["main.py"]:::frontend
            StreamlitUI["ui_helpers.py"]:::frontend
        end
    end

    %% Backend Layer
    subgraph "Backend Layer"
        subgraph "Orchestrator Service"
            OrchMain["main.py"]:::orchestrator
            OrchRouter["router.py"]:::orchestrator
        end

        subgraph "Agents"
            subgraph "API Agent"
                APIMain["main.py"]:::agents
                APIUtils["utils.py"]:::agents
            end
            subgraph "Top Stocks Agent"
                TopMain["main.py"]:::agents
            end
            subgraph "Scraping Agent"
                ScrapeMain["main.py"]:::agents
                ScrapeParser["parser.py"]:::agents
            end
            subgraph "Retriever Agent"
                RetMain["main.py"]:::agents
                RetEmbedder["embedder.py"]:::agents
                RetData["tech_earnings.txt"]:::datastore
            end
            subgraph "Analytics Agent"
                AnalMain["main.py"]:::agents
                AnalCalc["calculator.py"]:::agents
            end
            subgraph "Language Agent"
                LangMain["main.py"]:::agents
                LangTemplate["prompt_template.py"]:::agents
            end
            subgraph "Voice Agent"
                VoiceMain["main.py"]:::agents
                VoiceSTT["stt_whisper.py"]:::agents
                VoiceTTS["tts.py"]:::agents
            end
        end

        subgraph "Data Ingestion"
            APILoader["api_loader/"]:::agents
            ScrapeLoader["scraping_loader/"]:::agents
        end

        subgraph "Configuration"
            Requirements["requirements.txt"]:::config
            DevContainer[".devcontainer/devcontainer.json"]:::config
            DockerIgnore[".dockerignore"]:::config
        end
    end

    %% External Services
    subgraph "External Services"
        yFinance["yFinance API"]:::external
        Websites["Financial Websites"]:::external
        OpenAI["OpenAI GPT-3.5"]:::external
        WhisperExt["Whisper STT"]:::external
        gTTS["gTTS TTS"]:::external
    end

    %% Data Stores
    subgraph "Data Stores"
        FAISS["FAISS Index"]:::datastore
        ScrapedStore["Scraped Data Store"]:::datastore
    end

    %% Flows
    User -->|"interacts"| StreamlitMain
    StreamlitMain -->|"HTTP POST"| OrchMain
    OrchMain -->|"calls"| APIMain
    OrchMain -->|"calls"| ScrapeMain
    OrchMain -->|"calls"| RetMain
    OrchMain -->|"calls"| AnalMain
    OrchMain -->|"calls"| LangMain
    OrchMain -->|"calls"| TopMain
    APIMain -->|"fetches data"| yFinance
    ScrapeMain -->|"scrapes"| Websites
    RetMain -->|"queries"| FAISS
    AnalMain -->|"reads data"| ScrapedStore
    LangMain -->|"generates summary"| OpenAI
    OrchMain -->|"forwards text"| VoiceMain
    VoiceMain -->|"STT"| WhisperExt
    VoiceMain -->|"TTS"| gTTS
    OrchMain -->|"streams response"| StreamlitMain
    APILoader -->|"refreshes"| FAISS
    ScrapeLoader -->|"updates"| ScrapedStore

    %% Click Events
    click StreamlitMain "https://github.com/srujangowda5/finance-assistant2/blob/main/streamlit_app/main.py"
    click StreamlitUI "https://github.com/srujangowda5/finance-assistant2/blob/main/streamlit_app/ui_helpers.py"
    click OrchMain "https://github.com/srujangowda5/finance-assistant2/blob/main/orchestrator/main.py"
    click OrchRouter "https://github.com/srujangowda5/finance-assistant2/blob/main/orchestrator/router.py"
    click APIMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/api_agent/main.py"
    click APIUtils "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/api_agent/utils.py"
    click TopMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/top_stocks_agent/main.py"
    click ScrapeMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/scraping_agent/main.py"
    click ScrapeParser "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/scraping_agent/parser.py"
    click RetMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/retriever_agent/main.py"
    click RetEmbedder "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/retriever_agent/embedder.py"
    click RetData "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/retriever_agent/data/tech_earnings.txt"
    click AnalMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/analytics_agent/main.py"
    click AnalCalc "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/analytics_agent/calculator.py"
    click LangMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/language_agent/main.py"
    click LangTemplate "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/language_agent/prompt_template.py"
    click VoiceMain "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/voice_agent/main.py"
    click VoiceSTT "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/voice_agent/stt_whisper.py"
    click VoiceTTS "https://github.com/srujangowda5/finance-assistant2/blob/main/agents/voice_agent/tts.py"
    click APILoader "https://github.com/srujangowda5/finance-assistant2/tree/main/data_ingestion/api_loader/"
    click ScrapeLoader "https://github.com/srujangowda5/finance-assistant2/tree/main/data_ingestion/scraping_loader/"
    click Requirements "https://github.com/srujangowda5/finance-assistant2/blob/main/requirements.txt"
    click DevContainer "https://github.com/srujangowda5/finance-assistant2/blob/main/.devcontainer/devcontainer.json"
    click DockerIgnore "https://github.com/srujangowda5/finance-assistant2/blob/main/.dockerignore"

    %% Styles
    classDef frontend fill:#B3D4FC,stroke:#333,stroke-width:1px
    classDef orchestrator fill:#FDBA74,stroke:#333,stroke-width:1px
    classDef agents fill:#ABEBC6,stroke:#333,stroke-width:1px
    classDef external fill:#D7DBDD,stroke:#333,stroke-width:1px
    classDef datastore fill:#D2B4DE,stroke:#333,stroke-width:1px
    classDef config fill:#F2F3F4,stroke:#333,stroke-width:1px
```
