How ammaryaqoob/document-assistant-rag-pipeline works
This is a FastAPI document-assistant with two user-facing paths: chat requests are routed to a chat service, while RAG requests ingest a text document, retrieve relevant chunks, and generate an answer from that context. The RAG implementation separates document reading/chunking, embeddings, and vector storage; both chat and RAG use an OpenAI-compatible local model service. The graph follows relationships visible in the excerpts and README; the test route and configuration are not expanded because their behavior is not shown.
Main entry points: services/rag.py RAG service · main.py FastAPI app · chat.py Chat route · routers/rag.py RAG routes
Components 13
API
- FastAPI app
app/main.py - Chat route
app/routers/chat.py - RAG routes
app/routers/rag.py - Test route
app/routers/test.py
Chat
- Chat service
app/services/chat.py - Chat schemas
app/interface/chat.py
Document RAG
- RAG service
app/services/rag.py - Document reader
app/readhandler/textreader.py - Sample document
app/files/test.txt
Model and storage
- Embedding client
app/embeddings/embedding.py - Chroma collection
app/database/chromedb.py - Local model API
Other components
- API user
Connections 15
- API user → FastAPI app: sends requests
- FastAPI app → Chat route: registers
app/main.py - FastAPI app → RAG routes: registers
app/main.py - FastAPI app → Test route: registers
app/main.py - Chat route → Chat schemas: validates with
app/routers/chat.py - Chat route → Chat service: calls
app/routers/chat.py - Chat service → Chat schemas: uses
app/services/chat.py - Chat service → Local model API: requests completions
app/services/chat.py - RAG routes → RAG service: calls
app/routers/rag.py - RAG routes → Sample document: ingests
app/routers/rag.py - RAG service → Document reader: chunks documents
app/services/rag.py - RAG service → Embedding client: embeds text
app/services/rag.py - RAG service → Chroma collection: queries and upserts
app/services/rag.py - RAG service → Local model API: requests completions
app/services/rag.py - Embedding client → Local model API: requests embeddings
app/embeddings/embedding.py