Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
This commit is contained in:
B-Step62 2025-03-20 02:06:34 +09:00
parent 53443a8d5a
commit 57f1d436e1
4 changed files with 5 additions and 24 deletions

View file

@ -2264,14 +2264,7 @@ class Logging(LiteLLMLoggingBaseClass):
if self._should_run_sync_callbacks_for_async_calls() is False:
return
executor.submit(
self.success_handler,
result,
start_time,
end_time,
# NB: Since we already run this in a TPE, the handler itself can run sync
synchronous=True,
)
self.success_handler(result, start_time, end_time)
def _should_run_sync_callbacks_for_async_calls(self) -> bool:
"""

View file

@ -1810,15 +1810,10 @@ class CustomStreamWrapper:
)
if litellm.sync_logging:
await self.logging_obj.async_success_handler(**logging_params)
self.logging_obj.success_handler(**logging_params, synchronous=True)
else:
asyncio.create_task(self.logging_obj.async_success_handler(**logging_params))
executor.submit(
self.logging_obj.success_handler,
**logging_params,
# NB: We already run this in a TPE so the handler itself should run sync
synchronous=True,
)
self.logging_obj.success_handler(**logging_params)
raise StopAsyncIteration # Re-raise StopIteration
else:

View file

@ -140,8 +140,7 @@ class ResponsesAPIStreamingIterator(BaseResponsesAPIStreamingIterator):
)
)
executor.submit(
self.logging_obj.success_handler,
self.logging_obj.success_handler(
result=self.completed_response,
cache_hit=None,
start_time=self.start_time,

View file

@ -1161,13 +1161,7 @@ def client(original_function): # noqa: PLR0915
# LOG SUCCESS - handle streaming success logging in the _next_ object, remove `handle_success` once it's deprecated
verbose_logger.info("Wrapper: Completed Call, calling success_handler")
if litellm.sync_logging:
logging_obj.success_handler(result, start_time, end_time)
else:
executor.submit(
# NB: We already run this in a TPE so the handler itself should run sync
logging_obj.success_handler, result, start_time, end_time, synchronous=True,
)
# RETURN RESULT
update_response_metadata(