Fix bedrock ConverseStream undocumented /delta/stop_sequence#11410
Merged
Fix bedrock ConverseStream undocumented /delta/stop_sequence#11410
/delta/stop_sequence#11410Conversation
/delta/stop_sequence
dancer
approved these changes
Dec 23, 2025
Contributor
|
|
gaspar09
added a commit
that referenced
this pull request
Dec 24, 2025
…ce` (#11414) This is an automated backport of #11410 to the release-v5.0 branch. FYI @gaspar09 This backport has conflicts that need to be resolved manually. ### `git cherry-pick` output ``` Auto-merging packages/amazon-bedrock/src/bedrock-chat-language-model.test.ts CONFLICT (content): Merge conflict in packages/amazon-bedrock/src/bedrock-chat-language-model.test.ts Auto-merging packages/amazon-bedrock/src/bedrock-chat-language-model.ts CONFLICT (content): Merge conflict in packages/amazon-bedrock/src/bedrock-chat-language-model.ts error: could not apply afe9730... Fix bedrock ConverseStream undocumented `/delta/stop_sequence` (#11410) hint: After resolving the conflicts, mark them with hint: "git add/rm <pathspec>", then run hint: "git cherry-pick --continue". hint: You can instead skip this commit with "git cherry-pick --skip". hint: To abort and get back to the state before "git cherry-pick", hint: run "git cherry-pick --abort". hint: Disable this message with "git config set advice.mergeConflict false" ``` --------- Co-authored-by: Gaspar Garcia Jr <gaspar@vercel.com>
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.
background
PR #11286 attempted to expose the stop sequence from Bedrock's Converse API, but had a bug: it was reading from the wrong response path. The AWS Bedrock API actually returns the stop sequence nested under a
deltaobject:additionalModelResponseFields.delta.stop_sequence, not directly atadditionalModelResponseFields.stop_sequence.summary
Fixed stop sequence extraction to read from correct API response path
additionalModelResponseFields.stop_sequencetoadditionalModelResponseFields.delta.stop_sequencedeltawrapper inBedrockAdditionalModelResponseFieldsSchemagenerateTextandstreamTextimplementation details
The AWS Bedrock Converse API returns additional model response fields nested under a
deltaobject when usingadditionalModelResponseFieldPaths: ['/delta/stop_sequence']. The previous implementation incorrectly assumed the field would be at the top level ofadditionalModelResponseFields.Correct structure:
verification
Tested with
streamTextusingstopSequences: ['END']. ConfirmedproviderMetadata.bedrock.stopSequencenow correctly returns"END"when the stop sequence is triggered (previously returnedundefined).Fixes: #11286