fix(bedrock_mantle): stop dropping the web_search tool on /v1/responses - #35987
fix(bedrock_mantle): stop dropping the web_search tool on /v1/responses#35987devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Greptile SummaryThe PR enables Bedrock Mantle web search on the Responses API and advertises that capability for five GPT models.
Confidence Score: 4/5The model-specific forwarding gap should be fixed before merging because unsupported Mantle models can now receive web-search tools. The transformation promotes web_search into a provider-wide allowlist even though the accompanying metadata and PR contract restrict support to five models, and no model-level capability check occurs before forwarding. Files Needing Attention: litellm/llms/bedrock_mantle/responses/transformation.py
|
| Filename | Overview |
|---|---|
| litellm/llms/bedrock_mantle/responses/transformation.py | Enables web_search globally in the Mantle adapter, but does not restrict forwarding to models whose metadata advertises the capability. |
| model_prices_and_context_window.json | Correctly advertises web-search support on the five intended Mantle GPT entries. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the capability metadata changes in the packaged fallback model map. |
| tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py | Covers supported models and both forwarding paths, but does not cover retaining rejection for a Responses-capable unsupported model. |
Reviews (1): Last reviewed commit: "fix(bedrock_mantle): stop dropping the w..." | Re-trigger Greptile
| _BEDROCK_MANTLE_SUPPORTED_RESPONSE_TOOL_TYPES: Final = frozenset( | ||
| {"function", "mcp", "custom", "namespace", "tool_search", "web_search"} | ||
| ) |
There was a problem hiding this comment.
Web search bypasses model capability
When a Responses-capable Mantle model outside the five flagged GPT models receives a web_search tool, this provider-wide allowlist forwards it without checking supports_web_search, causing Mantle to reject the unsupported request instead of filtering the tool.
Rule Used: What: Do not hardcode model-specific flags in the ... (source)
Knowledge Base Used: LLM Provider Adapters
There was a problem hiding this comment.
Tried that: the remote cost map lags releases, so gating on supports_web_search silently disabled Web Search live. Mantle itself 400s with "Tool type 'web_search' is not supported for model".
There was a problem hiding this comment.
That's a fair point. The failure mode split here is:
- Gating on
supports_web_search: cost-map lag silently dropsweb_searchon newly-supported models until the JSON is updated — same broken-but-quiet behavior as before this PR. - Allowlist approach (this PR): unsupported Mantle models get an explicit 400 from the server, which is noisier but honest.
A server-side 400 is strictly better UX than an ungrounded answer with no error, so the trade-off is reasonable.
I withdraw the concern.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
c50debd to
26805f7
Compare
|
@mateo-berri curious on any ETA on when this PR will be merged? |
^ My team wants to use Litellm but we are waiting for this change |
TLDR
Problem this solves:
/v1/responsesbedrock_mantlesilently dropped theweb_searchtoolHow it solves it:
web_searchthrough the Mantle tool filterRelevant issues
Linear ticket
Resolves LIT-5224
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Live proxy against real Bedrock Mantle in us-east-1, same request both times, only the checked out commit differs
Before, on
litellm_internal_stagingat2a9843e649, HTTP 200 and an ungrounded answer:with the proxy log confirming the drop:
After, on this branch at
26805f75fe, Bedrock runs the searches server side:and the outbound body keeps the tool with its option intact:
Only
/v1/responsesis in scope here, Bedrock exposes Web Search as a Responses built-in tool andbedrock_mantlegpt-5.x is Responses onlyType
🐛 Bug Fix
Changes
BedrockMantleResponsesAPIConfigfilters the Responsestoolsarray against an allowlist of tool types Mantle accepts, andweb_searchpredates AWS shipping it, somap_openai_paramsdropped it before the request went out. Web Search on Amazon Bedrock went GA on 2026-08-04 as a server-side built-in tool on the OpenAI Responses path for GPT-5.4, GPT-5.5 and GPT-5.6 Sol/Terra/Luna, so the tool now stays in the payload with itsexternal_web_accessfield untouched, both for a top-leveltoolsentry and for one hoisted out of a Codexadditional_toolsinput itemThe five GPT entries in the cost map also gain
supports_web_search: truesolitellm.supports_web_search()and the router's web-search-aware filtering see the capability. Nothing else in the Mantle lineup gets the flag, since AWS scopes Web Search to those modelsFour existing tests used
web_searchas their stand-in for an unsupported tool type, so they now usefile_search, which Mantle really does reject and which this config already declares unsupportedNot in this PR: cost tracking for the searches AWS bills at $12 per 1,000 queries. The run above issued four
web_search_callitems in one response, and the generic built-in tool path prices a response offsearch_context_cost_per_queryonce, not per query, so metering this properly needs its own changeFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/56ac33bc3eb44a15a96c7022683ff161
Requested by: @mateo-berri