# naxusprime/rag-project-with-pdf-uploader architecture

> Architecture diagram of the GitHub repository naxusprime/rag-project-with-pdf-uploader, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/naxusprime/rag-project-with-pdf-uploader
- Repository: https://github.com/naxusprime/rag-project-with-pdf-uploader

## Overview

This is a single-file Streamlit app for chatting with locally processed PDFs. The main workflow is PDF upload, extraction and chunking, embedding and vector storage, multi-query retrieval, and a context-grounded answer. Session state retains the vector database and chat history across UI reruns. The source shows the orchestration and library calls; Ollama is represented as a local model service. No separate source modules implement the documented capabilities.

Main entry points: [`app.py`](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py) (Streamlit UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chat interface"]
  node_streamlit["Streamlit UI<br/>[app.py]"]
  node_session["Session state<br/>[app.py]"]
end

subgraph group_documents["Document preparation"]
  node_pdf["PDF extraction<br/>[app.py]"]
  node_chunking["Text chunking<br/>[app.py]"]
  node_embeddings["Text embeddings<br/>[app.py]"]
  node_chroma[("Chroma vector store<br/>[app.py]")]
end

subgraph group_answering["Retrieval and answering"]
  node_retriever["Multi-query retriever<br/>[app.py]"]
  node_chain["RAG chain<br/>[app.py]"]
  node_answer["Generated answer<br/>[app.py]"]
end

node_user(("User"))
node_ollama["Ollama local models"]

node_user -->|"uploads and asks"| node_streamlit
node_streamlit -->|"processes upload"| node_pdf
node_pdf -->|"splits documents"| node_chunking
node_chunking -->|"stores chunks"| node_chroma
node_embeddings -->|"requests embeddings"| node_ollama
node_chroma -->|"uses embeddings"| node_embeddings
node_streamlit -->|"retains state"| node_session
node_streamlit -->|"creates retriever"| node_retriever
node_chroma -->|"provides search"| node_retriever
node_retriever -->|"generates queries"| node_ollama
node_streamlit -->|"builds and invokes"| node_chain
node_chain -->|"retrieves context"| node_retriever
node_chain -->|"generates response"| node_ollama
node_chain -->|"returns answer"| node_answer
node_answer -->|"displays response"| node_streamlit
node_streamlit -->|"stores chat history"| node_session

click node_streamlit "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_session "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_pdf "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_chunking "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_embeddings "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_chroma "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_retriever "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_chain "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py"
click node_answer "https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.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_streamlit,node_session,node_user toneBlue
class node_pdf,node_chunking,node_embeddings,node_chroma toneAmber
class node_retriever,node_chain,node_answer toneMint
class node_ollama toneIndigo
```

## Components

### Chat interface

- [Streamlit UI](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`
- [Session state](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`

### Document preparation

- [PDF extraction](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`
- [Text chunking](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`
- [Text embeddings](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`
- [Chroma vector store](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`

### Retrieval and answering

- [Multi-query retriever](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`
- [RAG chain](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`
- [Generated answer](https://github.com/naxusprime/rag-project-with-pdf-uploader/blob/main/app.py): `app.py`

### Other components

- **User**
- **Ollama local models**

## Connections

- User → Streamlit UI: uploads and asks (evidence: `README.md`)
- Streamlit UI → PDF extraction: processes upload (evidence: `app.py`)
- PDF extraction → Text chunking: splits documents (evidence: `app.py`)
- Text chunking → Chroma vector store: stores chunks (evidence: `app.py`)
- Text embeddings → Ollama local models: requests embeddings (evidence: `app.py`)
- Chroma vector store → Text embeddings: uses embeddings (evidence: `app.py`)
- Streamlit UI → Session state: retains state (evidence: `app.py`)
- Streamlit UI → Multi-query retriever: creates retriever (evidence: `app.py`)
- Chroma vector store → Multi-query retriever: provides search (evidence: `app.py`)
- Multi-query retriever → Ollama local models: generates queries (evidence: `README.md`)
- Streamlit UI → RAG chain: builds and invokes (evidence: `app.py`)
- RAG chain → Multi-query retriever: retrieves context (evidence: `app.py`)
- RAG chain → Ollama local models: generates response (evidence: `app.py`)
- RAG chain → Generated answer: returns answer (evidence: `app.py`)
- Generated answer → Streamlit UI: displays response (evidence: `app.py`)
- Streamlit UI → Session state: stores chat history (evidence: `app.py`)
