# sumith2004/productive-rag architecture

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

- Interactive diagram: https://gitdiagram.com/sumith2004/productive-rag
- Repository: https://github.com/sumith2004/productive-rag

## Overview

Productive RAG is a Streamlit document-question-answering app. Users create or select a persistent chatbot, upload a PDF or DOCX for indexing, then ask questions answered from retrieved document content. The documented ingestion path partitions mixed content, chunks it, summarizes mixed-content chunks, embeds them, and stores vectors; querying retrieves relevant chunks and generates an answer. The excerpts show the app calling the shared pipeline and session-file persistence. Pipeline stage links and capabilities not directly visible in the excerpts are based on the README; notebooks are omitted as alternate workflow interfaces.

Main entry points: [`app.py`](https://github.com/sumith2004/productive-rag/blob/master/app.py) (Streamlit app), [`rag_pipeline.py`](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py) (Mixed-content summary)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_streamlit_app["Streamlit app<br/>[app.py]"]
  node_session_files[("Session files<br/>[app.py]")]
end

subgraph group_ingestion["Document ingestion"]
  node_ingestion_flow["Ingestion pipeline<br/>[rag_pipeline.py]"]
  node_partition["Document partition<br/>[rag_pipeline.py]"]
  node_chunking["Title chunking<br/>[rag_pipeline.py]"]
  node_content_summary["Mixed-content summary<br/>[rag_pipeline.py]"]
  node_embedding["Text embeddings<br/>[rag_pipeline.py]"]
  node_vector_store[("Chroma vectors<br/>[rag_pipeline.py]")]
end

subgraph group_query["Question answering"]
  node_query_flow["Query pipeline<br/>[rag_pipeline.py]"]
  node_retrieval["Chunk retrieval<br/>[rag_pipeline.py]"]
  node_answer_generation["Answer generation<br/>[rag_pipeline.py]"]
end

node_user(("User"))
node_groq{{"Groq LLM"}}
node_embedding_model{{"HuggingFace model"}}

node_user -->|"uploads and asks"| node_streamlit_app
node_streamlit_app -->|"starts ingestion"| node_ingestion_flow
node_ingestion_flow -->|"partitions"| node_partition
node_partition -->|"produces elements"| node_chunking
node_chunking -->|"forms chunks"| node_content_summary
node_content_summary -->|"prepares documents"| node_embedding
node_embedding -->|"embeds with"| node_embedding_model
node_embedding -->|"stores vectors"| node_vector_store
node_streamlit_app -->|"persists sessions"| node_session_files
node_streamlit_app -->|"requests retrieval and answer"| node_query_flow
node_query_flow -->|"retrieves chunks"| node_retrieval
node_retrieval -->|"searches vectors"| node_vector_store
node_query_flow -->|"generates answer"| node_answer_generation
node_answer_generation -->|"invokes model"| node_groq
node_content_summary -->|"summarizes mixed content"| node_groq

click node_streamlit_app "https://github.com/sumith2004/productive-rag/blob/master/app.py"
click node_session_files "https://github.com/sumith2004/productive-rag/blob/master/app.py"
click node_ingestion_flow "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_partition "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_chunking "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_content_summary "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_embedding "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_vector_store "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_query_flow "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_retrieval "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py"
click node_answer_generation "https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.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_app,node_session_files,node_user toneBlue
class node_ingestion_flow,node_partition,node_chunking,node_content_summary,node_embedding,node_vector_store toneAmber
class node_query_flow,node_retrieval,node_answer_generation toneMint
class node_groq,node_embedding_model toneIndigo
```

## Components

### App experience

- [Streamlit app](https://github.com/sumith2004/productive-rag/blob/master/app.py): `app.py`
- [Session files](https://github.com/sumith2004/productive-rag/blob/master/app.py): `app.py`

### Document ingestion

- [Ingestion pipeline](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Document partition](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Title chunking](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Mixed-content summary](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Text embeddings](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Chroma vectors](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`

### Question answering

- [Query pipeline](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Chunk retrieval](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`
- [Answer generation](https://github.com/sumith2004/productive-rag/blob/master/rag_pipeline.py): `rag_pipeline.py`

### Other components

- **User**
- **Groq LLM**
- **HuggingFace model**

## Connections

- User → Streamlit app: uploads and asks (evidence: `README.md`)
- Streamlit app → Ingestion pipeline: starts ingestion (evidence: `app.py`)
- Ingestion pipeline → Document partition: partitions (evidence: `README.md`)
- Document partition → Title chunking: produces elements (evidence: `README.md`)
- Title chunking → Mixed-content summary: forms chunks (evidence: `README.md`)
- Mixed-content summary → Text embeddings: prepares documents (evidence: `README.md`)
- Text embeddings → HuggingFace model: embeds with (evidence: `README.md`)
- Text embeddings → Chroma vectors: stores vectors (evidence: `README.md`)
- Streamlit app → Session files: persists sessions (evidence: `README.md`)
- Streamlit app → Query pipeline: requests retrieval and answer (evidence: `app.py`)
- Query pipeline → Chunk retrieval: retrieves chunks (evidence: `README.md`)
- Chunk retrieval → Chroma vectors: searches vectors (evidence: `README.md`)
- Query pipeline → Answer generation: generates answer (evidence: `README.md`)
- Answer generation → Groq LLM: invokes model (evidence: `README.md`)
- Mixed-content summary → Groq LLM: summarizes mixed content (evidence: `README.md`)
