diff --git a/litellm/utils.py b/litellm/utils.py index c9d9d32093..dbfbf46ecb 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -1864,12 +1864,6 @@ def client(original_function): # we only support async s3 logging for acompletion/aembedding since that's used on proxy litellm._async_success_callback.append(callback) removed_async_items.append(index) - elif callback == "langfuse" and inspect.iscoroutinefunction( - original_function - ): - # use async success callback for langfuse if this is litellm.acompletion(). Streaming logging does not work otherwise - litellm._async_success_callback.append(callback) - removed_async_items.append(index) # Pop the async items from success_callback in reverse order to avoid index issues for index in reversed(removed_async_items): @@ -2357,18 +2351,13 @@ def client(original_function): print_verbose( f"Async Wrapper: Completed Call, calling async_success_handler: {logging_obj.async_success_handler}" ) - # asyncio.to_thread( - # logging_obj.async_success_handler(result, start_time, end_time) - # ) + 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() - loop = asyncio.get_event_loop() - loop.run_in_executor( - executor=None, - func=logging_obj.async_success_handler(result, start_time, end_time), - ) # RETURN RESULT if hasattr(result, "_hidden_params"): result._hidden_params["model_id"] = kwargs.get("model_info", {}).get(