How ulugbek-lab/claritylm-rag works
ClarityLM RAG is a single-user document-question-answering application. A user uploads a PDF, TXT, or Markdown file through the React workspace; FastAPI delegates extraction, chunking, embedding, and indexing to the RAG backend. For questions, the backend optionally retrieves and filters Qdrant excerpts, builds a bounded context, and invokes the local TinyLlama/LoRA model; the API returns an answer and formatted sources to the UI. The README documents optional, disabled-by-default filesystem ingestion. Edges reflect shown calls or README-documented behavior; unsampled frontend client and model wiring is not inferred beyond documented API use.
Main entry points: main.py FastAPI application · routes.py API routes · rag_service.py RAG orchestration · qdrant_service.py Vector store adapter
Components 13
Chat workspace
- Chat workspace
frontend/src/App.tsx - API client
frontend/src/api.ts
HTTP interface
- FastAPI application
app/main.py - API routes
app/api/routes.py - Request schemas
app/dto/Rag.py - Source formatting
utils/source_formatting.py
RAG processing
- RAG orchestration
app/services/rag_service.py
Runtime services
- Embedding model
app/services/embeddings_service.py - Vector store adapter
app/services/qdrant_service.py - Qdrant collection
- Local language model
app/services/llm_service.py - Runtime settings
app/core/config.py
Other components
- User
Connections 18
- User → Chat workspace: uses
README.md - Chat workspace → API client: calls
frontend/src/App.tsx - API client → API routes: requests
README.md - API routes → Chat workspace: returns answers
- FastAPI application → API routes: registers
app/main.py - FastAPI application → Runtime settings: loads
app/main.py - FastAPI application → Embedding model: constructs
app/main.py - FastAPI application → Vector store adapter: constructs
app/main.py - FastAPI application → Local language model: constructs
app/main.py - FastAPI application → RAG orchestration: constructs
app/main.py - API routes → Request schemas: validates and responds
app/api/routes.py - API routes → RAG orchestration: delegates
app/api/routes.py - API routes → Source formatting: formats sources
app/api/routes.py - RAG orchestration → Embedding model: embeds text
app/services/rag_service.py - RAG orchestration → Vector store adapter: indexes and searches
app/services/rag_service.py - RAG orchestration → Local language model: generates answer
app/services/rag_service.py - Vector store adapter → Embedding model: vectorizes documents
app/services/qdrant_service.py - Vector store adapter → Qdrant collection: reads and writes
README.md