This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Install dependencies
uv sync
# Start the server (from project root)
cd backend && uv run uvicorn app:app --reload --port 8000
# Or use the shell script
./run.shRequires Ollama running locally with a model installed (configured in .env).
The app is served at http://localhost:8000 with API docs at http://localhost:8000/docs.
- Python 3.13+ with
uvpackage manager - Always use
uvto run commands and manage dependencies. Never usepipdirectly. .envfile in project root withOLLAMA_BASE_URLandOLLAMA_MODEL- No test suite exists currently
This is a RAG (Retrieval-Augmented Generation) chatbot for course materials. FastAPI backend serves both the API and the frontend static files.
Query flow: Frontend → app.py (FastAPI) → rag_system.py (orchestrator) → searches vector_store.py (ChromaDB) → sends query + retrieved chunks to ai_generator.py (Ollama LLM) → response back to frontend.
Key design decisions:
- Search-first approach: every query searches ChromaDB before calling the LLM (no tool calling — small local models can't handle it reliably)
- Two ChromaDB collections:
course_catalog(metadata for fuzzy course name matching) andcourse_content(chunked text for semantic search) - Embeddings via
all-MiniLM-L6-v2sentence-transformer - Session history is in-memory only (lost on restart), capped at 2 exchanges per session
- Documents are chunked at 800 chars with 100 char overlap
- Course documents in
docs/are auto-loaded on server startup
Backend modules:
app.py— API endpoints and static file servingrag_system.py— orchestrates search → LLM → session flowvector_store.py— ChromaDB wrapper with semantic search and course/lesson filteringai_generator.py— Ollama API clientdocument_processor.py— parses course .txt/.pdf/.docx files into structured chunkssearch_tools.py— search tool abstraction with source trackingsession_manager.py— per-session conversation memorymodels.py—Course,Lesson,CourseChunkdataclassesconfig.py— loads settings from.env
Frontend: plain HTML/JS/CSS in frontend/, uses marked.js for markdown rendering. No build step.