litellm/tests/unit/llms/vertex_ai/gemini
Sushit Lal Pakrashy 958cba7016
fix(vertex_ai): prevent Gemini from misinterpreting $ref in tool results (#38284)
* fix(vertex_ai): prevent Gemini from misinterpreting $ref in tool results

* fix(vertex_ai): use object instead of Any in schema-ref traversal

* fix(vertex_ai): use immutable tuple traversal to satisfy type-discipline gate

* test(vertex_ai): add direct contract test for _contains_json_schema_ref

* fix(vertex_ai): type the $ref walk over JsonValue and drop the private-helper test

* fix(vertex_ai): wrap a tool result only when a $ref holds a non-empty string

Gemini rejects {"$ref": "<name>"} in function_response.response but accepts null, empty,
numeric, boolean, object, and list values, so those tool results stay structured

* perf(vertex_ai): skip the $ref walk when the tool result text cannot spell the key

* test(vertex_ai): cover a $ref on the tool result's root object

* docs(vertex_ai): cite where the Gemini $ref rule was observed

* fix(vertex_ai): keep a $ref under a list of lists structured

Gemini accepts a $ref reached through a list nested directly in a list,
so those tool results keep their structured form. Adds the audit's
integration cells for the tool result wire, chaos and edge shapes

* test(vertex_ai): teach the fake Gemini servers the list of lists rule

The audit's scripted upstreams now skip lists inside a list like Gemini
does, add list of lists cells on every endpoint, and give the 8 MiB
timing calls their own client timeout

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-10-15 06:26:47 -07:00
..
__init__.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_context_circulation.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_function_call_args_serialization.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_gemini_image_url_missing_field.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_gemini_streaming_tool_call_finish_reason.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_grounding_requests.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_thought_signature_in_tool_call_id.py refactor: expose core private helpers under public names (#44871) 2026-10-07 00:05:27 +00:00
test_tool_call_followed_by_text_assistant.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_transformation.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00
test_vertex_ai_gemini_transformation.py fix(vertex_ai): prevent Gemini from misinterpreting $ref in tool results (#38284) 2026-10-15 06:26:47 -07:00
test_vertex_and_google_ai_studio_gemini.py fix(vertex_ai): keep Gemini cache creation token count out of request kwargs (#46152) 2026-10-12 21:19:12 -07:00
test_vertex_gemini_unbound_local_error.py refactor(llms): expose public names for private provider helpers (#45037) 2026-10-07 08:49:25 -07:00