System requirements
Before installing, verify your environment meets these requirements:- Python 3.12+ (Python 3.11+ may work but 3.12+ is recommended)
- uv package manager (recommended) or pip
- Git for cloning the repository
- Docker & Docker Compose (optional, for containerized deployment)
Verify Python version
Install uv package manager
We recommend using uv for dependency management. It’s significantly faster than pip and handles lock files automatically.Clone the repository
Set up virtual environment
Create and activate a Python virtual environment:(.venv) prefix, indicating the virtual environment is active.
Install dependencies
With your virtual environment activated, install all required packages:pyproject.toml and installs:
- FastAPI (0.128.0+) — Web framework
- LangChain (1.2.7+) — LLM orchestration
- LangChain integrations — OpenAI, Chroma, Unstructured
- ChromaDB (1.4.1+) — Vector database
- OpenAI (2.16.0+) — Embeddings and LLM client
- scikit-learn (1.8.0+) — ML models
- pandas (3.0.0+) — Data processing
- pytest (9.0.2+) — Testing framework
- Development tools — black, flake8, mypy, isort
uv sync creates a lock file for reproducible installs. Use uv sync --locked in CI/CD to ensure exact versions.Dependencies reference
Here’s the complete dependency list frompyproject.toml:
pyproject.toml
Configure environment variables
The RAG Support System requires API keys for OpenAI and Unstructured services.Create .env file
Create a.env file in the project root:
.env
Get API keys
OpenAI API key
- Sign up at platform.openai.com
- Navigate to API keys section
- Create a new secret key
- Copy and paste into
.envasOPENAI_API_KEY
The system uses:
text-embedding-3-smallfor embeddings (~$0.02 per 1M tokens)gpt-4.1for generation (configured insrc/rag/retriever.py:35)
Unstructured API key
- Sign up at unstructured.io
- Get your API key from the dashboard
- Add to
.envasUNSTRUCTURED_API_KEY
Unstructured parses markdown files into structured elements during document ingestion. Used in
src.rag.ingest module.Environment variable loading
The system loads environment variables usingpython-dotenv. Here’s how it works (from src/config.py):
config.py
Verify installation
Run the test suite to verify everything is installed correctly:Tests mock external services (OpenAI, Chroma, Unstructured) so they run offline without API keys.
Run specific tests
Optional: Train ML models
The system includes triage ML models for category and priority prediction. Train them before making RAG queries:- Reads training data from
tickets_train.csv - Trains TF-IDF + Logistic Regression classifiers
- Saves models to
artifacts/category_model.pklandartifacts/priority_model.pkl - Generates classification reports in
reports/
Models are loaded automatically by the API at startup (see
src/api/routes/triage_route.py:12-20).Optional: Docker setup
For containerized deployment, use Docker Compose:- FastAPI application container
- Chroma vector database (if configured in
docker-compose.yml) - Volume mounts for persistent data
Docker configuration is in
Dockerfile and docker-compose.yml at project root.Directory structure
After installation, your project should look like this:Next steps
Follow the quickstart
Ingest documents and make your first RAG query
Understand the architecture
Learn how system components work together
Explore API endpoints
Read endpoint specifications and examples
Run evaluations
Test answer quality with offline metrics:
Troubleshooting
pip install errors
pip install errors
If you encounter build errors, upgrade pip and setuptools:Then retry
uv sync.Python version conflicts
Python version conflicts
Check your Python version matches requirements:If using pyenv or conda, ensure you’ve selected Python 3.12+:
ModuleNotFoundError
ModuleNotFoundError
Ensure your virtual environment is activated:Verify packages are installed:
OpenAI rate limits
OpenAI rate limits
If you hit rate limits during testing:
- Use a lower tier of OpenAI API key
- Implement exponential backoff (already handled by LangChain)
- Add
time.sleep()between batch operations - Consider caching embeddings
Chroma database locked errors
Chroma database locked errors
If Chroma throws “database is locked” errors: