How chinmaye5/ragent works
Theragent is a document-grounded chat application. Users register or log in, upload documents, and ask questions about them in chats; the backend ingests documents and runs a retrieval-and-answer graph. The frontend exposes home, account, dashboard, and chat screens. The graph shows explicit query-graph transitions and documented imports, while unshown route internals and external-service calls are left unconnected or marked unverified. The README is empty, so capability coverage is based on the supplied source index and excerpts.
Main entry points: retrieve.py Chunk retrieval · ingestion_graph.py Ingestion graph · query_graph.py Query graph · documents.py Document routes
Components 30
Web app
- App routing
frontend/src/App.jsx - Home and accounts
frontend/src/pages/Home.jsx - Chat experience
frontend/src/pages/ChatPage.jsx - Chat components
frontend/src/components/ChatMessages.jsx - Dashboard
frontend/src/pages/Dashboard.jsx - API client
frontend/src/api.js
API and accounts
- FastAPI app
backend/app/main.py - Authentication
backend/app/api/routes/auth.py - Chat routes
backend/app/api/routes/chats.py - Document routes
backend/app/api/routes/documents.py
Document ingestion
- Ingestion graph
backend/app/agents/ingestion_graph.py - Document classification
backend/app/agents/nodes/ingestion/classify.py - Document chunking
backend/app/agents/nodes/ingestion/chunk.py - Chunk enrichment
backend/app/agents/nodes/ingestion/enrich.py - Ingestion review
backend/app/agents/nodes/ingestion/critic.py - Chunk persistence
backend/app/agents/nodes/ingestion/persist.py
Question answering
- Query graph
backend/app/agents/query_graph.py - Query routing
backend/app/agents/nodes/query/router.py - Chunk retrieval
backend/app/agents/nodes/query/retrieve.py - Answer generation
backend/app/agents/nodes/query/answer.py - Answer verification
backend/app/agents/nodes/query/verify.py - Query state and LLM
backend/app/agents/nodes/query/state.py
Shared services
- Relational and vector DB
backend/app/models/models.py - Database connections
backend/app/core/database.py - Document and model clients
backend/app/services/document_service.py - LLM gateway
backend/app/core/gateway.py - Query guardrails
backend/app/core/guardrails.py
Other components
- User
- Jina embeddings API
- Groq model API
Connections 43
- User → App routing: uses
frontend/src/App.jsx - App routing → Home and accounts: routes to
frontend/src/App.jsx - App routing → Chat experience: routes to
frontend/src/App.jsx - App routing → Dashboard: routes to
frontend/src/App.jsx - Chat experience → Chat components: renders
frontend/src/pages/ChatPage.jsx - Chat experience → API client: calls
frontend/src/pages/ChatPage.jsx - Home and accounts → API client: calls
frontend/src/pages/Home.jsx - Dashboard → API client: calls
frontend/src/pages/Dashboard.jsx - API client → FastAPI app: sends requests
- FastAPI app → Authentication: registers
backend/app/main.py - FastAPI app → Chat routes: registers
backend/app/main.py - FastAPI app → Document routes: registers
backend/app/main.py - Authentication → Database connections: gets sessions
backend/app/api/routes/auth.py - Authentication → Relational and vector DB: queries users
backend/app/api/routes/auth.py - Chat routes → Query graph: invokes
backend/app/api/routes/chats.py - Chat routes → Database connections: uses
backend/app/api/routes/chats.py - Chat routes → Relational and vector DB: stores chat data
backend/app/api/routes/chats.py - Document routes → Ingestion graph: invokes
backend/app/api/routes/documents.py - Document routes → Query graph: invokes
backend/app/api/routes/documents.py - Document routes → Relational and vector DB: uses
backend/app/api/routes/documents.py - Document routes → Document and model clients: uses
backend/app/api/routes/documents.py - Ingestion graph → Document classification: dispatches
- Ingestion graph → Document chunking: dispatches
- Ingestion graph → Chunk enrichment: dispatches
- Ingestion graph → Ingestion review: dispatches
- Ingestion graph → Chunk persistence: dispatches
- Document classification → Document and model clients: uses
backend/app/agents/nodes/ingestion/classify.py - Query graph → Query routing: dispatches
backend/app/agents/query_graph.py - Query graph → Chunk retrieval: dispatches
backend/app/agents/query_graph.py - Query graph → Answer generation: dispatches
backend/app/agents/query_graph.py - Query graph → Answer verification: dispatches
backend/app/agents/query_graph.py - Query routing → Chunk retrieval: routes RAG
- Chunk retrieval → Answer generation: passes chunks
- Answer generation → Answer verification: passes answer
- Answer verification → Chunk retrieval: retries
- Chunk retrieval → Database connections: queries through
backend/app/agents/nodes/query/retrieve.py - Chunk retrieval → Relational and vector DB: searches chunks
backend/app/agents/nodes/query/retrieve.py - Chunk retrieval → Document and model clients: embeds queries
backend/app/agents/nodes/query/retrieve.py - Query state and LLM → Document and model clients: gets LLM client
backend/app/agents/nodes/query/state.py - Query state and LLM → LLM gateway: calls LLM gateway
backend/app/agents/nodes/query/state.py - Query routing → Query guardrails: uses
backend/app/agents/nodes/query/router.py - Document and model clients → Jina embeddings API: requests embeddings
backend/app/services/document_service.py - LLM gateway → Groq model API: routes model calls