fix(bedrock_mantle): log additional_tools hoist at debug level

This commit is contained in:
mateo-berri 2026-07-20 19:30:26 -07:00
parent 8307e3ee32
commit 8745f355a4
2 changed files with 21 additions and 0 deletions

View file

@ -177,6 +177,12 @@ class BedrockMantleResponsesAPIConfig(BedrockMantleAuthMixin, OpenAIResponsesAPI
return input, []
remaining_input = [item for item in input if not cls._is_codex_additional_tools_item(item)]
hoisted_tools = [tool for item in additional_tools_items for tool in cls._tools_of_additional_tools_item(item)]
verbose_logger.debug(
"Bedrock Mantle Responses API: hoisting %d tool(s) out of %d 'additional_tools' input item(s) "
"into the top-level tools param (Mantle rejects that input item type).",
len(hoisted_tools),
len(additional_tools_items),
)
return remaining_input, cls._filter_unsupported_tools(hoisted_tools)
def map_openai_params(

View file

@ -495,6 +495,21 @@ class TestBedrockMantleCodexAdditionalTools:
assert body["input"] == [self._USER_MESSAGE]
assert "tools" not in body
def test_hoist_is_logged_at_debug_level(self):
from unittest.mock import patch
with patch(
"litellm.llms.bedrock_mantle.responses.transformation.verbose_logger.debug"
) as mock_debug:
self._transform(
input=[
{"type": "additional_tools", "role": "developer", "tools": self._CODEX_TOOLS},
self._USER_MESSAGE,
]
)
assert mock_debug.call_count == 1
assert "additional_tools" in str(mock_debug.call_args)
class TestBedrockMantleResponsesRegistry:
def test_registry_returns_config_for_gpt_5_5(self, local_cost_map):