# ak8057/genai_llm_cold_email_generation_automation architecture

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

- Interactive diagram: https://gitdiagram.com/ak8057/genai_llm_cold_email_generation_automation
- Repository: https://github.com/ak8057/genai_llm_cold_email_generation_automation

## Overview

##### Project type and purpose
- This is a specialized “full-stack” Python application focused on generating cold emails.
- It exposes a Streamlit web UI for inputting a careers-page URL, orchestrates scraping, embedding, vector-search, and an LLM pipeline to create personalized emails.

##### File structure
- Top-level:
- app/ – contains the core Python modules and Streamlit entrypoint
- vectorstore/ – local Chroma vector-DB files (SQLite + binary segments)
- email_generator.ipynb – exploratory notebook
- requirements.txt, README.md, .gitignore
- app/:
- main.py – Streamlit app, defines the UI and ties everything together
- chains.py – defines LangChain chains (scrape → embed → generate)
- portfolio.py – loads and embeds local portfolio CSV
- resource/my_portfolio.csv – your sample portfolio data
- utils.py – helper functions (e.g., HTTP requests via GROQ API)

##### README for additional insights
- Uses GROQ API for scraping career pages
- Uses LangChain to orchestrate: scrape, extract job descriptions, embed portfolio, generate email
- Stores embeddings & metadata in a local Chroma vectorstore (SQLite + binary index files)
- Exposes a Streamlit front-end for user interaction

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["Streamlit UI"]:::presentation
    end

    %% Application Layer
    subgraph "Application Layer"
        Chains["Orchestration Layer\n(app/chains.py)"]:::logic
        Scraper["GROQ Scraper\n(app/utils.py)"]:::logic
        Portfolio["Portfolio Module\n(app/portfolio.py)"]:::logic
    end

    %% Data Layer
    subgraph "Data Layer"
        CSV["my_portfolio.csv"]:::data
        VS["Chroma Vectorstore"]:::data
    end

    %% External Services
    subgraph "External Services"
        GROQ["GROQ API"]:::external
        LLM["LLM Service"]:::external
    end

    %% Project Resources
    subgraph "Project Resources"
        NB["email_generator.ipynb"]:::data
        IMGS["imgs/"]:::data
        REQ["requirements.txt"]:::data
        RDME["README.md"]:::data
    end

    %% Data Flow
    UI -->|"submit URL"| Chains
    Chains -->|"invoke scraping"| Scraper
    Scraper -->|"HTTP/JSON"| GROQ
    GROQ -->|"raw listings"| Scraper
    Scraper -->|"listings"| Chains
    Chains -->|"load & embed"| Portfolio
    Portfolio -->|"reads CSV"| CSV
    Portfolio -->|"writes/reads embeddings"| VS
    VS -->|"top-k results"| Portfolio
    Portfolio -->|"portfolio embeddings"| Chains
    Chains -->|"prompt with data"| LLM
    LLM -->|"generated email"| Chains
    Chains -->|"display result"| UI

    %% Click Events
    click UI "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/app/main.py"
    click Chains "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/app/chains.py"
    click Scraper "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/app/utils.py"
    click Portfolio "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/app/portfolio.py"
    click CSV "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/app/resource/my_portfolio.csv"
    click VS "https://github.com/ak8057/genai_llm_cold_email_generation_automation/tree/main/vectorstore/"
    click NB "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/email_generator.ipynb"
    click IMGS "https://github.com/ak8057/genai_llm_cold_email_generation_automation/tree/main/imgs/"
    click REQ "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/requirements.txt"
    click RDME "https://github.com/ak8057/genai_llm_cold_email_generation_automation/blob/main/README.md"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#FFD580,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
