From ea8ab3a2ccb32319ec36eccef9f0f0e683e28f3a Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 19 Sep 2026 13:18:43 +0000 Subject: [PATCH] test(vertex): pin gemini embedding cost tests to the in-repo cost map The four TestProcessEmbedContentResponseUsage cases that call generic_cost_per_token were reading gemini-embedding-2 rates from model_cost, which litellm fetches from main by default. main carries per-token image/audio/video keys for that model, while this branch prices audio/video per second and images per count, so the tests resolved 0.0 for input_cost_per_image and input_cost_per_*_per_second and asserted against the wrong totals. Take the local_model_cost_map fixture on those four tests so pricing resolves against the in-repo file that ships with this branch, the same fixture the other cost-pinned suites already use. Co-authored-by: Krrish Dholakia --- .../test_batch_embed_content_transformation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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..b5cfe55292b 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,7 +307,7 @@ class TestProcessEmbedContentResponseUsage: MODEL = "gemini-embedding-2" - def test_multimodal_image_preserves_usage_metadata(self): + def test_multimodal_image_preserves_usage_metadata(self, local_model_cost_map): response_json = { "embedding": {"values": [0.1, 0.2, 0.3]}, "usageMetadata": { @@ -400,7 +400,7 @@ class TestProcessEmbedContentResponseUsage: ) assert result.usage.prompt_tokens > 0 - def test_file_reference_image_billed_per_image_not_text(self): + def test_file_reference_image_billed_per_image_not_text(self, local_model_cost_map): """files/... image refs must bill per-image, not at the text token rate.""" response_json = { "embedding": {"values": [0.1, 0.2, 0.3]}, @@ -432,7 +432,7 @@ class TestProcessEmbedContentResponseUsage: ) assert prompt_cost == pytest.approx(0.00012) - def test_file_reference_non_image_not_counted_as_image(self): + def test_file_reference_non_image_not_counted_as_image(self, local_model_cost_map): """A files/... ref resolving to a non-image mime must not be image-counted.""" response_json = { "embedding": {"values": [0.1, 0.2]}, @@ -467,7 +467,7 @@ class TestProcessEmbedContentResponseUsage: ) assert prompt_cost == pytest.approx(2.0 * 0.00016) - def test_video_plus_audio_does_not_double_bill_text(self): + def test_video_plus_audio_does_not_double_bill_text(self, local_model_cost_map): """Video+audio responses must not get video tokens reassigned to text.""" response_json = { "embedding": {"values": [0.1]},