mirror of
https://github.com/BerriAI/litellm.git
synced 2026-08-28 05:25:59 +00:00
fix(gemini): map video response modality instead of MODALITY_UNSPECIFIED
This commit is contained in:
parent
598fa9d64d
commit
ce3bf2d839
2 changed files with 8 additions and 0 deletions
|
|
@ -998,6 +998,8 @@ class VertexGeminiConfig(VertexAIBaseConfig, BaseConfig):
|
|||
response_modalities.append("IMAGE")
|
||||
elif modality == "audio":
|
||||
response_modalities.append("AUDIO")
|
||||
elif modality == "video":
|
||||
response_modalities.append("VIDEO")
|
||||
else:
|
||||
response_modalities.append("MODALITY_UNSPECIFIED")
|
||||
return response_modalities
|
||||
|
|
|
|||
|
|
@ -880,6 +880,12 @@ def test_vertex_ai_usage_metadata_with_image_tokens_in_prompt():
|
|||
)
|
||||
|
||||
|
||||
def test_map_response_modalities_video():
|
||||
"""The video modality maps to VIDEO instead of MODALITY_UNSPECIFIED, which Gemini rejects."""
|
||||
v = VertexGeminiConfig()
|
||||
assert v.map_response_modalities(["text", "video"]) == ["TEXT", "VIDEO"]
|
||||
|
||||
|
||||
def test_vertex_ai_usage_metadata_accumulates_duplicate_modalities():
|
||||
"""Ensure _calculate_usage accumulates repeated modality entries."""
|
||||
v = VertexGeminiConfig()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue