mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-24 22:09:56 +00:00
* fix(websearch_interception): answer from gathered results on the last follow-up the loop cap allows When a web search turn reached max_agentic_loops, the last follow-up still offered the search tool, so the model asked for one more search, the loop refused it, and the user got no answer (an empty end_turn on /v1/messages and a dangling litellm_web_search call on chat and responses). The follow-up the cap allows last now drops the intercepted search tool and keeps client tools. When no tools remain it sends tool_choice none, because Claude otherwise calls the search tool it saw in the history. This applies to anthropic, azure_ai, vertex_ai, openai and gemini, the providers probed live. Bedrock and other providers keep today's behavior. The deployment hook now passes the callback's max_agentic_loops into the call, so the dispatchers and the builder agree on the ceiling. Chat follow-ups carry the loop depth in litellm_metadata, so the openai and http chat paths can see it. * fix(websearch_interception): answer a capped turn with a max_uses_exceeded result and one last call without search Claude ended a capped turn with no text when the last allowed follow-up simply dropped the search tool, since it still wanted to search. The dispatchers now let a callback that opts in through answers_tool_calls_at_agentic_loop_cap run once more at the cap. The websearch hook answers the refused search calls with a max_uses_exceeded search result instead of searching, and sends one last call without the search tool (client tools kept, tool_choice none when nothing is left). Bedrock is not opted in and keeps the old refusal. The three per-surface search loops are now one helper. * fix(anthropic messages): keep the client's max_tokens on every agentic follow-up The request transform popped max_tokens off the params dict the agentic hooks read afterwards, so every /v1/messages follow-up fell back to 1024 and a capped turn could stop at max_tokens before answering. The handler now gives the transform its own copy. * fix(websearch_interception): keep the allowed_tools limit on the capped call and strip loop controls from client metadata * fix(websearch): keep the capped last call from searching again or calling a forced client tool The refused search now tells the model to answer from the results it has. If the last call at the cap still asks for a search, the chat and Responses gates claim it so the loop ends the turn with that call removed instead of handing the client a tool it never declared. A tool_choice that forces some tool is relaxed to auto on that call, while a choice naming one client tool stays. ARCHITECTURE.md now says the feature-level cap covers all three routes and which providers get the last call * docs(websearch_interception): say the loop cap counts rounds of searching, not single searches * fix(websearch_interception): keep the one-tool-call limit and drop parallel_tool_calls on the last call at the cap The tool-free last chat call no longer sends parallel_tool_calls, which OpenAI rejects without tools A forced choice relaxed to auto keeps disable_parallel_tool_use on /v1/messages, and a choice forcing the search tool becomes auto instead of being dropped /v1/messages drops a search call the capped call still made, like chat and Responses already do The chat capped call reads the request's tool_choice the same way the other routes do * fix(azure_ai): drop tool_choice when a chat request has no tools, as the OpenAI config does * fix(websearch_interception): keep the feature-level max_agentic_loops on /v1/messages only, as on main Chat and Responses read the deployment's own max_agentic_loops or the default of 3. Applying the feature-level value there ended turns empty on Bedrock and other providers outside the answer-at-cap list once it was below 3 * test(websearch_interception): type the cap-source parameters of the chat and Responses cap tests --------- Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| host | ||
| messages | ||
| ocr | ||
| trace | ||
| __init__.py | ||
| AGENTS.md | ||
| native_route_wheel_test.py | ||
| stubtest.ini | ||
| test_bindings.py | ||
| test_catalog.py | ||
| test_clickhouse.py | ||
| test_configuration.py | ||
| test_detectors.py | ||
| test_execution.py | ||
| test_failures.py | ||
| test_fork_guard.py | ||
| test_logger.py | ||
| test_public_call.py | ||
| test_runtime.py | ||
| test_token_counter.py | ||
| test_tokenizer.py | ||
| test_verify_linux_native_wheel.py | ||