Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Fix Nova grounding web_search_options={} not applying systemTool (#20044)

jquinter1985aa04fadd
diff --git a/litellm/llms/bedrock/chat/converse_transformation.py b/litellm/llms/bedrock/chat/converse_transformation.py
index d4e4d3591ba..f6d7e128580 100644
--- a/litellm/llms/bedrock/chat/converse_transformation.py
+++ b/litellm/llms/bedrock/chat/converse_transformation.py
@@ -1081,10 +1081,16 @@ class AmazonConverseConfig(BaseConfig):
user_betas = get_anthropic_beta_from_headers(headers)
anthropic_beta_list.extend(user_betas)
- # Filter out tool search tools - Bedrock Converse API doesn't support them
+ # Separate pre-formatted Bedrock tools (e.g. systemTool from web_search_options)
+ # from OpenAI-format tools that need transformation via _bedrock_tools_pt
filtered_tools = []
+ pre_formatted_tools: List[ToolBlock] = []
if original_tools:
for tool in original_tools:
+ # Already-formatted Bedrock tools (e.g. systemTool for Nova grounding)
+ if "systemTool" in tool:
+ pre_formatted_tools.append(tool)
+ continue
tool_type = tool.get("type", "")
if tool_type in (
"tool_search_tool_regex_20251119",
@@ -1116,6 +1122,9 @@ class AmazonConverseConfig(BaseConfig):
# No computer use tools, process all tools as regular tools
bedrock_tools = _bedrock_tools_pt(filtered_tools)
+ # Append pre-formatted tools (systemTool etc.) after transformation
+ bedrock_tools.extend(pre_formatted_tools)
+
# Set anthropic_beta in additional_request_params if we have any beta features
# ONLY apply to Anthropic/Claude models - other models (e.g., Qwen, Llama) don't support this field
# and will error with "unknown variant anthropic_beta" if included
diff --git a/poetry.lock b/poetry.lock
index 537367c5aa0..3b2a8d20f20 100644
--- a/poetry.lock
+++ b/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 2.2.0 and should not be changed by hand.
+# This file is automatically @generated by Poetry 2.1.4 and should not be changed by hand.
[[package]]
name = "a2a-sdk"
@@ -5704,6 +5704,24 @@ pytest = ">=7.0.0"
[package.extras]
dev = ["black", "flake8", "isort", "mypy"]
+[[package]]
+name = "pytest-retry"
+version = "1.7.0"
+description = "Adds the ability to retry flaky tests in CI environments"
+optional = false
+python-versions = ">=3.9"
+groups = ["dev"]
+files = [
+ {file = "pytest_retry-1.7.0-py3-none-any.whl", hash = "sha256:a2dac85b79a4e2375943f1429479c65beb6c69553e7dae6b8332be47a60954f4"},
+ {file = "pytest_retry-1.7.0.tar.gz", hash = "sha256:f8d52339f01e949df47c11ba9ee8d5b362f5824dff580d3870ec9ae0057df80f"},
+]
+
+[package.dependencies]
+pytest = ">=7.0.0"
+
+[package.extras]
+dev = ["black", "flake8", "isort", "mypy"]
+
[[package]]
name = "python-dateutil"
version = "2.9.0.post0"