Skip to content

Commit 6b0993d

Browse files
fix: remove double-wrapping of tools_cachepoint_config in _format_tools
`__init__` already calls `_validate_and_format_cache_point` which wraps the user-supplied `{"type": "default"}` into `{"cachePoint": {"type": "default"}}`. `_format_tools` was then wrapping it a second time, producing a nested `{"cachePoint": {"cachePoint": {...}}}` that Bedrock rejects with ParamValidationError. Fixes #3181
1 parent 35c9bef commit 6b0993d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ def _format_tools(
9393
)
9494

9595
if tools_cachepoint_config:
96-
tool_specs.append({"cachePoint": tools_cachepoint_config})
96+
tool_specs.append(tools_cachepoint_config)
9797

9898
return {"tools": tool_specs}
9999

integrations/amazon_bedrock/tests/test_chat_generator_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def tools():
6767

6868
class TestAmazonBedrockChatGeneratorUtils:
6969
def test_format_tools(self, tools):
70-
formatted_tool = _format_tools(tools, tools_cachepoint_config={"type": "default"})
70+
formatted_tool = _format_tools(tools, tools_cachepoint_config={"cachePoint": {"type": "default"}})
7171
assert formatted_tool == {
7272
"tools": [
7373
{

0 commit comments

Comments
 (0)