mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix(vertex_ai): pin const values on Gemini tool and response schemas as one-value enums
* fix(vertex_ai): keep a const its declared type cannot hold out of the Gemini enum
A property like {"type": "string", "const": 7} allows no value. Sent as enum [7] it made Vertex and the Gemini API answer 400, where the merge base answered 200, so such a const keeps today's behavior
* fix(vertex_ai): keep const pins for type lists, unions and whole floats, and skip empty strings
* fix(vertex_ai): drop union branches that cannot hold the const beside them
* fix(vertex_ai): copy a union branch before adding the const so a dict the schema reuses keeps its value
* fix(vertex_ai): send consts unpinned once a request's enums pass Gemini's enum budget
Gemini answers 400 once a request's one-value enums pass its enum size limit,
so const pins are kept only while every enum in the request, pins included,
fits GEMINI_MAX_ENUM_CHARACTERS. Pins are dropped before integer enums, the
public map_function is budgeted too, integer consts outside the exact range
stay as sent, and JSON-schema builders now pin an empty-string const.
* fix(vertex_ai): count const pins against one enum budget per request and skip the pin pass without a const
* fix(vertex_ai): count the enum budget in bytes, keep pins out of $ref and conflicting const branches, and end walks on schemas that contain themselves
* fix(vertex_ai): stop counting enum bytes once the request is over Gemini's enum budget
* fix(vertex_ai): walk schemas depth first so the const and enum checks keep memory flat on a wide, deep schema
* fix(vertex_ai): keep map_function a plain forwarder so a subclass that overrides _map_function still runs
---------
Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| audio_transcription | ||
| batches | ||
| decisions | ||
| files | ||
| google_genai | ||
| image_edit | ||
| image_generation | ||
| realtime | ||
| videos | ||
| __init__.py | ||
| test_cost_calculator.py | ||
| test_gemini_client_setup.py | ||
| test_gemini_common_utils.py | ||
| test_gemini_image_generation_transformation.py | ||
| test_gemini_streaming.py | ||
| test_gemini_tts.py | ||
| test_image_usage_transformation.py | ||