# paramesh137/docmind-main architecture

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

- Interactive diagram: https://gitdiagram.com/paramesh137/docmind-main
- Repository: https://github.com/paramesh137/docmind-main

## Overview

DocuMind is a document-grounded question-answering service with two principal workflows: ingest PDFs into a searchable vector index, then answer user questions with retrieved passages and source metadata. The graph separates ingestion, API handling, retrieval/generation, and external services. Relationships are based on the README or shown source; the raw PDF is an example input, and unsampled deployment wiring is omitted.

Main entry points: [`app/retrieval.py`](https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py) (Answer orchestration), [`app/main.py`](https://github.com/paramesh137/docmind-main/blob/main/app/main.py) (FastAPI endpoints), [`app/ingestion.py`](https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py) (Embedding and upsert), [`app/config.py`](https://github.com/paramesh137/docmind-main/blob/main/app/config.py) (Runtime settings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["Question API"]
  node_api["FastAPI endpoints<br/>[main.py]"]
  node_settings["Runtime settings<br/>[config.py]"]
end

subgraph group_ingestion["Document Ingestion"]
  node_ingest_runner["Ingestion entrypoint<br/>[run_ingestion.py]"]
  node_pdfs["Raw PDFs<br/>[refund_policy.pdf]"]
  node_pdf_loader["PDF loading<br/>[ingestion.py]"]
  node_chunking["Text chunking<br/>[ingestion.py]"]
  node_ingest_vectors["Embedding and upsert<br/>[ingestion.py]"]
end

subgraph group_retrieval["Answer Retrieval"]
  node_answer_flow["Answer orchestration<br/>[retrieval.py]"]
  node_vectorstore["Vector store setup<br/>[retrieval.py]"]
  node_retriever["Passage retrieval<br/>[retrieval.py]"]
  node_prompt["Grounded prompt<br/>[retrieval.py]"]
  node_generation["Answer generation<br/>[retrieval.py]"]
end

subgraph group_services["External Services"]
  node_pinecone[("Pinecone index")]
  node_openai["OpenAI APIs"]
end

node_user(("Questioner"))

node_user -->|"asks question"| node_api
node_api -->|"checks configuration"| node_settings
node_api -->|"calls answerer"| node_answer_flow
node_answer_flow -->|"returns answer and sources"| node_api
node_ingest_runner -->|"starts ingestion"| node_pdf_loader
node_pdfs -->|"loads PDFs"| node_pdf_loader
node_pdf_loader -->|"splits documents"| node_chunking
node_chunking -->|"passes chunks"| node_ingest_vectors
node_ingest_vectors -->|"embeds chunks"| node_openai
node_ingest_vectors -->|"upserts vectors"| node_pinecone
node_answer_flow -->|"checks credentials"| node_settings
node_answer_flow -->|"builds chain"| node_vectorstore
node_vectorstore -->|"creates embeddings"| node_openai
node_vectorstore -->|"opens index"| node_pinecone
node_answer_flow -->|"fetches source docs"| node_retriever
node_retriever -->|"searches vectors"| node_pinecone
node_answer_flow -->|"formats context"| node_prompt
node_prompt -->|"supplies question and context"| node_generation
node_generation -->|"generates answer"| node_openai

click node_api "https://github.com/paramesh137/docmind-main/blob/main/app/main.py"
click node_settings "https://github.com/paramesh137/docmind-main/blob/main/app/config.py"
click node_ingest_runner "https://github.com/paramesh137/docmind-main/blob/main/run_ingestion.py"
click node_pdfs "https://github.com/paramesh137/docmind-main/blob/main/data/raw_docs/refund_policy.pdf"
click node_pdf_loader "https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py"
click node_chunking "https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py"
click node_ingest_vectors "https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py"
click node_answer_flow "https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py"
click node_vectorstore "https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py"
click node_retriever "https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py"
click node_prompt "https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py"
click node_generation "https://github.com/paramesh137/docmind-main/blob/main/app/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_api,node_settings toneBlue
class node_ingest_runner,node_pdfs,node_pdf_loader,node_chunking,node_ingest_vectors toneAmber
class node_answer_flow,node_vectorstore,node_retriever,node_prompt,node_generation toneMint
class node_pinecone,node_openai toneRose
class node_user toneIndigo
```

## Components

### Question API

- [FastAPI endpoints](https://github.com/paramesh137/docmind-main/blob/main/app/main.py): `app/main.py`
- [Runtime settings](https://github.com/paramesh137/docmind-main/blob/main/app/config.py): `app/config.py`

### Document Ingestion

- [Ingestion entrypoint](https://github.com/paramesh137/docmind-main/blob/main/run_ingestion.py): `run_ingestion.py`
- [Raw PDFs](https://github.com/paramesh137/docmind-main/blob/main/data/raw_docs/refund_policy.pdf): `data/raw_docs/refund_policy.pdf`
- [PDF loading](https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py): `app/ingestion.py`
- [Text chunking](https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py): `app/ingestion.py`
- [Embedding and upsert](https://github.com/paramesh137/docmind-main/blob/main/app/ingestion.py): `app/ingestion.py`

### Answer Retrieval

- [Answer orchestration](https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py): `app/retrieval.py`
- [Vector store setup](https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py): `app/retrieval.py`
- [Passage retrieval](https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py): `app/retrieval.py`
- [Grounded prompt](https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py): `app/retrieval.py`
- [Answer generation](https://github.com/paramesh137/docmind-main/blob/main/app/retrieval.py): `app/retrieval.py`

### External Services

- **Pinecone index**
- **OpenAI APIs**

### Other components

- **Questioner**

## Connections

- Questioner → FastAPI endpoints: asks question (evidence: `app/main.py`)
- FastAPI endpoints → Runtime settings: checks configuration (evidence: `app/main.py`)
- FastAPI endpoints → Answer orchestration: calls answerer (evidence: `app/main.py`)
- Answer orchestration → FastAPI endpoints: returns answer and sources (evidence: `app/main.py`)
- Ingestion entrypoint → PDF loading: starts ingestion (evidence: `run_ingestion.py`)
- Raw PDFs → PDF loading: loads PDFs (evidence: `README.md`)
- PDF loading → Text chunking: splits documents (evidence: `app/ingestion.py`)
- Text chunking → Embedding and upsert: passes chunks (evidence: `app/ingestion.py`)
- Embedding and upsert → OpenAI APIs: embeds chunks (evidence: `app/ingestion.py`)
- Embedding and upsert → Pinecone index: upserts vectors (evidence: `app/ingestion.py`)
- Answer orchestration → Runtime settings: checks credentials (evidence: `app/retrieval.py`)
- Answer orchestration → Vector store setup: builds chain (evidence: `app/retrieval.py`)
- Vector store setup → OpenAI APIs: creates embeddings (evidence: `app/retrieval.py`)
- Vector store setup → Pinecone index: opens index (evidence: `app/retrieval.py`)
- Answer orchestration → Passage retrieval: fetches source docs (evidence: `app/retrieval.py`)
- Passage retrieval → Pinecone index: searches vectors (evidence: `app/retrieval.py`)
- Answer orchestration → Grounded prompt: formats context (evidence: `app/retrieval.py`)
- Grounded prompt → Answer generation: supplies question and context (evidence: `app/retrieval.py`)
- Answer generation → OpenAI APIs: generates answer (evidence: `app/retrieval.py`)
