Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions litellm/llms/bedrock/chat/converse_transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def map_openai_params(
if bedrock_tier in ("default", "flex", "priority"):
optional_params["serviceTier"] = {"type": bedrock_tier}

if param == "web_search_options" and value and isinstance(value, dict):
if param == "web_search_options" and isinstance(value, dict):
grounding_tool = self._map_web_search_options(value, model)
if grounding_tool is not None:
optional_params = self._add_tools_to_optional_params(
Expand Down Expand Up @@ -1041,10 +1041,16 @@ def _process_tools_and_beta(
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",
Expand Down Expand Up @@ -1076,6 +1082,9 @@ def _process_tools_and_beta(
# 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
Expand Down
26 changes: 22 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ orjson = {version = "^3.9.7", optional = true}
apscheduler = {version = "^3.10.4", optional = true}
fastapi-sso = { version = "^0.16.0", optional = true }
PyJWT = { version = "^2.10.1", optional = true, python = ">=3.9" }
python-multipart = { version = "^0.0.22", optional = true}
python-multipart = { version = "^0.0.22", optional = true, python = ">=3.10"}
cryptography = {version = "*", optional = true}
prisma = {version = "0.11.0", optional = true}
azure-identity = {version = "^1.15.0", optional = true, python = ">=3.9"}
Expand Down
Loading