An advanced Retrieval-Augmented Generation (RAG) system with Graphiti knowledge graph integration, multimodal processing capabilities, and vector database support.
- Agentic RAG: Multi-step reasoning with LLM-powered agents
- Knowledge Graph Integration: Uses Graphiti for entity relationship mapping
- Multimodal Processing: Support for text and image embeddings
- Vector Database: Milvus for efficient similarity search
- Graph Database: Neo4j for complex relationship queries
- Caching: Redis for performance optimization
- Offline Mode: Pre-downloaded models for air-gapped environments
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ FastAPI App │ │ Milvus │ │ Neo4j │
│ (RAG Engine) │────│ (Vectors) │ │ (Knowledge) │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│ │
│ ┌─────────────────┐ │
└──────────────│ Redis │─────────────┘
│ (Cache) │
└─────────────────┘
- Kubernetes cluster (k3s/k8s)
- Container runtime (Docker/Podman)
- kubectl configured
-
Build the image:
cd rag ./scripts/build_and_push.sh -
Deploy to Kubernetes:
kubectl apply -f k8s/
-
Check deployment status:
kubectl get pods -n rag
| Variable | Description | Default |
|---|---|---|
EMBEDDING_MODEL |
Sentence transformer model | sentence-transformers/all-MiniLM-L6-v2 |
ENABLE_MULTIMODAL |
Enable image processing | false |
OPENAI_API_KEY |
OpenAI API key | - |
REDIS_HOST |
Redis hostname | redis-service |
NEO4J_URI |
Neo4j connection URI | bolt://neo4j:7687 |
MILVUS_HOST |
Milvus hostname | milvus-service |
Key Python packages:
graphiti-core==0.11.6- Knowledge graph processingsentence-transformers>=2.7.0- Text embeddingspymilvus==2.3.4- Vector database clientneo4j>=5.23.0- Graph database clientfastapi>=0.115.0- Web framework
POST /query- Process queries with agentic reasoningPOST /document- Add documents to the knowledge basePOST /upload-image- Upload and process images
GET /health- Health check endpointGET /ready- Readiness probeGET /metrics- Prometheus metrics
curl -X POST "http://localhost:8000/query" \
-H "Content-Type: application/json" \
-d '{
"query": "What are the key features of machine learning?",
"user_id": "user123"
}'curl -X POST "http://localhost:8000/document" \
-H "Content-Type: application/json" \
-d '{
"content": "Machine learning is a subset of artificial intelligence...",
"metadata": {"source": "ml_guide.pdf"}
}'-
Install dependencies:
pip install -r requirements.txt
-
Start services (Docker Compose):
docker-compose up -d
-
Run the application:
python app/main.py
The system supports multiple container runtimes:
# Using the build script (auto-detects runtime)
./scripts/build_and_push.sh
# Or manually with specific runtime
podman build -t rag-system .
docker build -t rag-system .-
Model Download Failures
- Ensure internet access during build
- Use offline mode for air-gapped environments
-
Database Connection Issues
- Check service DNS resolution
- Verify network policies
- Use IP addresses if DNS fails
-
Memory Issues
- Reduce model size or increase resource limits
- Monitor pod resource usage
# Check application logs
kubectl logs -f deployment/rag-system -n rag
# Check all pods in namespace
kubectl logs -f -l app=rag-system -n ragThe system uses Graphiti for building and querying knowledge graphs:
- Automatic entity extraction
- Relationship mapping
- Graph-based reasoning
Milvus provides efficient similarity search:
- Text embeddings (384-dimensional)
- Image embeddings (CLIP model)
- Cosine similarity search
Redis caching improves performance:
- Query result caching
- Model output caching
- Session management
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
MIT License - see LICENSE file for details.
For issues and questions:
- Create a GitHub issue
- Check the troubleshooting guide
- Review the logs for error details