# dalinaveen/ai-powered-multi-document-assistant architecture

> Architecture diagram of the GitHub repository dalinaveen/ai-powered-multi-document-assistant, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dalinaveen/ai-powered-multi-document-assistant
- Repository: https://github.com/dalinaveen/ai-powered-multi-document-assistant

## Overview

This is a Streamlit document assistant: users upload files, which are loaded, cleaned, chunked, and indexed; questions then retrieve indexed context for Groq-backed responses. The graph distinguishes ingestion, indexing, and answer-generation stages, plus the UI. Source excerpts show the principal calls; README claims additional output tasks, but the sampled implementation uses a general prompt-and-answer chain. The upload and OCR paths are represented at their shared source-file level.

Main entry points: [`src/calling_build.py`](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/calling_build.py) (Processing orchestrator), [`app/app.py`](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/app/app.py) (Streamlit UI), [`src/rag_pipeline.py`](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/rag_pipeline.py) (Context retrieval), [`src/build_faiss.py`](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/build_faiss.py) (FAISS index builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_streamlit["Streamlit UI<br/>[app.py]"]
  node_uploaded_files["Uploaded files"]
end

subgraph group_ingestion["Document ingestion"]
  node_processing["Processing orchestrator<br/>[calling_build.py]"]
  node_document_loaders["Document loaders<br/>[load_documents.py]"]
  node_ocr["Image and scan OCR<br/>[load_documents.py]"]
  node_cleaning["Text cleaning<br/>[clean_chunk.py]"]
  node_chunking["Text chunking<br/>[clean_chunk.py]"]
end

subgraph group_indexing["Indexing and retrieval"]
  node_index_builder["FAISS index builder<br/>[build_faiss.py]"]
  node_embeddings["Embedding model<br/>[embeddings.py]"]
  node_vector_store[("FAISS vector store")]
end

subgraph group_generation["Answer generation"]
  node_retrieval["Context retrieval<br/>[rag_pipeline.py]"]
  node_prompt_chain["Prompt chain<br/>[rag_pipeline.py]"]
  node_answer["Generated answer"]
end

node_user(("User"))
node_groq["Groq LLM"]

node_user -->|"uses"| node_streamlit
node_user -->|"selects"| node_uploaded_files
node_uploaded_files -->|"uploads"| node_streamlit
node_streamlit -->|"calls processing"| node_processing
node_streamlit -->|"requests answer"| node_retrieval
node_processing -->|"loads documents"| node_document_loaders
node_document_loaders -->|"uses for scans"| node_ocr
node_processing -->|"cleans text"| node_cleaning
node_processing -->|"chunks text"| node_chunking
node_processing -->|"builds index"| node_index_builder
node_index_builder -->|"creates embeddings"| node_embeddings
node_index_builder -->|"writes index"| node_vector_store
node_retrieval -->|"loads index"| node_vector_store
node_retrieval -->|"provides context"| node_prompt_chain
node_prompt_chain -->|"invokes model"| node_groq
node_prompt_chain -->|"returns response"| node_answer
node_retrieval -->|"returns answer"| node_streamlit

click node_streamlit "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/app/app.py"
click node_processing "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/calling_build.py"
click node_document_loaders "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/load_documents.py"
click node_ocr "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/load_documents.py"
click node_cleaning "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/clean_chunk.py"
click node_chunking "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/clean_chunk.py"
click node_index_builder "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/build_faiss.py"
click node_embeddings "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/embeddings.py"
click node_retrieval "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/rag_pipeline.py"
click node_prompt_chain "https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/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,node_uploaded_files,node_user toneBlue
class node_processing,node_document_loaders,node_ocr,node_cleaning,node_chunking toneAmber
class node_index_builder,node_embeddings,node_vector_store toneMint
class node_retrieval,node_prompt_chain,node_answer toneRose
class node_groq toneIndigo
```

## Components

### User interface

- [Streamlit UI](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/app/app.py): `app/app.py`
- **Uploaded files**

### Document ingestion

- [Processing orchestrator](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/calling_build.py): `src/calling_build.py`
- [Document loaders](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/load_documents.py): `src/load_documents.py`
- [Image and scan OCR](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/load_documents.py): `src/load_documents.py`
- [Text cleaning](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/clean_chunk.py): `src/clean_chunk.py`
- [Text chunking](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/clean_chunk.py): `src/clean_chunk.py`

### Indexing and retrieval

- [FAISS index builder](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/build_faiss.py): `src/build_faiss.py`
- [Embedding model](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/embeddings.py): `src/embeddings.py`
- **FAISS vector store**

### Answer generation

- [Context retrieval](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/rag_pipeline.py): `src/rag_pipeline.py`
- [Prompt chain](https://github.com/dalinaveen/ai-powered-multi-document-assistant/blob/main/src/rag_pipeline.py): `src/rag_pipeline.py`
- **Generated answer**

### Other components

- **User**
- **Groq LLM**

## Connections

- User → Streamlit UI: uses (evidence: `app/app.py`)
- User → Uploaded files: selects
- Uploaded files → Streamlit UI: uploads (evidence: `app/app.py`)
- Streamlit UI → Processing orchestrator: calls processing (evidence: `app/app.py`)
- Streamlit UI → Context retrieval: requests answer (evidence: `app/app.py`)
- Processing orchestrator → Document loaders: loads documents (evidence: `src/calling_build.py`)
- Document loaders → Image and scan OCR: uses for scans (evidence: `src/load_documents.py`)
- Processing orchestrator → Text cleaning: cleans text (evidence: `src/calling_build.py`)
- Processing orchestrator → Text chunking: chunks text (evidence: `src/calling_build.py`)
- Processing orchestrator → FAISS index builder: builds index (evidence: `src/calling_build.py`)
- FAISS index builder → Embedding model: creates embeddings (evidence: `src/build_faiss.py`)
- FAISS index builder → FAISS vector store: writes index (evidence: `src/build_faiss.py`)
- Context retrieval → FAISS vector store: loads index (evidence: `src/rag_pipeline.py`)
- Context retrieval → Prompt chain: provides context (evidence: `src/rag_pipeline.py`)
- Prompt chain → Groq LLM: invokes model (evidence: `src/rag_pipeline.py`)
- Prompt chain → Generated answer: returns response (evidence: `src/rag_pipeline.py`)
- Context retrieval → Streamlit UI: returns answer (evidence: `app/app.py`)
