mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-20 04:18:42 +00:00
fix assistants logging
This commit is contained in:
+5
-14
@@ -201,20 +201,11 @@ class OpenAIPassthroughLoggingHandler(BasePassthroughLoggingHandler):
|
||||
)
|
||||
|
||||
if not (is_chat_completions or is_image_generation or is_image_editing):
|
||||
# For unsupported endpoints, use the base handler without cost tracking
|
||||
base_handler = OpenAIPassthroughLoggingHandler()
|
||||
return base_handler.passthrough_chat_handler(
|
||||
httpx_response=httpx_response,
|
||||
response_body=response_body,
|
||||
logging_obj=logging_obj,
|
||||
url_route=url_route,
|
||||
result=result,
|
||||
start_time=start_time,
|
||||
end_time=end_time,
|
||||
cache_hit=cache_hit,
|
||||
request_body=request_body,
|
||||
**kwargs,
|
||||
)
|
||||
# For unsupported endpoints, return None to let the system fall back to generic behavior
|
||||
return {
|
||||
"result": None,
|
||||
"kwargs": kwargs,
|
||||
}
|
||||
|
||||
# Extract model from request or response
|
||||
model = request_body.get("model", response_body.get("model", ""))
|
||||
|
||||
@@ -162,7 +162,7 @@ class PassThroughEndpointLogging:
|
||||
cohere_passthrough_logging_handler_result["result"]
|
||||
)
|
||||
kwargs = cohere_passthrough_logging_handler_result["kwargs"]
|
||||
elif self.is_openai_route(url_route):
|
||||
elif self.is_openai_route(url_route) and self._is_supported_openai_endpoint(url_route):
|
||||
from .llm_provider_handlers.openai_passthrough_logging_handler import (
|
||||
OpenAIPassthroughLoggingHandler,
|
||||
)
|
||||
@@ -319,6 +319,18 @@ class PassThroughEndpointLogging:
|
||||
or "openai.azure.com" in parsed_url.hostname
|
||||
)
|
||||
|
||||
def _is_supported_openai_endpoint(self, url_route: str) -> bool:
|
||||
"""Check if the OpenAI endpoint is supported by the passthrough logging handler."""
|
||||
from .llm_provider_handlers.openai_passthrough_logging_handler import (
|
||||
OpenAIPassthroughLoggingHandler,
|
||||
)
|
||||
|
||||
return (
|
||||
OpenAIPassthroughLoggingHandler.is_openai_chat_completions_route(url_route) or
|
||||
OpenAIPassthroughLoggingHandler.is_openai_image_generation_route(url_route) or
|
||||
OpenAIPassthroughLoggingHandler.is_openai_image_editing_route(url_route)
|
||||
)
|
||||
|
||||
def _set_cost_per_request(
|
||||
self,
|
||||
logging_obj: LiteLLMLoggingObj,
|
||||
|
||||
Reference in New Issue
Block a user