This guide explains how to run and test the RAG pipeline project step by step.
- Python 3.10 or higher
- Docker and Docker Compose
- kubectl (for Kubernetes deployment)
- GitHub CLI (optional, for model version management)
- Clone the repository:
git clone https://github.com/yourusername/igenius-rag.git
cd igenius-rag- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: .\venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration:
# - GROQ_API_KEY: Your Groq API key
# - GROQ_MODEL: Model name (e.g., mixtral-8x7b-32768)
# - VECTORDB_PATH: Path for vector database storage- Start the development server:
uvicorn app.main:app --reload --port 8000- Visit the API documentation:
http://localhost:8000/docs
- Build and run with Docker:
# Build the image
docker build -t rag-api .
# Run the container
docker run -p 8000:8000 --env-file .env rag-api- Install test dependencies:
pip install pytest pytest-cov- Run unit tests with coverage:
# Run all tests
pytest
# Run with coverage report
pytest --cov=app --cov-report=term-missing- Run load tests:
# Run with default parameters
python tests/load_test.py
# Run with custom parameters
python tests/load_test.py --requests 1000 --concurrent 20 --url http://localhost:8000- Apply Kubernetes configurations:
# Apply base deployment
kubectl apply -f k8s/deployment.yaml
# Apply monitoring stack
kubectl apply -f k8s/monitoring/
# Apply KEDA scaler
kubectl apply -f k8s/keda-scaler.yaml- Verify deployment:
kubectl get pods -l app=rag-api
kubectl get services -l app=rag-api- Access monitoring:
# Port forward Grafana
kubectl port-forward svc/grafana 3000:3000
# Visit Grafana dashboard
http://localhost:3000- Check current model version:
cat models/VERSION- Download specific model version:
gh release download model-v1.0.0-
API Connection Issues:
- Check GROQ_API_KEY in .env
- Verify network connectivity
-
Vector Database Issues:
- Ensure VECTORDB_PATH is writable
- Check disk space
-
Test Failures:
- Verify Python version (3.10+)
- Check all dependencies are installed
- Ensure .env is properly configured
- View application logs:
# Local
tail -f logs/app.log
# Kubernetes
kubectl logs -f deployment/rag-api- View monitoring metrics:
# Prometheus metrics
curl http://localhost:8000/metricsThe project includes GitHub Actions workflows for:
- Automated testing
- Docker image building
- Kubernetes deployment
- Model versioning
To use them:
- Fork the repository
- Add required secrets:
KUBE_CONFIG: Kubernetes configurationGROQ_API_KEY: Groq API key
- Push to main branch or create a PR
The pipelines will automatically run tests, build images, and deploy to your cluster.