mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-18 09:45:23 +00:00
test(audio): cover Gemini transcription conflicts
This commit is contained in:
parent
2ab4fb33b2
commit
0848080432
1 changed files with 28 additions and 0 deletions
|
|
@ -220,6 +220,22 @@ class TestTransformRequest:
|
|||
"diarization_mode": "speaker",
|
||||
}
|
||||
|
||||
def test_global_drop_params_removes_keywords_with_word_timestamps(self, config, monkeypatch):
|
||||
monkeypatch.setattr(litellm, "drop_params", True)
|
||||
|
||||
request_data = config.transform_audio_transcription_request(
|
||||
model="gemini-3.5-transcribe",
|
||||
audio_file=("sample.wav", AUDIO_BYTES, "audio/wav"),
|
||||
optional_params={
|
||||
"keywords": ["alpha"],
|
||||
"timestamp_granularities": ["word"],
|
||||
},
|
||||
litellm_params={},
|
||||
)
|
||||
transcription_config = request_data.data["generation_config"]["transcription_config"]
|
||||
assert "custom_vocabulary" not in transcription_config
|
||||
assert transcription_config["mode"]["timestamp_granularities"] == ("word",)
|
||||
|
||||
def test_word_timestamp_granularity_maps_to_verbatim_diarization_mode(self, config):
|
||||
request_data = config.transform_audio_transcription_request(
|
||||
model="gemini-3.5-transcribe",
|
||||
|
|
@ -253,6 +269,18 @@ class TestTransformRequest:
|
|||
}
|
||||
}
|
||||
|
||||
@pytest.mark.parametrize("response_format", ["srt", "vtt"])
|
||||
def test_keywords_with_subtitle_response_format_raise(self, config, response_format, monkeypatch):
|
||||
monkeypatch.setattr(litellm, "drop_params", False)
|
||||
|
||||
with pytest.raises(litellm.UnsupportedParamsError, match="custom vocabulary with word timestamps"):
|
||||
config.transform_audio_transcription_request(
|
||||
model="gemini-3.5-transcribe",
|
||||
audio_file=("sample.wav", AUDIO_BYTES, "audio/wav"),
|
||||
optional_params={"keywords": ["alpha"], "response_format": response_format},
|
||||
litellm_params={},
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize("response_format", ["json", "text", "verbose_json"])
|
||||
def test_non_subtitle_response_format_sends_no_mode(self, config, response_format):
|
||||
request_data = config.transform_audio_transcription_request(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue