The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test vertex file content logging forwarding
Cursor Agent12ecac6f4673
diff --git a/litellm/llms/vertex_ai/files/transformation.py b/litellm/llms/vertex_ai/files/transformation.pyindex b7509269f42..29c2a72c005 100644--- a/litellm/llms/vertex_ai/files/transformation.py+++ b/litellm/llms/vertex_ai/files/transformation.py@@ -582,8 +582,6 @@ class VertexAIFilesConfig(VertexBase, BaseFilesConfig):)if transformed_content != content:# Create a new response with transformed content and updated Content-Length- import httpx-# Update headers with correct Content-Lengthnew_headers = dict(raw_response.headers)new_headers["content-length"] = str(len(transformed_content))diff --git a/tests/test_litellm/llms/vertex_ai/files/test_vertex_ai_files_transformation.py b/tests/test_litellm/llms/vertex_ai/files/test_vertex_ai_files_transformation.pyindex 239621f4153..c8d3fb384c8 100644--- a/tests/test_litellm/llms/vertex_ai/files/test_vertex_ai_files_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/files/test_vertex_ai_files_transformation.py@@ -149,6 +149,39 @@ class TestTransformFileContent:assert isinstance(result, HttpxBinaryResponseContent)assert result.response.content == b'{"line": 1}\n{"line": 2}\n'+ def test_should_forward_logging_obj_to_batch_output_transformer(+ self, config, monkeypatch+ ):+ raw_response = httpx.Response(+ status_code=200,+ content=b'{"line": 1}\n',+ headers={"content-type": "application/octet-stream"},+ request=httpx.Request("GET", "https://example.com"),+ )+ logging_obj = MagicMock()+ captured = {}++ def mock_try_transform_vertex_batch_output_to_openai(content, logging_obj=None):+ captured["content"] = content+ captured["logging_obj"] = logging_obj+ return content++ monkeypatch.setattr(+ config,+ "_try_transform_vertex_batch_output_to_openai",+ mock_try_transform_vertex_batch_output_to_openai,+ )++ result = config.transform_file_content_response(+ raw_response=raw_response,+ logging_obj=logging_obj,+ litellm_params={},+ )++ assert captured["content"] == raw_response.content+ assert captured["logging_obj"] is logging_obj+ assert result.response is raw_response+class TestTransformDeleteFile:def test_should_build_correct_gcs_delete_url(self, config):