From 017c6a96b91b44a52b5ad5eca7d702d6797fdf3a Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 22 Apr 2026 20:45:33 -0700 Subject: [PATCH] fix(proxy/utils): fire-and-forget eval spend-log patch to remove 500ms sleep from response path --- litellm/proxy/utils.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/litellm/proxy/utils.py b/litellm/proxy/utils.py index 76220ed3c67..c3ac355c42c 100644 --- a/litellm/proxy/utils.py +++ b/litellm/proxy/utils.py @@ -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(