A Retrieval-Augmented Generation (RAG) system designed to answer questions about course materials using semantic search and AI-powered responses.
This application is a full-stack web application that enables users to query course materials and receive intelligent, context-aware responses. It uses ChromaDB for vector storage, Zhipu AI (GLM-4-Flash) for AI generation, and provides a web interface for interaction.
- Python 3.13 or higher
- uv (Python package manager)
- A Zhipu AI API key (for GLM-4-Flash model)
- 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 in the root directory:ZHIPU_API_KEY=your_zhipu_api_key_here
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
This project includes automated code quality tools:
# Format code
python scripts/format.py
# Run quality checks
python scripts/check_quality.py
# Or use the convenience scripts (Windows)
scripts\dev.bat format
scripts\dev.bat check
# Or use the convenience scripts (Linux/Mac)
bash scripts/dev.sh format
bash scripts/dev.sh checkTools included:
- Black: Code formatter (line length: 100 chars)
- isort: Import statement organizer
- Flake8: Code style checker
For detailed usage, see docs/CODE_QUALITY.md.
Run the test suite:
cd backend
uv run pytest -vInstall pre-commit hooks for automatic quality checks:
# Install pre-commit framework
pip install pre-commit
# Install hooks
pre-commit install
# Now hooks will run automatically on each commit