mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-24 00:52:24 +00:00
fix(proxy/utils): fire-and-forget eval spend-log patch to remove 500ms sleep from response path
This commit is contained in:
parent
4fa4cd8a08
commit
017c6a96b9
1 changed files with 11 additions and 5 deletions
|
|
@ -2159,7 +2159,9 @@ class ProxyLogging:
|
|||
# so we update the row directly to make eval_information visible in Logs UI.
|
||||
# For A2A calls, the spend log request_id is the JSON-RPC id (data["id"]),
|
||||
# not the litellm_call_id UUID generated by common_request_processing.
|
||||
_eval_info = (data.get("metadata") or {}).get("eval_information")
|
||||
_eval_info = (data.get("metadata") or {}).get(
|
||||
"eval_information"
|
||||
)
|
||||
# For regular completions the spend log uses response.id (chatcmpl-XXX).
|
||||
# For A2A calls it uses the JSON-RPC id stored in data["id"].
|
||||
_request_id = (
|
||||
|
|
@ -2168,8 +2170,10 @@ class ProxyLogging:
|
|||
or data.get("litellm_call_id")
|
||||
)
|
||||
if _eval_info and _request_id:
|
||||
await _patch_eval_spend_log(
|
||||
_prisma_client, _request_id, _eval_info
|
||||
asyncio.create_task(
|
||||
_patch_eval_spend_log(
|
||||
_prisma_client, _request_id, _eval_info
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
from fastapi import HTTPException
|
||||
|
|
@ -2183,8 +2187,10 @@ class ProxyLogging:
|
|||
or data.get("litellm_call_id")
|
||||
)
|
||||
if _eval_info and _request_id and _prisma_client is not None:
|
||||
await _patch_eval_spend_log(
|
||||
_prisma_client, _request_id, _eval_info
|
||||
asyncio.create_task(
|
||||
_patch_eval_spend_log(
|
||||
_prisma_client, _request_id, _eval_info
|
||||
)
|
||||
)
|
||||
raise
|
||||
verbose_proxy_logger.warning(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue