Preserve tool schema property order in Converse API - #6705
Open
yyyCode wants to merge 1 commit into
Open
Conversation
ConverseApiUtils#convertMapToDocument collected map entries with a plain Collectors.toMap, which returns a HashMap and discards the insertion order of the source map. As a result, the properties of a tool's inputSchema were sent to Bedrock in an arbitrary order instead of the declared order. Collect into a LinkedHashMap to preserve the declaration order. Fixes spring-projects#6696 Signed-off-by: yqz <2678785492@qq.com>
Contributor
Author
|
@rozza Could I get a quick approve to kick off the CI tests? Thanks! |
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.
ConverseApiUtils#convertMapToDocumentcollected map entries with a plainCollectors.toMap(...), which returns aHashMapand therefore discards the insertion order of the source map (preserved by Jackson as aLinkedHashMap).As a result, the
propertiesof a tool'sinputSchemawere sent to Bedrock in an arbitrary,hashCode-driven order instead of the declared order.This change collects into a
LinkedHashMapso the declaration order is preserved, and adds a test covering both top-level and nested maps.Fixes #6696