# ssp001/rag-6 architecture

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

- Interactive diagram: https://gitdiagram.com/ssp001/rag-6
- Repository: https://github.com/ssp001/rag-6

## Overview

This repository implements a PDF-backed RAG chatbot: users ingest documents, query session-scoped knowledge, receive streamed AI answers, and can delete session vectors. The API owns the documented endpoint workflows; services delegate to source-layer implementations, with Qdrant and the model provider as external dependencies. README content is empty, so capabilities and wiring here are based on the sampled API, UI, and service code; unsampled internals are represented only where the tree supports them.

Main entry points: [`app/api/api.py`](https://github.com/ssp001/rag-6/blob/main/app/api/api.py) (FastAPI endpoints), [`app/src/qudrent_vector.py`](https://github.com/ssp001/rag-6/blob/main/app/src/qudrent_vector.py) (Qdrant operations), [`ui/app.py`](https://github.com/ssp001/rag-6/blob/main/ui/app.py) (Streamlit chat UI), [`app/service/qudrent_vector_delete_service.py`](https://github.com/ssp001/rag-6/blob/main/app/service/qudrent_vector_delete_service.py) (Vector deletion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["User interface"]
  node_ui["Streamlit chat UI<br/>[app.py]"]
end

subgraph group_api["API workflows"]
  node_api["FastAPI endpoints<br/>[api.py]"]
  node_deleteservice["Vector deletion"]
end

subgraph group_ingestion["Document ingestion"]
  node_pdfservice["PDF loading"]
  node_pdfreader["PDF reader<br/>[pdf_loder.py]"]
  node_splitservice["Text chunking"]
  node_splitter["Text splitter<br/>[text_splitter.py]"]
  node_embedservice["Embedding service"]
  node_embedder["Vector embedder<br/>[vector_embedder.py]"]
  node_uploadservice["Vector upload"]
  node_qdrantwriter["Qdrant operations<br/>[qudrent_vector.py]"]
end

subgraph group_retrieval["Retrieval and generation"]
  node_searchservice["Vector search service"]
  node_search["Vector search<br/>[vector_search.py]"]
  node_aiservice["AI response service"]
  node_aiclient["Chat model client<br/>[ai_respones.py]"]
end

node_user(("User"))
node_qdrant[("Qdrant store")]
node_modelprovider{{"Chat model provider"}}

node_user -->|"uses"| node_ui
node_ui -->|"requests"| node_api
node_api -->|"loads PDF"| node_pdfservice
node_pdfservice -->|"reads PDF"| node_pdfreader
node_api -->|"splits text"| node_splitservice
node_splitservice -->|"chunks text"| node_splitter
node_api -->|"creates embeddings"| node_embedservice
node_embedservice -->|"embeds chunks"| node_embedder
node_api -->|"uploads vectors"| node_uploadservice
node_uploadservice -->|"writes vectors"| node_qdrantwriter
node_qdrantwriter -->|"stores vectors"| node_qdrant
node_api -->|"searches context"| node_searchservice
node_searchservice -->|"runs search"| node_search
node_search -->|"retrieves matches"| node_qdrant
node_api -->|"streams answer"| node_aiservice
node_aiservice -->|"runs query"| node_aiclient
node_aiclient -->|"generates response"| node_modelprovider
node_api -->|"deletes session"| node_deleteservice
node_deleteservice -->|"removes vectors"| node_qdrantwriter

click node_ui "https://github.com/ssp001/rag-6/blob/main/ui/app.py"
click node_api "https://github.com/ssp001/rag-6/blob/main/app/api/api.py"
click node_pdfservice "https://github.com/ssp001/rag-6/blob/main/app/service/pdf_loder_service.py"
click node_pdfreader "https://github.com/ssp001/rag-6/blob/main/app/src/pdf_loder.py"
click node_splitservice "https://github.com/ssp001/rag-6/blob/main/app/service/text_splitter_service.py"
click node_splitter "https://github.com/ssp001/rag-6/blob/main/app/src/text_splitter.py"
click node_embedservice "https://github.com/ssp001/rag-6/blob/main/app/service/vector_embedding_service.py"
click node_embedder "https://github.com/ssp001/rag-6/blob/main/app/src/vector_embedder.py"
click node_uploadservice "https://github.com/ssp001/rag-6/blob/main/app/service/qudrent_vector_upload_service.py"
click node_qdrantwriter "https://github.com/ssp001/rag-6/blob/main/app/src/qudrent_vector.py"
click node_searchservice "https://github.com/ssp001/rag-6/blob/main/app/service/vector_search_service.py"
click node_search "https://github.com/ssp001/rag-6/blob/main/app/src/vector_search.py"
click node_aiservice "https://github.com/ssp001/rag-6/blob/main/app/service/ai_respoes_service.py"
click node_aiclient "https://github.com/ssp001/rag-6/blob/main/app/src/ai_respones.py"
click node_deleteservice "https://github.com/ssp001/rag-6/blob/main/app/service/qudrent_vector_delete_service.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_ui,node_user toneBlue
class node_api,node_deleteservice,node_qdrant toneAmber
class node_pdfservice,node_pdfreader,node_splitservice,node_splitter,node_embedservice,node_embedder,node_uploadservice,node_qdrantwriter toneMint
class node_searchservice,node_search,node_aiservice,node_aiclient toneRose
class node_modelprovider toneIndigo
```

## Components

### User interface

- [Streamlit chat UI](https://github.com/ssp001/rag-6/blob/main/ui/app.py): `ui/app.py`

### API workflows

- [FastAPI endpoints](https://github.com/ssp001/rag-6/blob/main/app/api/api.py): `app/api/api.py`
- [Vector deletion](https://github.com/ssp001/rag-6/blob/main/app/service/qudrent_vector_delete_service.py): `app/service/qudrent_vector_delete_service.py`

### Document ingestion

- [PDF loading](https://github.com/ssp001/rag-6/blob/main/app/service/pdf_loder_service.py): `app/service/pdf_loder_service.py`
- [PDF reader](https://github.com/ssp001/rag-6/blob/main/app/src/pdf_loder.py): `app/src/pdf_loder.py`
- [Text chunking](https://github.com/ssp001/rag-6/blob/main/app/service/text_splitter_service.py): `app/service/text_splitter_service.py`
- [Text splitter](https://github.com/ssp001/rag-6/blob/main/app/src/text_splitter.py): `app/src/text_splitter.py`
- [Embedding service](https://github.com/ssp001/rag-6/blob/main/app/service/vector_embedding_service.py): `app/service/vector_embedding_service.py`
- [Vector embedder](https://github.com/ssp001/rag-6/blob/main/app/src/vector_embedder.py): `app/src/vector_embedder.py`
- [Vector upload](https://github.com/ssp001/rag-6/blob/main/app/service/qudrent_vector_upload_service.py): `app/service/qudrent_vector_upload_service.py`
- [Qdrant operations](https://github.com/ssp001/rag-6/blob/main/app/src/qudrent_vector.py): `app/src/qudrent_vector.py`

### Retrieval and generation

- [Vector search service](https://github.com/ssp001/rag-6/blob/main/app/service/vector_search_service.py): `app/service/vector_search_service.py`
- [Vector search](https://github.com/ssp001/rag-6/blob/main/app/src/vector_search.py): `app/src/vector_search.py`
- [AI response service](https://github.com/ssp001/rag-6/blob/main/app/service/ai_respoes_service.py): `app/service/ai_respoes_service.py`
- [Chat model client](https://github.com/ssp001/rag-6/blob/main/app/src/ai_respones.py): `app/src/ai_respones.py`

### Other components

- **User**
- **Qdrant store**
- **Chat model provider**

## Connections

- User → Streamlit chat UI: uses
- Streamlit chat UI → FastAPI endpoints: requests
- FastAPI endpoints → PDF loading: loads PDF
- PDF loading → PDF reader: reads PDF
- FastAPI endpoints → Text chunking: splits text
- Text chunking → Text splitter: chunks text
- FastAPI endpoints → Embedding service: creates embeddings
- Embedding service → Vector embedder: embeds chunks
- FastAPI endpoints → Vector upload: uploads vectors
- Vector upload → Qdrant operations: writes vectors
- Qdrant operations → Qdrant store: stores vectors
- FastAPI endpoints → Vector search service: searches context
- Vector search service → Vector search: runs search
- Vector search → Qdrant store: retrieves matches
- FastAPI endpoints → AI response service: streams answer
- AI response service → Chat model client: runs query
- Chat model client → Chat model provider: generates response
- FastAPI endpoints → Vector deletion: deletes session
- Vector deletion → Qdrant operations: removes vectors
