mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 02:34:29 +00:00
clean up
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
This commit is contained in:
parent
53443a8d5a
commit
57f1d436e1
4 changed files with 5 additions and 24 deletions
|
@ -2264,14 +2264,7 @@ class Logging(LiteLLMLoggingBaseClass):
|
||||||
if self._should_run_sync_callbacks_for_async_calls() is False:
|
if self._should_run_sync_callbacks_for_async_calls() is False:
|
||||||
return
|
return
|
||||||
|
|
||||||
executor.submit(
|
self.success_handler(result, start_time, end_time)
|
||||||
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,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _should_run_sync_callbacks_for_async_calls(self) -> bool:
|
def _should_run_sync_callbacks_for_async_calls(self) -> bool:
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1810,15 +1810,10 @@ class CustomStreamWrapper:
|
||||||
)
|
)
|
||||||
if litellm.sync_logging:
|
if litellm.sync_logging:
|
||||||
await self.logging_obj.async_success_handler(**logging_params)
|
await self.logging_obj.async_success_handler(**logging_params)
|
||||||
self.logging_obj.success_handler(**logging_params, synchronous=True)
|
|
||||||
else:
|
else:
|
||||||
asyncio.create_task(self.logging_obj.async_success_handler(**logging_params))
|
asyncio.create_task(self.logging_obj.async_success_handler(**logging_params))
|
||||||
executor.submit(
|
|
||||||
self.logging_obj.success_handler,
|
self.logging_obj.success_handler(**logging_params)
|
||||||
**logging_params,
|
|
||||||
# NB: We already run this in a TPE so the handler itself should run sync
|
|
||||||
synchronous=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
raise StopAsyncIteration # Re-raise StopIteration
|
raise StopAsyncIteration # Re-raise StopIteration
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -140,8 +140,7 @@ class ResponsesAPIStreamingIterator(BaseResponsesAPIStreamingIterator):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
executor.submit(
|
self.logging_obj.success_handler(
|
||||||
self.logging_obj.success_handler,
|
|
||||||
result=self.completed_response,
|
result=self.completed_response,
|
||||||
cache_hit=None,
|
cache_hit=None,
|
||||||
start_time=self.start_time,
|
start_time=self.start_time,
|
||||||
|
|
|
@ -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
|
# 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")
|
verbose_logger.info("Wrapper: Completed Call, calling success_handler")
|
||||||
if litellm.sync_logging:
|
logging_obj.success_handler(result, start_time, end_time)
|
||||||
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
|
# RETURN RESULT
|
||||||
update_response_metadata(
|
update_response_metadata(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue