Skip to content

fix: remove double-wrapping of tools_cachepoint_config in _format_tools#3197

Closed
SyedShahmeerAli12 wants to merge 1 commit intodeepset-ai:mainfrom
SyedShahmeerAli12:fix/bedrock-tools-cachepoint-double-wrap
Closed

fix: remove double-wrapping of tools_cachepoint_config in _format_tools#3197
SyedShahmeerAli12 wants to merge 1 commit intodeepset-ai:mainfrom
SyedShahmeerAli12:fix/bedrock-tools-cachepoint-double-wrap

Conversation

@SyedShahmeerAli12
Copy link
Copy Markdown
Contributor

Summary

Fixes #3181

  • AmazonBedrockChatGenerator.__init__ calls _validate_and_format_cache_point which wraps {"type": "default"}{"cachePoint": {"type": "default"}} and stores it as self.tools_cachepoint_config
  • _format_tools was then wrapping it a second time, producing {"cachePoint": {"cachePoint": {"type": "default"}}} which Bedrock rejects with ParamValidationError
  • Fix: append tools_cachepoint_config directly in _format_tools since it is already in Bedrock format by the time it arrives
  • Updated the existing test_format_tools test to pass the pre-formatted value (matching real call flow)

Test plan

  • Existing unit tests pass (291 passed)
  • test_format_tools updated to reflect actual call flow (pre-wrapped value passed to _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 deepset-ai#3181
@SyedShahmeerAli12 SyedShahmeerAli12 requested a review from a team as a code owner April 21, 2026 19:31
@SyedShahmeerAli12 SyedShahmeerAli12 requested review from sjrl and removed request for a team April 21, 2026 19:31
@github-actions github-actions Bot added integration:amazon-bedrock type:documentation Improvements or additions to documentation labels Apr 21, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Coverage report (amazon_bedrock)

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  integrations/amazon_bedrock/src/haystack_integrations/components/generators/amazon_bedrock/chat
  utils.py
Project Total  

This report was generated by python-coverage-comment-action

@anakin87 anakin87 requested review from anakin87 and removed request for sjrl April 22, 2026 07:00
@anakin87
Copy link
Copy Markdown
Member

Sorry @SyedShahmeerAli12, your fix was right but I merged #3199 because it also contained an additional test.

Thank you again!

@anakin87 anakin87 closed this Apr 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integration:amazon-bedrock type:documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AmazonBedrockChatGenerator Bug: tools_cachepoint_config causes ParamValidationError

2 participants