- Add ConfidenceCalculator class for confidence scoring - Implement retrieval insufficiency detection (hit count, score threshold, evidence tokens) - Implement confidence calculation based on retrieval scores - Implement shouldTransfer logic with configurable threshold - Add transferReason for low confidence scenarios - Add comprehensive unit tests (19 test cases) - Update config with confidence-related settings |
||
|---|---|---|
| .. | ||
| app | ||
| tests | ||
| README.md | ||
| pyproject.toml | ||
README.md
AI Service
Python AI Service for intelligent chat with RAG support.
Features
- Multi-tenant isolation via X-Tenant-Id header
- SSE streaming support via Accept: text/event-stream
- RAG-powered responses with confidence scoring
Installation
pip install -e ".[dev]"
Running
uvicorn app.main:app --host 0.0.0.0 --port 8080
API Endpoints
POST /ai/chat- Generate AI replyGET /ai/health- Health check