fix(aws): Handle thinking with tools, use CountTokens API for Haiku 4.5 #698
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.
Couple of updates to ChatBedrock/ChatBedrockConverse for Haiku 4.5 support:
get_num_tokens_from_messages()
.bind_tools()
andwith_structured_output()
, as Haiku (and Sonnet) 4.5 still do not support this.test_structured_output_tool_choice_not_supported
Converse integration test has not been updated to include Haiku 4.5, which appears to behave very inconsistently with a structured output schema compared to previous Claude thinking models. Sonnet 4.5 and older models produce a tool call 100% of the time if the query is directly applicable to the schema. However, on Haiku 4.5, the chance of this happening was observed to be <5%.