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): cover malformed batch usage details
kerry7761d044509e
diff --git a/tests/test_litellm/llms/vertex_ai/batches/test_transformation.py b/tests/test_litellm/llms/vertex_ai/batches/test_transformation.pyindex 232c6413e78..e6126b02790 100644--- a/tests/test_litellm/llms/vertex_ai/batches/test_transformation.py+++ b/tests/test_litellm/llms/vertex_ai/batches/test_transformation.py@@ -17,9 +17,9 @@ from unittest.mock import patchimport pytest-from litellm.llms.vertex_ai.batches.transformation import ( # noqa: E402VertexAIBatchTransformation,+ vertex_prompt_tokens_details,)from litellm.llms.vertex_ai.common_utils import ( # noqa: E402VertexAIError,@@ -41,6 +41,22 @@ ENDPOINT_INPUT_FILE = ()+def test_vertex_prompt_tokens_details_rejects_malformed_details():+ assert vertex_prompt_tokens_details({"promptTokensDetails": [1]}) is None+ assert vertex_prompt_tokens_details({"promptTokensDetails": [{"modality": "AUDIO"}]}) is None+ assert (+ vertex_prompt_tokens_details(+ {+ "promptTokensDetails": [+ {"modality": "AUDIO", "tokenCount": 1},+ "malformed",+ ]+ }+ )+ is None+ )++# =========================================================================== ## transform_openai_batch_request_to_vertex_ai_batch_request# =========================================================================== #