FastAPI-RAG-API / app /routes_stats.py
HamidOmarov's picture
Add in-memory metrics + /stats, /get_history and include router
089198a
raw
history blame
311 Bytes
from fastapi import APIRouter
from .metrics import tracker
router = APIRouter()
@router.get("/stats")
def get_stats():
return tracker.get_stats()
@router.get("/get_history")
def get_history():
s = tracker.get_stats()
return {"history": s["lastN_questions"], "total_chunks": s["total_chunks"]}