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

View file

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