- Fix 71 invalid-syntax files (class-body newline-broken assignments) - Add from/None chain to 307 B904 raise-without-from sites - Add B008 ignore to ruff.toml (already in pyproject.toml) - Noqa F401 on __init__.py re-exports (137 sites) - Noqa E402 on deferred imports (63 sites) - Bulk-add stdlib/FastAPI/project imports for F821 (127 sites) - Replace ×→x, –→-, …→... in docstrings (4093 chars) - Manual refactor of 5 SIM103/SIM116 patterns Tests: 791 passed (66 deselected due to pre-existing Redis issues in test_rag.py) Co-authored-by: opencode <opencode@rugmunch.io>
16 lines
441 B
Python
16 lines
441 B
Python
"""
|
|
RAG Metrics API - expose observability data.
|
|
GET /api/v1/rag/metrics - embedding/retrieval latency, cache hit rate, errors.
|
|
"""
|
|
|
|
from fastapi import APIRouter, Request
|
|
|
|
from app.rag_observability import get_metrics
|
|
|
|
router = APIRouter(prefix="/api/v1/rag", tags=["rag-metrics"])
|
|
|
|
|
|
@router.get("/metrics")
|
|
async def rag_metrics(request: Request):
|
|
"""RAG system metrics - latency, cache, ingestion, errors."""
|
|
return get_metrics()
|