From 3ed052ff70ef96a4d1b74bbfd38c5e1ed9586844 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sun, 20 Sep 2026 04:25:24 +0000 Subject: [PATCH] test(vertex): pin gemini-embedding-2 cost tests to the local map TestProcessEmbedContentResponseUsage hard-codes the per-image and per-second rates this branch registers for gemini-embedding-2. litellm loads model_cost from the network fetched main copy by default, and main #41157 rewrote gemini-embedding-2 to per-token billing, so the cost calls return 0.0 for image_count and video_length paths and audio_tokens double-bills at the new per-token rate. Force the packaged local map for the class so the assertions resolve against the same rates they were written against. Co-authored-by: Krrish Dholakia --- .../test_batch_embed_content_transformation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py index 86b3f0976ab..57d40ba3251 100644 --- a/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py +++ b/tests/test_litellm/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py @@ -299,10 +299,17 @@ class TestProcessResponse: ) +@pytest.mark.usefixtures("local_model_cost_map") class TestProcessEmbedContentResponseUsage: """Gemini Embedding 2 embedContent usageMetadata must drive spend. Regression for multimodal calls recording prompt_tokens=0 / spend=$0. + + The dollar-value assertions read the per-image and per-second rates this + branch registers for gemini-embedding-2. litellm defaults to the network + fetched main model_cost, which now bills the modalities per token, so the + cost calls return 0.0 or the wrong audio-token amount without the local + map pinned. """ MODEL = "gemini-embedding-2"