This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Quick start using the provided script
./run.sh
# Manual start (from backend directory)
cd backend && uv run uvicorn app:app --reload --port 8000# Install dependencies
uv sync
# Add new dependencies
uv add <package-name>Create .env file in root directory with:
ANTHROPIC_API_KEY=your_api_key_hereThis is a Retrieval-Augmented Generation (RAG) chatbot system that answers questions about course materials using semantic search and AI generation.
Backend Architecture (/backend/):
app.py- FastAPI server with CORS, serves frontend static files, provides/api/queryand/api/coursesendpointsrag_system.py- Main orchestrator that coordinates all componentsvector_store.py- ChromaDB wrapper for vector storage and semantic searchai_generator.py- Anthropic Claude API wrapper with tool supportdocument_processor.py- Processes course documents into chunkssearch_tools.py- Tool-based search system for Claude AIsession_manager.py- Manages conversation historymodels.py- Data models for Course, Lesson, CourseChunkconfig.py- Configuration settings loaded from environment
Frontend (/frontend/):
- Static HTML/CSS/JS files served by FastAPI
- Web interface for chatbot interactions
- Documents in
/docs/are processed into chunks and stored in ChromaDB - User queries hit
/api/queryendpoint - RAGSystem uses AI with search tools to find relevant content
- Claude generates responses using retrieved context
- Session manager maintains conversation history
- Uses ChromaDB for vector storage with
all-MiniLM-L6-v2embeddings - Anthropic Claude Sonnet 4 model with function calling for search tools
- Document chunking: 800 characters with 100 character overlap
- Supports PDF, DOCX, and TXT documents
- Session-based conversation history (max 2 exchanges)
- Tool-based search approach rather than direct RAG retrieval
Key settings in config.py:
CHUNK_SIZE: 800 (document chunk size)CHUNK_OVERLAP: 100 (overlap between chunks)MAX_RESULTS: 5 (search results returned)MAX_HISTORY: 2 (conversation exchanges remembered)CHROMA_PATH: "./chroma_db" (vector database location)