How jashwanthreddi/ca-mentor-ai works
CA Mentor AI is a study-question chat application backed by retrieval-augmented generation. The user-facing path runs from the chat UI through the API and chat service, which retrieves and reranks study chunks before generating an answer. A separate document-ingestion path turns PDFs into indexed chunks; retrieval/evaluation capabilities are represented where the source index documents them. Some stages and integrations are unsampled, so their links are omitted or marked unverified.
Main entry points: chat_service.py Chat orchestration · pipeline.py Ingestion orchestration · run_retrieval_evaluation.py Retrieval evaluation · App.jsx Chat interface
Components 30
Chat client
- Chat interface
frontend/src/App.jsx - Question input
frontend/src/components/ChatInput.jsx - Message display
frontend/src/components/Message.jsx - Welcome prompts
frontend/src/components/Welcome.jsx - API client
frontend/src/services/api.js
Application API
- Chat endpoint
backend/app/api/v1/endpoints/chat.py - Chat schemas
backend/app/schemas/chat.py - Chat orchestration
backend/app/services/chat_service.py - Application setup
backend/app/main.py
Knowledge retrieval
- BM25 corpus loader
backend/app/rag/bm25_corpus.py - Lexical retrieval
backend/app/rag/bm25_retriever.py - Dense retrieval
backend/app/rag/dense_retriever.py - Hybrid fusion
backend/app/rag/hybrid_retriever.py - Evidence reranking
backend/app/rag/reranker.py - Answer generation
backend/app/rag/generator.py - Qdrant index
Document ingestion
- Ingestion orchestration
backend/app/ingestion/pipeline.py - PDF extraction
backend/app/ingestion/extractor.py - Raw document model
backend/app/ingestion/raw_document.py - Content classification
backend/app/ingestion/classifier.py - Knowledge-unit parsing
backend/app/ingestion/parser.py - Ingestion domain models
backend/app/ingestion/models.py - Semantic chunking
backend/app/ingestion/chunker.py - Text embedding
backend/app/ingestion/embedder.py - Validation and upload
backend/app/ingestion
Evaluation
- Retrieval evaluation
backend/app/rag/run_retrieval_evaluation.py - Evaluation datasets
backend/app/rag/evaluation_dataset.py - Generation evaluation
backend/app/evaluation/generation/runner.py
Other components
- Student
- Study PDF
Connections 37
- Student → Chat interface: asks question
frontend/src/App.jsx - Chat interface → Question input: renders
frontend/src/App.jsx - Chat interface → Welcome prompts: renders
frontend/src/App.jsx - Chat interface → Message display: renders
frontend/src/App.jsx - Chat interface → API client: sends question
frontend/src/App.jsx - API client → Chat endpoint: HTTP request
- Application setup → Chat endpoint: mounts routes
backend/app/main.py - Chat endpoint → Chat orchestration: calls
backend/app/api/v1/endpoints/chat.py - Chat endpoint → Chat schemas: uses schemas
backend/app/api/v1/endpoints/chat.py - Chat orchestration → BM25 corpus loader: loads corpus
backend/app/services/chat_service.py - Chat orchestration → Lexical retrieval: initializes
backend/app/services/chat_service.py - Chat orchestration → Dense retrieval: initializes
backend/app/services/chat_service.py - Chat orchestration → Hybrid fusion: initializes
backend/app/services/chat_service.py - Chat orchestration → Hybrid fusion: retrieves candidates
backend/app/services/chat_service.py - Hybrid fusion → Dense retrieval: retrieves densely
backend/app/rag/hybrid_retriever.py - Hybrid fusion → Lexical retrieval: retrieves lexically
backend/app/rag/hybrid_retriever.py - Chat orchestration → Evidence reranking: reranks candidates
backend/app/services/chat_service.py - Chat orchestration → Answer generation: generates answer
backend/app/services/chat_service.py - Dense retrieval → Qdrant index: searches index
backend/app/rag/dense_retriever.py - BM25 corpus loader → Qdrant index: loads chunks
- Study PDF → Ingestion orchestration: provides PDF
- Ingestion orchestration → PDF extraction: extracts pages
backend/app/ingestion/pipeline.py - PDF extraction → Raw document model: produces
backend/app/ingestion/extractor.py - Ingestion orchestration → Content classification: classifies document
backend/app/ingestion/pipeline.py - Content classification → Raw document model: reads blocks
backend/app/ingestion/classifier.py - Ingestion orchestration → Knowledge-unit parsing: parses elements
backend/app/ingestion/pipeline.py - Ingestion orchestration → Semantic chunking: chunks units
backend/app/ingestion/pipeline.py - Ingestion orchestration → Validation and upload: validates and uploads
backend/app/ingestion/pipeline.py - Ingestion orchestration → Text embedding: embeds chunks
backend/app/ingestion/pipeline.py - Ingestion orchestration → Ingestion domain models: uses domain types
backend/app/ingestion/pipeline.py - Retrieval evaluation → Dense retrieval: evaluates retrieval
backend/app/rag/run_retrieval_evaluation.py - Retrieval evaluation → BM25 corpus loader: builds corpus
backend/app/rag/run_retrieval_evaluation.py - Retrieval evaluation → Lexical retrieval: evaluates retrieval
backend/app/rag/run_retrieval_evaluation.py - Retrieval evaluation → Hybrid fusion: evaluates fusion
backend/app/rag/run_retrieval_evaluation.py - Retrieval evaluation → Evidence reranking: evaluates ranking
backend/app/rag/run_retrieval_evaluation.py - Retrieval evaluation → Evaluation datasets: loads questions
backend/app/rag/run_retrieval_evaluation.py - Generation evaluation → Answer generation: evaluates generation