Add an configuration option to make callback logging synchronous

Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
This commit is contained in:
B-Step62 2025-02-03 10:06:12 +09:00
parent 8ba60bf13c
commit 482180cfba
6 changed files with 87 additions and 52 deletions

View file

@ -1082,12 +1082,18 @@ 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")
executor.submit(
logging_obj.success_handler,
result,
start_time,
end_time,
)
if litellm.sync_logging:
print("sync_logging")
logging_obj.success_handler(result, start_time, end_time)
else:
print("async_logging")
executor.submit(
logging_obj.success_handler,
result,
start_time,
end_time,
)
# RETURN RESULT
update_response_metadata(
result=result,