From a217303766342100ff0e5b5c22b95ff0db21fd30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Bossi=C3=A8re?= Date: Tue, 15 Sep 2026 14:11:52 +0200 Subject: [PATCH] test(vertex_ai): pin gemini-embedding-2 spend assertions to the bundled cost map The four TestProcessEmbedContentResponseUsage cases that assert spend read the gemini-embedding-2 rates from litellm.model_cost, which is fetched from main at import time. main now prices that model per modality token and no longer carries input_cost_per_image / input_cost_per_audio_per_second / input_cost_per_video_per_second, so every embed-content cost assertion in this class fails on this branch regardless of the code under test. Use the existing local_model_cost_map fixture, which pins the bundled in-repo map, exactly as the other pricing tests do. Fixes #41224 --- .../test_batch_embed_content_transformation.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/unit/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py b/tests/unit/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py index ba2b26bf0a2..a11ce79a3e9 100644 --- a/tests/unit/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py +++ b/tests/unit/llms/vertex_ai/gemini_embeddings/test_batch_embed_content_transformation.py @@ -308,10 +308,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 spend assertions read the ``gemini-embedding-2`` rates, so they must be + pinned to the bundled in-repo cost map: the default network-fetched ``main`` + copy is a different branch and already re-prices this model per modality + token (no ``input_cost_per_image`` / ``input_cost_per_*_per_second``), which + makes these cases fail for reasons unrelated to the transformation. """ MODEL = "gemini-embedding-2"