mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
(performance improvement - litellm sdk + proxy) - ensure litellm does not create unnecessary threads when running async functions (#7680)
* fix handle_sync_success_callbacks_for_async_calls * fix handle_sync_success_callbacks_for_async_calls * fix linting / testing errors * use handle_sync_success_callbacks_for_async_calls * add unit testing for logging fixes
This commit is contained in:
parent
a3e65c9bcb
commit
5c870c0c51
4 changed files with 264 additions and 25 deletions
|
@ -608,10 +608,11 @@ async def _client_async_logging_helper(
|
|||
asyncio.create_task(
|
||||
logging_obj.async_success_handler(result, start_time, end_time)
|
||||
)
|
||||
threading.Thread(
|
||||
target=logging_obj.success_handler,
|
||||
args=(result, start_time, end_time),
|
||||
).start()
|
||||
logging_obj.handle_sync_success_callbacks_for_async_calls(
|
||||
result=result,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
)
|
||||
|
||||
|
||||
def client(original_function): # noqa: PLR0915
|
||||
|
@ -1153,11 +1154,10 @@ def client(original_function): # noqa: PLR0915
|
|||
is_completion_with_fallbacks=is_completion_with_fallbacks,
|
||||
)
|
||||
)
|
||||
executor.submit(
|
||||
logging_obj.success_handler,
|
||||
result,
|
||||
start_time,
|
||||
end_time,
|
||||
logging_obj.handle_sync_success_callbacks_for_async_calls(
|
||||
result=result,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
)
|
||||
# REBUILD EMBEDDING CACHING
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue