mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-17 09:34:48 +00:00
test(vertex): use repository cost map for embedding billing
This commit is contained in:
parent
fbb1cbddb3
commit
67722a31a0
2 changed files with 5 additions and 14 deletions
|
|
@ -299,6 +299,7 @@ class TestProcessResponse:
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("local_model_cost_map")
|
||||
class TestProcessEmbedContentResponseUsage:
|
||||
"""Gemini Embedding 2 embedContent usageMetadata must drive spend.
|
||||
|
||||
|
|
@ -501,3 +502,4 @@ class TestProcessEmbedContentResponseUsage:
|
|||
)
|
||||
# 1 floor text token at 2e-7 + 2s of video at 7.9e-4 + 2s of audio at 1.6e-4
|
||||
assert prompt_cost == pytest.approx(1 * 2e-7 + 2 * 0.00079 + 2 * 0.00016)
|
||||
|
||||
|
|
|
|||
|
|
@ -2967,19 +2967,9 @@ def test_gemini_embedding_2_ga_in_cost_map():
|
|||
assert info.get("mode") == "embedding"
|
||||
assert info.get("supports_multimodal") is True
|
||||
assert info.get("input_cost_per_token") == 2e-07
|
||||
if key in {
|
||||
"gemini/gemini-embedding-2",
|
||||
"vertex_ai/gemini-embedding-2",
|
||||
"gemini-embedding-2",
|
||||
}:
|
||||
assert info.get("input_cost_per_audio_token") == 6.5e-06
|
||||
assert info.get("input_cost_per_image_token") == 4.5e-07
|
||||
assert info.get("input_cost_per_token_batches") == 1e-07
|
||||
assert info.get("input_cost_per_video_token") == 1.2e-05
|
||||
else:
|
||||
assert info.get("input_cost_per_image") == 0.00012
|
||||
assert info.get("input_cost_per_audio_per_second") == 0.00016
|
||||
assert info.get("input_cost_per_video_per_second") == 0.00079
|
||||
assert info.get("input_cost_per_image") == 0.00012
|
||||
assert info.get("input_cost_per_audio_per_second") == 0.00016
|
||||
assert info.get("input_cost_per_video_per_second") == 0.00079
|
||||
if provider in ("vertex_ai-embedding-models", "vertex_ai"):
|
||||
assert (
|
||||
info.get("uses_embed_content") is True
|
||||
|
|
@ -6513,4 +6503,3 @@ def test_completion_finishes_response_metadata_before_handing_the_response_to_th
|
|||
assert snapshot["litellm_call_id"]
|
||||
assert snapshot["response_cost"] is not None
|
||||
assert snapshot["api_base"]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue