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
fix(vertex_ai): keep new batch handler code within the mutable-collection budget
mubashir1osmani14d5ff5c2190
diff --git a/litellm/llms/vertex_ai/batches/handler.py b/litellm/llms/vertex_ai/batches/handler.pyindex ae99eea777c..7f20b197056 100644--- a/litellm/llms/vertex_ai/batches/handler.py+++ b/litellm/llms/vertex_ai/batches/handler.py@@ -1,5 +1,5 @@import json-from collections.abc import Coroutine+from collections.abc import Coroutine, Sequencefrom typing import TYPE_CHECKING, Final, Protocolimport httpx@@ -61,7 +61,7 @@ class _VertexEndpointDeployedModel(TypedDict, total=False):class _VertexEndpointResponse(TypedDict, total=False):- deployedModels: ReadOnly[list[_VertexEndpointDeployedModel]]+ deployedModels: ReadOnly[Sequence[_VertexEndpointDeployedModel]]class _VertexEndpointPayloadView(TypedDict):@@ -179,7 +179,7 @@ class VertexAIBatchPrediction(VertexLLM):def _resolve_fine_tuned_endpoint_model(self,vertex_batch_request: VertexAIBatchPredictionJob,- headers: dict[str, str],+ headers: dict[str, str], # mutable-ok: HTTPHandler.get only accepts dict headerssync_handler: HTTPHandler,api_base: str | None,vertex_location: str,@@ -214,7 +214,7 @@ class VertexAIBatchPrediction(VertexLLM):)payload_view: Final[_VertexEndpointPayloadView] = {"payload": response.json()}- deployed_models: Final = payload_view["payload"].get("deployedModels") or []+ deployed_models: Final = payload_view["payload"].get("deployedModels") or ()deployed_model: Final = deployed_models[0].get("model", "") if deployed_models else ""if not deployed_model:raise VertexAIError(@@ -224,7 +224,8 @@ class VertexAIBatchPrediction(VertexLLM):"resource to run batch predictions against"),)- return {**vertex_batch_request, "model": deployed_model}+ resolved_request: Final[VertexAIBatchPredictionJob] = {**vertex_batch_request, "model": deployed_model}+ return resolved_requestasync def _async_create_batch(self,