# hemasree94/chat_with_multiple_pdfs architecture

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

- Interactive diagram: https://gitdiagram.com/hemasree94/chat_with_multiple_pdfs
- Repository: https://github.com/hemasree94/chat_with_multiple_pdfs

## Overview

This Streamlit app lets a user ask questions about Tesla, Uber, and Google annual-report PDFs. On each run, the app extracts PDF text, chunks it, builds a Chroma vector store, and creates a retrieval-and-answer chain; submitted questions are answered from retrieved context and displayed in the chat. Chat history is held in Streamlit session state. The graph reflects the single sampled source file; internal behavior of the LangChain retrieval components is not independently inspected.

Main entry points: [`sample.py`](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py) (Streamlit chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Chat interface"]
  node_chat["Streamlit chat<br/>[sample.py]"]
  node_history["Chat history<br/>[sample.py]"]
end

subgraph group_ingestion["PDF ingestion"]
  node_pdfs["Annual report PDFs"]
  node_extract["PDF text extraction<br/>[sample.py]"]
  node_chunk["Text chunking<br/>[sample.py]"]
  node_index["Vector indexing<br/>[sample.py]"]
  node_chroma[("Chroma vector store<br/>[sample.py]")]
  node_embeddings["Hugging Face embeddings<br/>[sample.py]"]
end

subgraph group_qa["Retrieval and answers"]
  node_chain["Retrieval chain setup<br/>[sample.py]"]
  node_model["Hugging Face model"]
  node_answer["Answer extraction<br/>[sample.py]"]
end

node_user(("User"))

node_user -->|"asks question"| node_chat
node_chat -->|"restores and updates"| node_history
node_chat -->|"loads PDFs"| node_extract
node_extract -->|"reads pages"| node_pdfs
node_chat -->|"splits text"| node_chunk
node_chat -->|"indexes chunks"| node_index
node_index -->|"embeds chunks"| node_embeddings
node_index -->|"creates store"| node_chroma
node_chat -->|"builds chain"| node_chain
node_chain -->|"configures retriever"| node_chroma
node_chain -->|"configures model"| node_model
node_chat -->|"invokes for question"| node_chain
node_chat -->|"extracts response"| node_answer
node_chat -->|"displays answer"| node_user

click node_chat "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_history "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_extract "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_chunk "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_index "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_chroma "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_embeddings "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_chain "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"
click node_answer "https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py"

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_chat,node_history,node_user toneBlue
class node_pdfs,node_extract,node_chunk,node_index,node_chroma,node_embeddings toneAmber
class node_chain,node_model,node_answer toneMint
```

## Components

### Chat interface

- [Streamlit chat](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`
- [Chat history](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`

### PDF ingestion

- **Annual report PDFs**
- [PDF text extraction](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`
- [Text chunking](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`
- [Vector indexing](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`
- [Chroma vector store](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`
- [Hugging Face embeddings](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`

### Retrieval and answers

- [Retrieval chain setup](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`
- **Hugging Face model**
- [Answer extraction](https://github.com/hemasree94/chat_with_multiple_pdfs/blob/main/sample.py): `sample.py`

### Other components

- **User**

## Connections

- User → Streamlit chat: asks question (evidence: `sample.py`)
- Streamlit chat → Chat history: restores and updates (evidence: `sample.py`)
- Streamlit chat → PDF text extraction: loads PDFs (evidence: `sample.py`)
- PDF text extraction → Annual report PDFs: reads pages (evidence: `sample.py`)
- Streamlit chat → Text chunking: splits text (evidence: `sample.py`)
- Streamlit chat → Vector indexing: indexes chunks (evidence: `sample.py`)
- Vector indexing → Hugging Face embeddings: embeds chunks (evidence: `sample.py`)
- Vector indexing → Chroma vector store: creates store (evidence: `sample.py`)
- Streamlit chat → Retrieval chain setup: builds chain (evidence: `sample.py`)
- Retrieval chain setup → Chroma vector store: configures retriever (evidence: `sample.py`)
- Retrieval chain setup → Hugging Face model: configures model (evidence: `sample.py`)
- Streamlit chat → Retrieval chain setup: invokes for question (evidence: `sample.py`)
- Streamlit chat → Answer extraction: extracts response (evidence: `sample.py`)
- Streamlit chat → User: displays answer (evidence: `sample.py`)
