litellm/tests/unit/llms/gemini
owen-hj 8717147b20
fix(vertex_ai): request TEXT in the default Live setup for text-only realtime models (#54657)
* fix(vertex_ai): request TEXT in the default Live setup for text-only realtime models

The Vertex default Live setup now comes from the same builder as the session.update setup, so text-only models such as transcribe-live get TEXT instead of AUDIO and stop closing with 1007

The realtime cost map lookup also checks vertex_ai/<model>, so a model listed only under vertex_ai is recognized as text-only and gets its input transcription usage estimate

* fix(gemini): keep text-only Live detection when a deployment sets model_info mode realtime

A deployment's model_info.mode overwrites the shared cost map mode, so mode audio_transcription alone stopped marking gemini-3.5-transcribe-live as text-only. Also read supported_endpoints and supported_output_modalities, and add them to vertex_ai/gemini-3.5-transcribe-live

* fix(gemini): bill the Live audio-duration estimate only for audio-in, text-out transcription models

The widened text-only rule also matched Live chat models whose outputs are
text only, so their sessions got the transcription estimate on top of the
usageMetadata Google already reports

* fix(vertex_ai): read the vertex_ai cost map row before the AI Studio row for Live setup

Vertex Live setup looked up gemini/<model> before vertex_ai/<model>, so an AI Studio
deployment's model_info could change what a Vertex deployment of the same model sent,
and AI Studio sessions borrowed vertex_ai-only rows. The cost map lookup now takes its
provider prefixes from the config class: Gemini reads gemini/ only, Vertex reads
vertex_ai/ then gemini/

* fix(vertex_ai): read a Live field the vertex_ai cost map row lacks from the gemini row

Taking the first cost map row whole let a vertex_ai row without the realtime
fields hide the gemini row's, so on an older cost map a deployment with
model_info mode realtime sent AUDIO again and stopped estimating usage. Each
field now comes from the first row that has a value for it

* fix(vertex_ai): health check Vertex models listed only on Live endpoints over realtime by default

* fix(vertex_ai): fail the realtime health check when Live closes the session setup

* fix(vertex_ai): bound the realtime health check's wait for the Live setup reply

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-30 21:25:41 +00:00
..
audio_transcription fix(audio-transcription): keep transcripts out of transcription error messages (#50137) 2026-11-05 18:07:15 -08:00
batches feat(gemini): file-backed batch jobs on /v1/batches with output download and spend tracking (#51032) 2026-11-11 12:00:32 -08:00
decisions fix(decisions): keep systemone confidence, extra fields and proxy cost on litellm_proxy calls (#53195) 2026-11-21 12:47:10 -08:00
files feat(gemini): support extended multimodal file inspection on chat completions (#52611) 2026-11-23 19:17:35 -08:00
google_genai fix(guardrails): check one-object parts and tool turns on generateContent (#54359) 2026-11-25 12:32:47 +00:00
image_edit fix(vertex_ai): honor Gemini image size and imageConfig controls on generation and edits (#53580) 2026-11-23 09:05:25 -08:00
image_generation test: move whole-unit legacy test files into tests/unit and delete dead skips (#44807) 2026-10-07 05:02:28 +00:00
realtime fix(vertex_ai): request TEXT in the default Live setup for text-only realtime models (#54657) 2026-11-30 21:25:41 +00:00
vector_stores refactor(typing): clear 102 basedpyright Any errors across 21 files (#54586) 2026-11-25 19:03:46 -08:00
videos feat(videos): add first-class OpenRouter video request fields (#50319) 2026-11-06 16:50:48 -08:00
__init__.py test(unit): make every tests/unit directory a package so pytest collection is unique 2026-09-20 11:50:59 +00:00
test_cost_calculator.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_empty_image_response.py fix(gemini): return an error instead of an empty 200 when a Gemini image request gets no image (#29125) 2026-11-25 20:55:23 +00:00
test_gemini_client_setup.py chore(cost-map): remove the 52 rows whose provider retired them before 2026 (#49974) 2026-11-03 16:23:06 -08:00
test_gemini_common_utils.py fix(proxy): count a contents-only body on /utils/token_counter (#50710) 2026-11-26 01:21:21 +00:00
test_gemini_image_generation_transformation.py fix(gemini): return an error instead of an empty 200 when a Gemini image request gets no image (#29125) 2026-11-25 20:55:23 +00:00
test_gemini_streaming.py test: migrate local_testing SDK and provider tests out of build_and_test (#45760) 2026-10-10 23:14:25 +00:00
test_gemini_tts.py fix(gemini)!: answer 400 for an unsupported chat audio format, drop it under drop_params (#49423) 2026-11-02 04:33:19 -08:00
test_image_usage_transformation.py fix(images): normalize null cached token counts (#52857) 2026-11-19 17:49:26 +00:00