mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
fix - backend return exceptions
This commit is contained in:
parent
49f83ce204
commit
26a5d85869
1 changed files with 19 additions and 1 deletions
|
@ -7624,10 +7624,28 @@ async def model_metrics_exceptions(
|
||||||
WHERE "startTime" >= $1::timestamp AND "endTime" <= $2::timestamp
|
WHERE "startTime" >= $1::timestamp AND "endTime" <= $2::timestamp
|
||||||
GROUP BY model_group, api_base, exception_type
|
GROUP BY model_group, api_base, exception_type
|
||||||
ORDER BY num_exceptions DESC
|
ORDER BY num_exceptions DESC
|
||||||
LIMIT 50;
|
LIMIT 200;
|
||||||
"""
|
"""
|
||||||
db_response = await prisma_client.db.query_raw(sql_query, startTime, endTime)
|
db_response = await prisma_client.db.query_raw(sql_query, startTime, endTime)
|
||||||
response: List[dict] = []
|
response: List[dict] = []
|
||||||
|
for model_data in db_response:
|
||||||
|
model = model_data.get("model_group", "")
|
||||||
|
api_base = model_data.get("api_base", "")
|
||||||
|
exception_type = model_data.get("exception_type", "")
|
||||||
|
num_exceptions = model_data.get("num_exceptions", 0)
|
||||||
|
|
||||||
|
response.append(
|
||||||
|
{
|
||||||
|
"model_group": model + "-" + api_base,
|
||||||
|
"exception_type": exception_type,
|
||||||
|
"num_exceptions": num_exceptions,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# sort all entries in descending order based on num_exceptions
|
||||||
|
|
||||||
|
response.sort(key=lambda x: x["num_exceptions"], reverse=True)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue