How thrishok/rag-prod works
This is a FastAPI-based RAG question-answering service. A client submits a chat question; the API starts a LangGraph workflow that embeds the question, retrieves and reranks document chunks, generates a cited answer, and records run details. The repository also includes pgvector chunk storage and structured observability. The tree and excerpts show no document-ingestion endpoint or UI, so those capabilities are not mapped; some graph internals and API wiring are only partially excerpted, and uncertain links are omitted.
Main entry points: graph.py Workflow graph · chat.py Chat endpoint · vector_store.py Hybrid vector search · main.py FastAPI app
Components 12
Chat API
- FastAPI app
src/rag/main.py - Chat endpoint
src/rag/api/routes/chat.py
RAG Workflow
- Workflow graph
src/rag/core/graph.py - LLM generation
src/rag/core/llm.py
Retrieval Services
- Question embedding
src/rag/core/embeddings.py - Hybrid vector search
src/rag/core/vector_store.py - Reranking & fusion
src/rag/core/retrieval.py
Persistence & Observability
- RAG data models
src/rag/models/database.py - Structured logging
src/rag/observability/logging.py
Other components
- Chat client
- Groq API
- PostgreSQL / pgvector
Connections 13
- Chat client → FastAPI app: sends request
src/rag/main.py - FastAPI app → Chat endpoint: routes chat
src/rag/main.py - Chat endpoint → Workflow graph: builds and invokes
src/rag/api/routes/chat.py - Workflow graph → Question embedding: embeds question
- Workflow graph → Hybrid vector search: retrieves chunks
src/rag/core/graph.py - Workflow graph → Reranking & fusion: reranks chunks
src/rag/core/graph.py - Workflow graph → LLM generation: generates answer
- LLM generation → Groq API: calls model
src/rag/core/llm.py - Hybrid vector search → PostgreSQL / pgvector: queries and writes
- Hybrid vector search → RAG data models: uses chunk models
- Workflow graph → RAG data models: records run events
src/rag/core/graph.py - Chat endpoint → Structured logging: logs chat turn
src/rag/api/routes/chat.py - Chat endpoint → Chat client: returns answer
src/rag/api/routes/chat.py