# tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system architecture

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

- Interactive diagram: https://gitdiagram.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system
- Repository: https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system

## Overview

IntelliDocs lets users upload PDFs, then ask questions and request summaries or cross-document comparisons with cited results. The primary path is Streamlit upload → FastAPI ingestion and embedding → chunk retrieval → answer generation → citation display; chat history is sent with questions. The README also documents hybrid vector/keyword search, reranking, abstention, and follow-up chat. Source excerpts show an in-memory backend and Gemini-based service, while OpenSearch support appears in retrieval code. Unsampled subsystem links are omitted where their runtime wiring is not evidenced.

Main entry points: [`app/main.py`](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/main.py) (FastAPI endpoints), [`app/rag/retrieval.py`](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/retrieval.py) (Hybrid retrieval and reranking), [`app/rag/service.py`](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/service.py) (RAG orchestration), [`frontend/app.py`](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/frontend/app.py) (Streamlit workspace)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["User interface"]
  node_streamlit["Streamlit workspace<br/>[app.py]"]
end

subgraph group_api["API and document lifecycle"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_pdf["PDF parsing<br/>[ingestion.py]"]
end

subgraph group_rag["RAG pipeline"]
  node_embeddings["Local embeddings<br/>[embeddings.py]"]
  node_service["RAG orchestration<br/>[service.py]"]
  node_retrieval["Hybrid retrieval and reranking<br/>[retrieval.py]"]
  node_generation["Answer generation<br/>[generation.py]"]
  node_security["Authorization filters<br/>[security.py]"]
end

subgraph group_state["Index and models"]
  node_models["RAG data models<br/>[models.py]"]
  node_index[("Chunk index<br/>[retrieval.py]")]
end

node_user(("Document user"))
node_gemini["Google Gemini"]
node_opensearch[("OpenSearch service")]

node_user -->|"uploads and asks"| node_streamlit
node_streamlit -->|"sends API requests"| node_api
node_api -->|"parses PDF"| node_pdf
node_pdf -->|"creates chunks"| node_models
node_api -->|"embeds uploaded text"| node_embeddings
node_api -->|"adds chunks"| node_index
node_api -->|"delegates questions and summaries"| node_service
node_service -->|"retrieves candidates"| node_retrieval
node_retrieval -->|"scores vectors"| node_embeddings
node_retrieval -->|"filters access"| node_security
node_retrieval -->|"searches chunks"| node_index
node_service -->|"generates answers"| node_gemini
node_service -->|"uses RAG data types"| node_models
node_streamlit -->|"shows answers and citations"| node_user
node_retrieval -.->|"supports backend"| node_opensearch

click node_streamlit "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/frontend/app.py"
click node_api "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/main.py"
click node_pdf "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/ingestion.py"
click node_embeddings "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/embeddings.py"
click node_service "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/service.py"
click node_retrieval "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/retrieval.py"
click node_generation "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/generation.py"
click node_security "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/security.py"
click node_models "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/models.py"
click node_index "https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/retrieval.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_user toneBlue
class node_api,node_pdf,node_opensearch toneAmber
class node_embeddings,node_service,node_retrieval,node_generation,node_security toneMint
class node_models,node_index toneRose
class node_gemini toneIndigo
```

## Components

### User interface

- [Streamlit workspace](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/frontend/app.py): `frontend/app.py`

### API and document lifecycle

- [FastAPI endpoints](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/main.py): `app/main.py`
- [PDF parsing](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/ingestion.py): `app/rag/ingestion.py`

### RAG pipeline

- [Local embeddings](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/embeddings.py): `app/rag/embeddings.py`
- [RAG orchestration](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/service.py): `app/rag/service.py`
- [Hybrid retrieval and reranking](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/retrieval.py): `app/rag/retrieval.py`
- [Answer generation](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/generation.py): `app/rag/generation.py`
- [Authorization filters](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/security.py): `app/rag/security.py`

### Index and models

- [RAG data models](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/models.py): `app/rag/models.py`
- [Chunk index](https://github.com/tanisharaj01/intellidocs-ai-powered-multi-document-intelligence-system/blob/main/app/rag/retrieval.py): `app/rag/retrieval.py`

### Other components

- **Document user**
- **Google Gemini**
- **OpenSearch service**

## Connections

- Document user → Streamlit workspace: uploads and asks (evidence: `frontend/app.py`)
- Streamlit workspace → FastAPI endpoints: sends API requests (evidence: `frontend/app.py`)
- FastAPI endpoints → PDF parsing: parses PDF (evidence: `app/main.py`)
- PDF parsing → RAG data models: creates chunks (evidence: `app/rag/ingestion.py`)
- FastAPI endpoints → Local embeddings: embeds uploaded text (evidence: `app/main.py`)
- FastAPI endpoints → Chunk index: adds chunks (evidence: `app/main.py`)
- FastAPI endpoints → RAG orchestration: delegates questions and summaries (evidence: `app/main.py`)
- RAG orchestration → Hybrid retrieval and reranking: retrieves candidates (evidence: `app/rag/service.py`)
- Hybrid retrieval and reranking → Local embeddings: scores vectors (evidence: `app/rag/retrieval.py`)
- Hybrid retrieval and reranking → Authorization filters: filters access (evidence: `app/rag/retrieval.py`)
- Hybrid retrieval and reranking → Chunk index: searches chunks (evidence: `app/rag/retrieval.py`)
- RAG orchestration → Google Gemini: generates answers (evidence: `app/rag/service.py`)
- RAG orchestration → RAG data models: uses RAG data types (evidence: `app/rag/service.py`)
- Streamlit workspace → Document user: shows answers and citations (evidence: `frontend/app.py`)
- Hybrid retrieval and reranking → OpenSearch service: supports backend (evidence: `app/rag/retrieval.py`)
