mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-25 22:20:43 +00:00
* fix(vertex-ai): send union-root tool schemas as parametersJsonSchema A function tool whose parameters root is a union (anyOf, oneOf or allOf at the root, a type list, or a root $ref to one of those) cannot be expressed in the Vertex and Gemini parameters field, so those tools answered 400. They now go out as parametersJsonSchema with the caller's JSON Schema unchanged, on both the tools and the legacy functions paths. Every other tool keeps the converted parameters it had before. The local token counter also reads parametersJsonSchema, so these tools still count * fix(vertex-ai): resolve chained root refs and tuple schemas for parametersJsonSchema A root $ref that points at another $ref now resolves to its end, so a chain that ends in a union also goes out as parametersJsonSchema. A schema built with tuples or sets is turned into its JSON form first, so it no longer falls back to the parameters field. A type of ["object"] stays on the parameters field, which already accepts it. Only tools whose root could need parametersJsonSchema pay for the JSON conversion * fix(vertex-ai): resolve long root $ref chains without recursion * fix(vertex-ai): keep parameters for Vertex batch rows and Vertex countTokens Vertex batch merges every row's keys into one shape, so a parametersJsonSchema tool in one row breaks every parameters row in the file. Vertex countTokens accepts parametersJsonSchema but leaves it out of the count. Both keep sending parameters, and the Gemini API count route keeps parametersJsonSchema, which it counts in full. * fix(vertex-ai): resolve a root $ref chain in linear time Walk $defs by name once with cycle detection, so a long missing ref or a long-named ref cycle beside many defs no longer costs quadratic CPU * fix(vertex-ai): send a root $ref tool as parametersJsonSchema when a union sits beside the ref Check the root and every ref on its chain for anyOf, oneOf, allOf, or a non-object type, since a rule next to a $ref was dropped when only the chain's end was checked * fix(vertex-ai): keep a bare root union tool on parameters when the call can be forced to it * fix(vertex-ai): keep a bare root union tool on parameters when extra_body forces the call * fix(vertex-ai): keep integer enums on a tool that extra_body forces back to parameters * fix(vertex-ai): keep a union beside a looping root $ref on parameters and read the forcing mode in any case A root union next to a $ref chain that loops back on itself went out as parametersJsonSchema, and Google answers 400 "circular ref loop" for that, where base sent parameters and got 200. A looping chain now stays on parameters whatever sits next to the $ref An extra_body toolConfig with mode "any" forces the call on the Gemini API, but only "ANY" and "VALIDATED" were read as forcing, so a bare root union tool moved to parametersJsonSchema and the forced call answered 400. The mode is now compared in upper case --------- 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 | ||