From 7e6f4f3306cfa74ecdaed31184e743b36f237119 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dawid=20=C5=81azi=C5=84ski?= Date: Mon, 20 Apr 2026 20:12:05 +0200 Subject: [PATCH] fix: move BasePassthroughLoggingHandler imports to local scope to avoid cyclic import warnings --- .../anthropic_passthrough_logging_handler.py | 7 +++---- .../gemini_passthrough_logging_handler.py | 3 ++- .../vertex_passthrough_logging_handler.py | 5 ++--- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py index b805db38da6..1ca1c7bfb64 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/anthropic_passthrough_logging_handler.py @@ -19,7 +19,6 @@ from litellm.types.passthrough_endpoints.pass_through_endpoints import ( ) from litellm.types.utils import LiteLLMBatch, ModelResponse, TextCompletionResponse -from .base_passthrough_logging_handler import BasePassthroughLoggingHandler if TYPE_CHECKING: from litellm.types.passthrough_endpoints.pass_through_endpoints import EndpointType @@ -159,6 +158,7 @@ class AnthropicPassthroughLoggingHandler: {"proxy_server_request": {"body": {"user": user}}} ) + from .base_passthrough_logging_handler import BasePassthroughLoggingHandler # noqa: PLC0415 BasePassthroughLoggingHandler._apply_spend_logs_metadata( kwargs, passthrough_logging_payload ) @@ -227,12 +227,11 @@ class AnthropicPassthroughLoggingHandler: "result": None, "kwargs": {}, } + from .base_passthrough_logging_handler import BasePassthroughLoggingHandler # noqa: PLC0415 kwargs = AnthropicPassthroughLoggingHandler._create_anthropic_response_logging_payload( litellm_model_response=complete_streaming_response, model=model, - kwargs=BasePassthroughLoggingHandler._seed_streaming_kwargs_from_logging_obj( - litellm_logging_obj - ), + kwargs=BasePassthroughLoggingHandler._seed_streaming_kwargs_from_logging_obj(litellm_logging_obj), start_time=start_time, end_time=end_time, logging_obj=litellm_logging_obj, diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py index 9c362cc3315..8c518ad200d 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/gemini_passthrough_logging_handler.py @@ -17,7 +17,6 @@ from litellm.types.utils import ( TextCompletionResponse, ) -from .base_passthrough_logging_handler import BasePassthroughLoggingHandler if TYPE_CHECKING: from litellm.types.passthrough_endpoints.pass_through_endpoints import EndpointType @@ -141,6 +140,7 @@ class GeminiPassthroughLoggingHandler: - Creates standard logging object - Logs in litellm callbacks """ + from .base_passthrough_logging_handler import BasePassthroughLoggingHandler # noqa: PLC0415 kwargs: Dict[str, Any] = ( BasePassthroughLoggingHandler._seed_streaming_kwargs_from_logging_obj( litellm_logging_obj @@ -248,6 +248,7 @@ class GeminiPassthroughLoggingHandler: kwargs["model"] = model kwargs["custom_llm_provider"] = custom_llm_provider + from .base_passthrough_logging_handler import BasePassthroughLoggingHandler # noqa: PLC0415 BasePassthroughLoggingHandler._apply_spend_logs_metadata( kwargs, kwargs.get("passthrough_logging_payload") ) diff --git a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py index e78255d9d69..3c837a42e8a 100644 --- a/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py +++ b/litellm/proxy/pass_through_endpoints/llm_provider_handlers/vertex_passthrough_logging_handler.py @@ -16,9 +16,6 @@ from litellm.llms.vertex_ai.vector_stores.search_api.transformation import ( ) from litellm.llms.vertex_ai.videos.transformation import VertexAIVideoConfig from litellm.proxy._types import PassThroughEndpointLoggingTypedDict -from litellm.proxy.pass_through_endpoints.llm_provider_handlers.base_passthrough_logging_handler import ( - BasePassthroughLoggingHandler, -) from litellm.types.utils import ( Choices, EmbeddingResponse, @@ -344,6 +341,7 @@ class VertexPassthroughLoggingHandler: - Creates standard logging object - Logs in litellm callbacks """ + from litellm.proxy.pass_through_endpoints.llm_provider_handlers.base_passthrough_logging_handler import BasePassthroughLoggingHandler # noqa: PLC0415 kwargs: Dict[str, Any] = ( BasePassthroughLoggingHandler._seed_streaming_kwargs_from_logging_obj( litellm_logging_obj @@ -554,6 +552,7 @@ class VertexPassthroughLoggingHandler: kwargs["response_cost"] = response_cost kwargs["model"] = model + from litellm.proxy.pass_through_endpoints.llm_provider_handlers.base_passthrough_logging_handler import BasePassthroughLoggingHandler # noqa: PLC0415 BasePassthroughLoggingHandler._apply_spend_logs_metadata( kwargs, kwargs.get("passthrough_logging_payload") )