mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-09 22:31:41 +00:00
address greptile review: move early return before pre_call, trim comments
This commit is contained in:
parent
a4f94b241b
commit
583bdb279b
3 changed files with 6 additions and 11 deletions
|
|
@ -2923,7 +2923,7 @@ class Logging(LiteLLMLoggingBaseClass):
|
|||
isinstance(callback, CustomLogger)
|
||||
and is_sync_request
|
||||
and self.call_type
|
||||
!= CallTypes.pass_through.value # pass-through endpoints call async_log_failure_event
|
||||
!= CallTypes.pass_through.value
|
||||
): # custom logger class
|
||||
callback.log_failure_event(
|
||||
start_time=start_time,
|
||||
|
|
|
|||
|
|
@ -961,8 +961,6 @@ async def pass_through_request( # noqa: PLR0915
|
|||
if kwargs:
|
||||
for key, value in kwargs.items():
|
||||
request_payload[key] = value
|
||||
# Ensure the original logging_obj is in request_payload so
|
||||
# _handle_logging_proxy_only_error reuses it (preserving call_type)
|
||||
if logging_obj is not None:
|
||||
request_payload["litellm_logging_obj"] = logging_obj
|
||||
|
||||
|
|
|
|||
|
|
@ -1877,19 +1877,16 @@ class ProxyLogging:
|
|||
litellm_logging_obj.model_call_details["input"] = input
|
||||
if litellm_logging_obj.call_type != CallTypes.pass_through.value:
|
||||
litellm_logging_obj.call_type = CallTypes.aembedding.value
|
||||
# Pass-through endpoints are logged via the callback loop's
|
||||
# async_post_call_failure_hook — skip pre_call and failure handlers.
|
||||
if litellm_logging_obj.call_type == CallTypes.pass_through.value:
|
||||
return
|
||||
|
||||
litellm_logging_obj.pre_call(
|
||||
input=input,
|
||||
api_key="",
|
||||
)
|
||||
|
||||
# For pass-through endpoints, skip async_failure_handler and
|
||||
# failure_handler here. The callback loop in post_call_failure_hook
|
||||
# will call async_post_call_failure_hook on each CustomLogger,
|
||||
# which handles logging. Firing both paths would produce duplicate
|
||||
# entries in Datadog, Arize, and other callback integrations.
|
||||
if litellm_logging_obj.call_type == CallTypes.pass_through.value:
|
||||
return
|
||||
|
||||
# log the custom exception
|
||||
await litellm_logging_obj.async_failure_handler(
|
||||
exception=original_exception,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue