mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-29 01:03:17 +00:00
* fix(vertex_ai): keep web search next to function tools on Gemini 3+ Gemini 3+ accepts googleSearch, urlContext and the other search tools in the same request as function declarations, so stop dropping them there. Vertex takes both with no extra flag. The AI Studio route sets include_server_side_tool_invocations itself when the final tools mix both kinds, merged with any tool_choice toolConfig. Gemini 2.x and numeric fine-tuned Vertex ids still drop the search tools as before * feat(responses): report Gemini web searches as web_search_call items Gemini 3 reports the searches it ran as GOOGLE_SEARCH toolCall parts and in groundingMetadata.webSearchQueries. Each distinct query now becomes a completed web_search_call output item on /v1/responses, toolCall queries first, with an id built from the response id and the query so streaming and non-streaming agree. Non-streaming puts them before the message. Streaming emits them when they arrive and includes them in response.completed Billing counts the same distinct queries, so a response that reports its searches only as toolCall parts now bills them too. Anthropic behavior is unchanged * fix(vertex_ai): stream Gemini 3+ web searches before the answer on Vertex too * fix(vertex_ai): keep the old search drop where Gemini 3+ cannot mix search with functions Gemini 3+ models the cost map marks without function calling, like the image and Lyria models, answered 200 with search dropped before and 400 with both kept, so they keep the old drop. A caller who sends include_server_side_tool_invocations false keeps it too Under drop_params, googleSearchRetrieval next to functions now drops on Gemini 3+ instead of reaching Google and failing with a 400 Streamed searches that share a chunk with the first text or thought now open before it, so output_item.added events keep the output order * fix(vertex_ai): drop googleSearchRetrieval when the caller sets the flag, and close reasoning before searches Under drop_params, a Gemini 3+ request that already sets include_server_side_tool_invocations now drops googleSearchRetrieval like one that does not. The keep path ran after the caller-flag early return, so the retrieval tool went to Google as given A streamed /v1/responses call announces searches before opening the first output item only when that chunk opens it. Otherwise searches queue after the reasoning item closes, so a thought chunk followed by a searches-and-text chunk no longer closes the reasoning item after the searches The opt-out reads only include_server_side_tool_invocations, since the camelCase spelling never reaches map_openai_params through completion or the proxy * test(vertex_ai): cover the sync stream order and simplify the search-tool checks The sync /v1/responses stream now runs the same chunk-sharing cases as the async one, so a search that shares a chunk with the first output must open before it on both paths The cost-map lookup checks the route row and the bare model only, the retrieval check reads the camelCase key that reaches it, and the tests now cover a missing cost-map row, an opt-out set in optional_params, and drop_params set globally * fix(vertex_ai): read search-with-functions support from the cost map and count searches from tool calls Gemini models keep search tools next to function declarations only when their cost-map row sets supports_search_tools_with_functions. Search items and web_search_requests now come from the server-side tool call queries and fall back to groundingMetadata.webSearchQueries only when no tool call reported one, since Vertex repeats each tool call query in grounding without its site: operators. * fix(gemini): keep googleSearchRetrieval only for the caller flag, honor camelCase opt-out, bill cyber searches per query, stream reasoning before searches Gemini 3+ drops googleSearchRetrieval next to function tools again unless the caller set include_server_side_tool_invocations without drop_params, so a request that answered 200 before never turns into a 400. The camelCase includeServerSideToolInvocations false now keeps the old drop. Both gemini-3.8-flash-cyber rows bill search per query like gemini-3.8-flash. Search call ids hash the query with a per-process HMAC key. Streamed Responses output now opens reasoning before search items, matching the non-streamed order. * fix(gemini): honor includeServerSideToolInvocations false sent through completion The camelCase flag reaches optional_params only after map_openai_params runs, so the earlier opt-out check never saw it and Gemini 3+ still kept search tools next to function tools. transform_request_body now reads the flag it pops, drops the search tools with the old warning, and leaves toolConfig without includeServerSideToolInvocations. The regression test goes through get_optional_params like completion does * fix(gemini): drop search next to functions when tool_choice forces a call, give cyber rows the Gemini 3 search free tier * fix(gemini): drop search next to functions when tool_choice is none A tool_choice of none maps to functionCallingConfig mode NONE, which Gemini applies to function declarations only, so a kept googleSearch or urlContext could still run. Gemini 3+ now keeps the old drop for none, like it does for required and a named function. * fix(gemini): keep the old search drop when an extra_body tool config opts out A caller toolConfig or tool_config in extra_body that turns includeServerSideToolInvocations off, or pins functionCallingConfig mode to ANY or NONE, now drops search tools next to functions the way tool_choice does, instead of sending them and failing on AI Studio * fix(gemini): put the server-side tool flag in the context cache with the search tools When a cache_control message and mixed search and function tools reach a Gemini 3+ model, the cache step built the cached content from the raw tools and then sent toolConfig next to cachedContent, which Google rejects with a 400 The tool fields are now settled before the cache step, so the cached content carries the search tool, the function tools and the includeServerSideToolInvocations flag, and the generateContent call beside cachedContent carries neither. A caller who turns server-side tools off still caches the functions without search * fix(guardrails): scan Gemini web search queries in /v1/responses output like Claude's Gemini web_search_call items now carry a gsearch_ tool id, so the Responses guardrail handler and the Cato, Cisco and Purview hooks scan their queries the same way they scan Claude's hosted searches. Native OpenAI search calls stay untouched. * fix(vertex_ai): scope Gemini search call id hashes to their response The id suffix hashed only the query, so the same query got the same suffix in every response one worker served. Hash the response id with the query so ids differ across responses and stay stable within one --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| chat | ||
| completion | ||
| decisions | ||
| embeddings | ||
| evals | ||
| image_generation | ||
| image_variations | ||
| live | ||
| realtime | ||
| responses | ||
| speech | ||
| transcriptions | ||
| vector_store_files | ||
| vector_stores | ||
| videos | ||
| __init__.py | ||
| test_cost_calculation.py | ||
| test_data_residency.py | ||
| test_gpt_reasoning_transformation.py | ||
| test_is_model_gpt_5_model.py | ||
| test_o_series_transformation.py | ||
| test_openai.py | ||
| test_openai_audio_speech.py | ||
| test_openai_authentication_error.py | ||
| test_openai_common_utils.py | ||
| test_openai_empty_response.py | ||
| test_openai_file_content_streaming.py | ||
| test_openai_image_edit_transformation.py | ||
| test_openai_workload_identity.py | ||
| test_organization_costs.py | ||
| test_use_chat_completions_api_no_leak.py | ||