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 <krrish-berri-2@users.noreply.github.com>
This commit is contained in:
Cursor Agent 2026-09-21 13:22:27 +00:00
parent 252c71c0b2
commit 9c71a3ac16
No known key found for this signature in database

View file

@ -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]},