Forward Vertex file content logging context

This commit is contained in:
Cursor Agent 2026-05-02 06:57:55 +00:00
parent 9d51706502
commit 10261e4f90
No known key found for this signature in database

View file

@ -577,7 +577,8 @@ class VertexAIFilesConfig(VertexBase, BaseFilesConfig):
content = raw_response.content
if content:
transformed_content = self._try_transform_vertex_batch_output_to_openai(
content
content=content,
logging_obj=logging_obj,
)
if transformed_content != content:
# Create a new response with transformed content and updated Content-Length
@ -600,7 +601,9 @@ class VertexAIFilesConfig(VertexBase, BaseFilesConfig):
return HttpxBinaryResponseContent(response=raw_response)
def _try_transform_vertex_batch_output_to_openai(self, content: bytes) -> bytes:
def _try_transform_vertex_batch_output_to_openai(
self, content: bytes, logging_obj: Optional[LiteLLMLoggingObj] = None
) -> bytes:
"""
Try to transform Vertex AI batch output to OpenAI format.
If conversion fails at any point, return the original content as-is.
@ -656,15 +659,16 @@ class VertexAIFilesConfig(VertexBase, BaseFilesConfig):
return content
vertex_gemini_config = VertexGeminiConfig()
logging_obj = Logging(
model="",
messages=[],
stream=False,
call_type="batch_transform",
start_time=time.time(),
litellm_call_id="",
function_id="",
)
if logging_obj is None:
logging_obj = Logging(
model="",
messages=[],
stream=False,
call_type="batch_transform",
start_time=time.time(),
litellm_call_id="",
function_id="",
)
logging_obj.optional_params = {}
mock_httpx_response = httpx.Response(
status_code=200,