From ceaaadeb8fffcf8d490a9dfea3b693b1223e70d9 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Sat, 15 Nov 2025 09:50:09 -0800 Subject: [PATCH] fix debug logging --- .../gemini_passthrough_logging_handler.py | 5 +++-- .../vertex_passthrough_logging_handler.py | 21 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) 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 8c96c2ab96..ac0b3f900e 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 @@ -18,8 +18,9 @@ from litellm.types.utils import ( ) if TYPE_CHECKING: - from ..success_handler import PassThroughEndpointLogging from litellm.types.passthrough_endpoints.pass_through_endpoints import EndpointType + + from ..success_handler import PassThroughEndpointLogging else: PassThroughEndpointLogging = Any EndpointType = Any @@ -193,7 +194,7 @@ class GeminiPassthroughLoggingHandler: kwargs["custom_llm_provider"] = custom_llm_provider # pretty print standard logging object - verbose_proxy_logger.debug("kwargs= %s", json.dumps(kwargs, indent=4)) + verbose_proxy_logger.debug("kwargs= %s", kwargs) # set litellm_call_id to logging response object litellm_model_response.id = logging_obj.litellm_call_id 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 c53c2f6e76..0e9528203d 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 @@ -17,19 +17,20 @@ from litellm.llms.vertex_ai.vector_stores.search_api.transformation import ( ) from litellm.proxy._types import PassThroughEndpointLoggingTypedDict from litellm.types.utils import ( + Choices, EmbeddingResponse, ImageResponse, ModelResponse, + SpecialEnums, StandardPassThroughResponseObject, TextCompletionResponse, - Choices, ) -from litellm.types.utils import SpecialEnums vertex_search_api_config = VertexSearchAPIVectorStoreConfig() if TYPE_CHECKING: - from ..success_handler import PassThroughEndpointLogging from litellm.types.utils import LiteLLMBatch + + from ..success_handler import PassThroughEndpointLogging else: PassThroughEndpointLogging = Any LiteLLMBatch = Any @@ -489,7 +490,7 @@ class VertexPassthroughLoggingHandler: kwargs["model"] = model # pretty print standard logging object - verbose_proxy_logger.debug("kwargs= %s", json.dumps(kwargs, indent=4)) + verbose_proxy_logger.debug("kwargs= %s", kwargs) # set litellm_call_id to logging response object litellm_model_response.id = logging_obj.litellm_call_id @@ -513,10 +514,13 @@ class VertexPassthroughLoggingHandler: Handle batch prediction jobs passthrough logging. Creates a managed object for cost tracking when batch job is successfully created. """ - from litellm.llms.vertex_ai.batches.transformation import VertexAIBatchTransformation - from litellm._uuid import uuid import base64 + from litellm._uuid import uuid + from litellm.llms.vertex_ai.batches.transformation import ( + VertexAIBatchTransformation, + ) + try: _json_response = httpx_response.json() @@ -676,8 +680,7 @@ class VertexPassthroughLoggingHandler: managed_files_hook = proxy_logging_obj.get_proxy_hook("managed_files") if managed_files_hook is not None and hasattr(managed_files_hook, 'store_unified_object_id'): # Create a mock user API key dict for the managed object storage - from litellm.proxy._types import UserAPIKeyAuth - from litellm.proxy._types import LitellmUserRoles + from litellm.proxy._types import LitellmUserRoles, UserAPIKeyAuth user_api_key_dict = UserAPIKeyAuth( user_id=kwargs.get("user_id", "default-user"), api_key="", @@ -704,7 +707,7 @@ class VertexPassthroughLoggingHandler: # Store the unified object for batch cost tracking import asyncio asyncio.create_task( - managed_files_hook.store_unified_object_id( + managed_files_hook.store_unified_object_id( # type: ignore unified_object_id=unified_object_id, file_object=batch_object, litellm_parent_otel_span=None,