fix use thread_pool_executor for pass through logging

This commit is contained in:
Ishaan Jaff 2024-11-25 16:13:06 -08:00
parent 68408c4d77
commit 068f1af120
2 changed files with 7 additions and 4 deletions

View file

@ -18,6 +18,7 @@ from litellm.llms.vertex_ai_and_google_ai_studio.gemini.vertex_and_google_ai_stu
from litellm.proxy._types import PassThroughEndpointLoggingResultValues from litellm.proxy._types import PassThroughEndpointLoggingResultValues
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
from litellm.types.utils import StandardPassThroughResponseObject from litellm.types.utils import StandardPassThroughResponseObject
from litellm.utils import executor as thread_pool_executor
from .llm_provider_handlers.anthropic_passthrough_logging_handler import ( from .llm_provider_handlers.anthropic_passthrough_logging_handler import (
AnthropicPassthroughLoggingHandler, AnthropicPassthroughLoggingHandler,
@ -93,15 +94,16 @@ class PassThroughEndpointLogging:
standard_logging_response_object = StandardPassThroughResponseObject( standard_logging_response_object = StandardPassThroughResponseObject(
response=httpx_response.text response=httpx_response.text
) )
threading.Thread( thread_pool_executor.submit(
target=logging_obj.success_handler, logging_obj.success_handler,
args=( args=(
standard_logging_response_object, standard_logging_response_object,
start_time, start_time,
end_time, end_time,
cache_hit, cache_hit,
), ),
).start() )
await logging_obj.async_success_handler( await logging_obj.async_success_handler(
result=( result=(
json.dumps(result) json.dumps(result)

View file

@ -22,3 +22,4 @@ router_settings:
litellm_settings: litellm_settings:
callbacks: ["prometheus"] callbacks: ["prometheus"]
success_callback: ["langfuse"]