# bhanuteja340-art/chatbot architecture

> Architecture diagram of the GitHub repository bhanuteja340-art/chatbot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bhanuteja340-art/chatbot
- Repository: https://github.com/bhanuteja340-art/chatbot

## Overview

AI Interview Assistant serves questions through CLI and Streamlit entry points. Both use a shared RAG pipeline that embeds the query, retrieves up to five PDF-derived chunks from persistent ChromaDB, and asks Gemini to generate a context-grounded answer; the UI also displays timing and retrieved sources. A separate ingestion workflow extracts PDF pages, chunks them, embeds content, and updates the vector store with fingerprint-based rebuild or incremental behavior. Source excerpts establish the principal calls; README documents the web and CLI capabilities.

Main entry points: [`src/rag_pipeline.py`](https://github.com/bhanuteja340-art/chatbot/blob/master/src/rag_pipeline.py) (RAG pipeline), [`src/ingest.py`](https://github.com/bhanuteja340-art/chatbot/blob/master/src/ingest.py) (Ingestion coordinator), [`src/vector_store.py`](https://github.com/bhanuteja340-art/chatbot/blob/master/src/vector_store.py) (Vector store adapter), [`src/retriever.py`](https://github.com/bhanuteja340-art/chatbot/blob/master/src/retriever.py) (Retriever)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User interfaces"]
  node_cli["CLI<br/>[main.py]"]
  node_web["Streamlit app<br/>[app.py]"]
end

subgraph group_answering["Answering workflow"]
  node_pipeline["RAG pipeline<br/>[rag_pipeline.py]"]
  node_retriever["Retriever<br/>[retriever.py]"]
  node_queryembed["Query embedding<br/>[embeddings.py]"]
  node_generator["Answer generator<br/>[generator.py]"]
end

subgraph group_knowledge["Knowledge ingestion"]
  node_pdf["Interview PDF"]
  node_ingest["Ingestion coordinator<br/>[ingest.py]"]
  node_loader["PDF extraction<br/>[pdf_loader.py]"]
  node_chunking["Section chunking<br/>[chunking.py]"]
  node_docembed["Document embeddings<br/>[embeddings.py]"]
end

subgraph group_integrations["External services and state"]
  node_storeapi["Vector store adapter<br/>[vector_store.py]"]
  node_chroma[("ChromaDB store")]
  node_metadata["Ingestion fingerprint"]
  node_gemini{{"Gemini API"}}
end

node_user(("Questioner"))

node_user -->|"asks via CLI"| node_cli
node_user -->|"asks via web"| node_web
node_cli -->|"calls"| node_pipeline
node_web -->|"calls"| node_pipeline
node_pipeline -->|"retrieves"| node_retriever
node_retriever -->|"embeds query"| node_queryembed
node_queryembed -->|"requests embedding"| node_gemini
node_retriever -->|"searches"| node_storeapi
node_storeapi -->|"queries"| node_chroma
node_chroma -->|"returns matches"| node_storeapi
node_retriever -->|"returns chunks"| node_pipeline
node_pipeline -->|"generates answer"| node_generator
node_generator -->|"requests answer"| node_gemini
node_generator -->|"returns answer"| node_pipeline
node_pipeline -->|"returns result"| node_cli
node_pipeline -->|"returns result"| node_web
node_ingest -->|"reads"| node_pdf
node_ingest -->|"loads PDF"| node_loader
node_loader -->|"creates chunks"| node_chunking
node_ingest -->|"embeds chunks"| node_docembed
node_docembed -->|"requests embeddings"| node_gemini
node_ingest -->|"updates store"| node_storeapi
node_storeapi -->|"upserts chunks"| node_chroma
node_ingest -->|"reads and writes"| node_metadata

click node_cli "https://github.com/bhanuteja340-art/chatbot/blob/master/main.py"
click node_web "https://github.com/bhanuteja340-art/chatbot/blob/master/app.py"
click node_pipeline "https://github.com/bhanuteja340-art/chatbot/blob/master/src/rag_pipeline.py"
click node_retriever "https://github.com/bhanuteja340-art/chatbot/blob/master/src/retriever.py"
click node_queryembed "https://github.com/bhanuteja340-art/chatbot/blob/master/src/embeddings.py"
click node_generator "https://github.com/bhanuteja340-art/chatbot/blob/master/src/generator.py"
click node_pdf "https://github.com/bhanuteja340-art/chatbot/blob/master/knowledge_base/top%20100%20common%20interview%20questions%20and%20best%20answers.pdf"
click node_ingest "https://github.com/bhanuteja340-art/chatbot/blob/master/src/ingest.py"
click node_loader "https://github.com/bhanuteja340-art/chatbot/blob/master/src/pdf_loader.py"
click node_chunking "https://github.com/bhanuteja340-art/chatbot/blob/master/src/chunking.py"
click node_docembed "https://github.com/bhanuteja340-art/chatbot/blob/master/src/embeddings.py"
click node_storeapi "https://github.com/bhanuteja340-art/chatbot/blob/master/src/vector_store.py"
click node_chroma "https://github.com/bhanuteja340-art/chatbot/tree/master/vector_store"
click node_metadata "https://github.com/bhanuteja340-art/chatbot/blob/master/vector_store/ingestion_metadata.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_web toneBlue
class node_pipeline,node_retriever,node_queryembed,node_generator toneAmber
class node_pdf,node_ingest,node_loader,node_chunking,node_docembed toneMint
class node_storeapi,node_chroma,node_metadata,node_gemini toneRose
class node_user toneIndigo
```

## Components

### User interfaces

- [CLI](https://github.com/bhanuteja340-art/chatbot/blob/master/main.py): `main.py`
- [Streamlit app](https://github.com/bhanuteja340-art/chatbot/blob/master/app.py): `app.py`

### Answering workflow

- [RAG pipeline](https://github.com/bhanuteja340-art/chatbot/blob/master/src/rag_pipeline.py): `src/rag_pipeline.py`
- [Retriever](https://github.com/bhanuteja340-art/chatbot/blob/master/src/retriever.py): `src/retriever.py`
- [Query embedding](https://github.com/bhanuteja340-art/chatbot/blob/master/src/embeddings.py): `src/embeddings.py`
- [Answer generator](https://github.com/bhanuteja340-art/chatbot/blob/master/src/generator.py): `src/generator.py`

### Knowledge ingestion

- [Interview PDF](https://github.com/bhanuteja340-art/chatbot/blob/master/knowledge_base/top%20100%20common%20interview%20questions%20and%20best%20answers.pdf): `knowledge_base/top 100 common interview questions and best answers.pdf`
- [Ingestion coordinator](https://github.com/bhanuteja340-art/chatbot/blob/master/src/ingest.py): `src/ingest.py`
- [PDF extraction](https://github.com/bhanuteja340-art/chatbot/blob/master/src/pdf_loader.py): `src/pdf_loader.py`
- [Section chunking](https://github.com/bhanuteja340-art/chatbot/blob/master/src/chunking.py): `src/chunking.py`
- [Document embeddings](https://github.com/bhanuteja340-art/chatbot/blob/master/src/embeddings.py): `src/embeddings.py`

### External services and state

- [Vector store adapter](https://github.com/bhanuteja340-art/chatbot/blob/master/src/vector_store.py): `src/vector_store.py`
- [ChromaDB store](https://github.com/bhanuteja340-art/chatbot/tree/master/vector_store): `vector_store`
- [Ingestion fingerprint](https://github.com/bhanuteja340-art/chatbot/blob/master/vector_store/ingestion_metadata.json): `vector_store/ingestion_metadata.json`
- **Gemini API**

### Other components

- **Questioner**

## Connections

- Questioner → CLI: asks via CLI
- Questioner → Streamlit app: asks via web
- CLI → RAG pipeline: calls
- Streamlit app → RAG pipeline: calls
- RAG pipeline → Retriever: retrieves
- Retriever → Query embedding: embeds query
- Query embedding → Gemini API: requests embedding
- Retriever → Vector store adapter: searches
- Vector store adapter → ChromaDB store: queries
- ChromaDB store → Vector store adapter: returns matches
- Retriever → RAG pipeline: returns chunks
- RAG pipeline → Answer generator: generates answer
- Answer generator → Gemini API: requests answer
- Answer generator → RAG pipeline: returns answer
- RAG pipeline → CLI: returns result
- RAG pipeline → Streamlit app: returns result
- Ingestion coordinator → Interview PDF: reads
- Ingestion coordinator → PDF extraction: loads PDF
- PDF extraction → Section chunking: creates chunks
- Ingestion coordinator → Document embeddings: embeds chunks
- Document embeddings → Gemini API: requests embeddings
- Ingestion coordinator → Vector store adapter: updates store
- Vector store adapter → ChromaDB store: upserts chunks
- Ingestion coordinator → Ingestion fingerprint: reads and writes
