From 9c71a3ac16731bc921348eeb8dd890c0f51dd4f5 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Mon, 21 Sep 2026 13:22:27 +0000 Subject: [PATCH] test(vertex): pin Gemini Embedding 2 cost cases to the in-repo cost map TestProcessEmbedContentResponseUsage checks per-image, per-video-second, and per-audio-second billing for gemini-embedding-2. Those rates live in this branch's model_prices_and_context_window.json, but at import time litellm.model_cost is fetched from main, which has migrated the same model to per-token pricing. In CI the fetch succeeds and prompt_cost drops to 0 (image cases) or misses the video component (audio+video), so the class-level assertions against the checked-in rates fail. Reuse the existing local_model_cost_map fixture in tests/test_litellm/conftest.py so the class always reads the in-repo map and clears the get_model_info LRU cache on entry and exit. Co-authored-by: Krrish Dholakia --- .../test_batch_embed_content_transformation.py | 6 ++++++ 1 file changed, 6 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..f7cb7789b84 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 @@ -307,6 +307,12 @@ class TestProcessEmbedContentResponseUsage: MODEL = "gemini-embedding-2" + @pytest.fixture(autouse=True) + def _use_local_model_cost_map(self, local_model_cost_map): + """Test pins per-image / per-second rates that the fetched-from-``main`` cost map has + migrated to per-token pricing, so drive the assertion against the in-repo cost map.""" + return local_model_cost_map + def test_multimodal_image_preserves_usage_metadata(self): response_json = { "embedding": {"values": [0.1, 0.2, 0.3]},