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.auth.user_api_key_auth import user_api_key_auth
from litellm.types.utils import StandardPassThroughResponseObject
from litellm.utils import executor as thread_pool_executor
from .llm_provider_handlers.anthropic_passthrough_logging_handler import (
AnthropicPassthroughLoggingHandler,
@ -93,15 +94,16 @@ class PassThroughEndpointLogging:
standard_logging_response_object = StandardPassThroughResponseObject(
response=httpx_response.text
)
threading.Thread(
target=logging_obj.success_handler,
thread_pool_executor.submit(
logging_obj.success_handler,
args=(
standard_logging_response_object,
start_time,
end_time,
cache_hit,
),
).start()
)
await logging_obj.async_success_handler(
result=(
json.dumps(result)

View file

@ -21,4 +21,5 @@ router_settings:
redis_password: os.environ/REDIS_PASSWORD
litellm_settings:
callbacks: ["prometheus"]
callbacks: ["prometheus"]
success_callback: ["langfuse"]