fix: remove double-wrapping of tools_cachepoint_config in _format_tools#3197
Closed
SyedShahmeerAli12 wants to merge 1 commit intodeepset-ai:mainfrom
Closed
Conversation
`__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
Contributor
Coverage report (amazon_bedrock)Click to see where and how coverage changed
This report was generated by python-coverage-comment-action |
||||||||||||||||||||||||
Member
|
Sorry @SyedShahmeerAli12, your fix was right but I merged #3199 because it also contained an additional test. Thank you again! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3181
AmazonBedrockChatGenerator.__init__calls_validate_and_format_cache_pointwhich wraps{"type": "default"}→{"cachePoint": {"type": "default"}}and stores it asself.tools_cachepoint_config_format_toolswas then wrapping it a second time, producing{"cachePoint": {"cachePoint": {"type": "default"}}}which Bedrock rejects withParamValidationErrortools_cachepoint_configdirectly in_format_toolssince it is already in Bedrock format by the time it arrivestest_format_toolstest to pass the pre-formatted value (matching real call flow)Test plan
test_format_toolsupdated to reflect actual call flow (pre-wrapped value passed to_format_tools)