mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-30 01:08:33 +00:00
* fix(gemini): return raw pcm16 when Gemini TTS answers WAV audio * fix(gemini): unwrap only pcm16-shaped WAV and pass through audio it cannot read Lyria music asked for as WAV is 48 kHz stereo, so stripping its header lost the rate and channels. Only a 24 kHz mono 16-bit WAV is unwrapped now, and audio that fails to decode or parse comes back unchanged instead of raising. * fix(gemini): decode WAV audio strictly and stop double-wrapping WAV on speech Pass through audio/wav base64 that is not strict base64, including non-ASCII and URL-safe input, unwrap WAV sent as a data URI text part, and return audio that is already a WAV container from /v1/audio/speech as is * fix(gemini): keep audio the caller asked Gemini for and read WAV headers from a prefix A responseFormat.audio.mimeType request now returns Gemini's audio as is, audio/x-wav, audio/wave and audio/vnd.wave labels unwrap like audio/wav, and a WAV of another shape is no longer decoded in full. * fix(gemini): keep the audio a caller asks for through extra_body or a mime_type key A responseFormat.audio.mime_type, or a responseFormat sent through extra_body.generationConfig, now counts as an explicit ask the same as mimeType. A responseFormat whose audio names no mime type still returns raw PCM * fix(gemini): pick the audio passthrough from the responseFormat Gemini receives An extra_body.generationConfig responseFormat, or response_format, replaces the top-level responseFormat on the request, so the response side now reads that same value before deciding to keep Gemini's audio as is * fix(gemini): decide the audio passthrough from the request body Gemini receives The keep-or-unwrap choice for Gemini TTS chat audio now reads generationConfig.responseFormat (or response_format) from the body sent to Gemini, so a dropped or overridden extra_body value no longer flips it, and a mime type given as its enum number counts as an ask * fix(gemini): read snake_case generation_config, treat enum 0 as unset, and keep the audio Google sent on batch, native and pass-through logs * fix(vertex_ai): keep transforming a batch output row whose request is not an object * fix(gemini): read snake_case generation_config when the camelCase key is null Gemini accepts a null generationConfig next to a snake_case generation_config and answers with the audio format the snake_case key names, so the keep-or-unwrap check now falls through to it. * fix(gemini): key cached responses on the requested audio format Whether Gemini TTS audio comes back as raw PCM now depends on the audio mime type a request names under responseFormat, generationConfig, or generation_config. The response cache key left those out, so a cached PCM answer could serve a later AUDIO_WAV ask, and a cached WAV answer could serve a call that named no format. The cache key now includes them, top level and under extra_body. A float mime type such as 4.0 is matched like its enum number, and the native generateContent pricing copy keeps Google's audio, since it only reads usage. * refactor(gemini): log chat and pass-through responses through one helper --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| _event_loop_reuse.py | ||
| redis_batch_double.py | ||
| test_azure_blob_cache.py | ||
| test_cache_preset_key.py | ||
| test_caching.py | ||
| test_caching_handler.py | ||
| test_check_and_fix_namespace_none_guard.py | ||
| test_dual_cache.py | ||
| test_embedding_router.py | ||
| test_evicted_client_closer.py | ||
| test_gcs_cache.py | ||
| test_in_memory_cache.py | ||
| test_llm_caching_handler.py | ||
| test_llm_client_cache_e2e.py | ||
| test_qdrant_semantic_cache.py | ||
| test_redis_batch.py | ||
| test_redis_cache.py | ||
| test_redis_cluster_cache.py | ||
| test_redis_cluster_node_isolation.py | ||
| test_redis_connection_pool.py | ||
| test_redis_semantic_cache.py | ||
| test_request_redis_batch_post_call.py | ||
| test_request_redis_batch_pre_call.py | ||
| test_responses_stream_cache_keys.py | ||
| test_s3_cache.py | ||
| test_unit_test_caching.py | ||
| test_valkey_semantic_cache.py | ||