CausewayAI is a backend system designed for causal analysis and retrieval-augmented generation (RAG) using FastAPI, Qdrant, and NetworkX. It leverages Google's Gemini models and embeddinggemma for advanced query understanding and response generation.
- Graph Strategy: Uses a knowledge graph to traverse causal logic and retrieve relevant calls.
- Filter Strategy: Uses metadata filtering to find relevant conversations based on domain, topic, and outcome.
- Streaming Responses: Returns Server-Sent Events (SSE) for real-time interaction.
- Python 3.10+
- Docker & Docker Compose (optional but recommended)
- Google API Key (for Gemini)
- Hugging Face Token (for
embeddinggemma)
Create a .env file in the root directory:
GOOGLE_API_KEY=your_google_api_key
HF_TOKEN=your_hugging_face_token- Install dependencies:
pip install -r requirements.txt
- Run the server:
The API will be available at
uvicorn main:app --reload
http://localhost:8000.
- Build and run the container:
The API will be available at
docker-compose up --build
http://localhost:8000.
- GET /health: Health check.
- POST /chat: Main chat endpoint.
- Payload:
{ "query": "Why are customers churning?", "history": [], "model_type": "graph" // or "filter" } - Response: Streaming SSE events (
status,concepts,sources,token,error).
- Payload:
Use the provided client script to test the engine:
python client_test.py "Why are customers churning?" --model graph