LightRAG/lightrag/api/routers
anouarbm 0bbef9814e Optimize RAGAS evaluation with parallel execution and chunk content enrichment
Added efficient RAG evaluation system with optimized API calls and comprehensive benchmarking.

Key Features:
- Single API call per evaluation (2x faster than before)
- Parallel evaluation based on MAX_ASYNC environment variable
- Chunk content enrichment in /query endpoint responses
- Comprehensive benchmark statistics (moyennes)
- NaN-safe metric calculations

API Changes:
- Added include_chunk_content parameter to QueryRequest (backward compatible)
- /query endpoint enriches references with actual chunk content when requested
- No breaking changes - default behavior unchanged

Evaluation Improvements:
- Parallel execution using asyncio.Semaphore (respects MAX_ASYNC)
- Shared HTTP client with connection pooling
- Proper timeout handling (3min connect, 5min read)
- Debug output for context retrieval verification
- Benchmark statistics with averages, min/max scores

Results:
- Moyenne RAGAS Score: 0.9772
- Perfect Faithfulness: 1.0000
- Perfect Context Recall: 1.0000
- Perfect Context Precision: 1.0000
- Excellent Answer Relevance: 0.9087
2025-11-02 17:39:43 +01:00
..
__init__.py
document_routes.py Add PDF decryption support for password-protected files 2025-11-01 15:01:17 +08:00
graph_routes.py feat: Improve entity merge and edit UX 2025-10-27 23:42:08 +08:00
ollama_api.py fix(OllamaAPI): Add validation to ensure last message is from user role 2025-10-01 20:48:37 +08:00
query_routes.py Optimize RAGAS evaluation with parallel execution and chunk content enrichment 2025-11-02 17:39:43 +01:00