This is a Retrieval-Augmented Generation (RAG) system for querying course materials using semantic search and AI-powered responses. The application uses ChromaDB for vector storage, Anthropic's Claude for AI generation, and provides a web interface for interaction.
Note: This repository is forked from https-deeplearning-ai/starting-ragchatbot-codebase. I'm using this repository as a sandbox for experimenting with Claude Code.
- Python 3.13 or higher
- uv (Python package manager)
- An Anthropic API key (for Claude AI)
- For Windows: Use Git Bash to run the application commands - Download Git for Windows
-
Install uv (if not already installed)
curl -LsSf https://astral.sh/uv/install.sh | sh -
Install Python dependencies
uv sync
-
Set up environment variables
Create a
.envfile with your Anthropic API key:# Copy the template file cp .env.example .env # Edit .env and add your API key # Get your key from: https://console.anthropic.com/
Your
.envfile should look like:ANTHROPIC_API_KEY=sk-ant-your-actual-key-hereImportant:
- The
.envfile is gitignored and will NOT be committed - Never commit your API key to version control
- If you see "query failed" errors, check that your API key is set correctly
- The
Use the provided shell script:
chmod +x run.sh
./run.shcd backend
uv run uvicorn app:app --reload --port 8000The application will be available at:
- Web Interface:
http://localhost:8000 - API Documentation:
http://localhost:8000/docs
If you see "query failed" when asking questions:
-
Check your API key is set
# In project root, verify .env file exists ls -la .env # Check if key is configured (won't show the actual key) grep ANTHROPIC_API_KEY .env
-
Verify the key format
- Should start with
sk-ant- - No quotes around the value
- No spaces before or after the
=
- Should start with
-
Restart the application
- Stop the server (Ctrl+C)
- Start it again - you should see a warning if the key is missing
-
Check startup logs
- Look for warnings about API key configuration
- The application will display clear messages if the key is missing or invalid
Run the comprehensive test suite:
cd backend
uv run pytest tests/ -vThis project includes automated code quality tools to maintain consistent code formatting and catch common issues.
- Format code:
./format.sh- Automatically formats all Python code - Check code style:
./lint.sh- Checks formatting without making changes - Run all quality checks:
./quality-check.sh- Comprehensive check (formatting, linting, type checking, tests)
Before committing code, run:
./quality-check.shThis will:
- Check code formatting (Black)
- Verify import organization (isort)
- Run linting checks (flake8)
- Perform type checking (mypy)
- Run the test suite
If formatting issues are found, fix them with:
./format.sh- Black: Automatic code formatter (88 character line length)
- isort: Organizes imports alphabetically and by type
- flake8: Linting for style and common errors
- mypy: Static type checking
- pytest: Testing framework
Quality tool settings are defined in:
pyproject.toml- Black, isort, and mypy configuration.flake8- flake8 configuration