# dev-nikhil02/agentic-rag-demo architecture

> Architecture diagram of the GitHub repository dev-nikhil02/agentic-rag-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dev-nikhil02/agentic-rag-demo
- Repository: https://github.com/dev-nikhil02/agentic-rag-demo

## Overview

##### Project Type & Purpose
- A Retrieval-Augmented Generation (RAG) pipeline for querying CSV (“books/GOOGL…”), PDF (“financial_reports/…”), and other text sources.
- Provides a simple Python app (app.py) and scripts (rag_pipeline.py) to ingest docs, build embeddings in ChromaDB, and answer user queries via an LLM.

##### Main Components
- Data Sources: CSV files, PDF reports, notebooks (prototype_Rag_agent.ipynb)
- Ingestion & Preprocessing: rag_pipeline.py reads, splits, and embeds documents
- Vector Store: ChromaDB directory with binary and SQLite files
- Retriever: LangChain-style vector search against ChromaDB
- LLM Interface: OpenAI (or similar) calls wrapped in app.py
- UI/API Layer: app.py exposes a CLI or HTTP endpoint
- Logging: llm_logs.txt for tracking queries/responses

##### Component Interactions
- Response flows back to app.py → User
- Logs captured from each LLM call

##### Architectural Patterns & Principles
- Separation of concerns: ingestion, storage, retrieval, and presentation are distinct modules
- Pipeline pattern: rag_pipeline.py defines a linear ETL-style flow
- Modular storage: ChromaDB abstracts vector persistence

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Top tier: Document Inputs
    subgraph "Document Inputs"
        DS_CSV["CSV Files\nbooks/GOOGL-2013_2023.csv"]:::io
        DS_PDF["PDF Reports\nfinancial_reports"]:::io
        DS_NB["Notebook\nprototype_Rag_agent.ipynb"]:::io
    end

    %% Middle tier: Ingestion & Store
    subgraph "Ingestion & Vector Store"
        INGEST["Ingestion & Preprocessing\nrag_pipeline.py"]:::process
        CHROMA["ChromaDB Persistence\nchroma_db/"]:::io
    end

    %% Bottom tier: Retrieval & Presentation
    subgraph "Retrieval & Presentation"
        APP["App & Retriever\napp.py"]:::process
        OPENAI["OpenAI LLM Service"]:::ext
        LOGS["Logging\nllm_logs.txt"]:::io
        USER["User"]:::io
    end

    %% Data flow
    DS_CSV -->|"reads"| INGEST
    DS_PDF -->|"reads"| INGEST
    DS_NB -->|"reads"| INGEST
    INGEST -->|"embeds→stores"| CHROMA

    APP -->|"queries"| CHROMA
    CHROMA -->|"returns vectors"| APP
    APP -->|"calls"| OPENAI
    OPENAI -->|"response"| APP
    APP -->|"shows"| USER

    %% Logging flow
    APP -->|"logs queries/responses"| LOGS

    %% Click events
    click DS_CSV "https://github.com/dev-nikhil02/agentic-rag-demo/blob/main/books/GOOGL-2013_2023.csv"
    click DS_PDF "https://github.com/dev-nikhil02/agentic-rag-demo/tree/main/financial_reports"
    click DS_NB "https://github.com/dev-nikhil02/agentic-rag-demo/blob/main/prototype_Rag_agent.ipynb"
    click INGEST "https://github.com/dev-nikhil02/agentic-rag-demo/blob/main/rag_pipeline.py"
    click CHROMA "https://github.com/dev-nikhil02/agentic-rag-demo/tree/main/chroma_db/"
    click APP "https://github.com/dev-nikhil02/agentic-rag-demo/blob/main/app.py"
    click LOGS "https://github.com/dev-nikhil02/agentic-rag-demo/blob/main/llm_logs.txt"

    %% Styles
    classDef io fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef process fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20
    classDef ext fill:#ffe0b2,stroke:#e65100,color:#e65100
```
