Skip to content

Conversation

emopti-jrufer
Copy link

  • Correct finish reason when stop reason is not tool_use
  • Populate finish reason for non-tool_use cases
  • Ensure multiple tool calls are output in ChatResponse

Closes gh-4374, gh-4126, gh-3251

@emopti-jrufer
Copy link
Author

Updated to set ChatResponse.Metadata.Id to the AWS Request Id and updated tests to validate.

.system(converseRequest.system())
.additionalModelRequestFields(converseRequest.additionalModelRequestFields())
.toolConfig(converseRequest.toolConfig())
.requestMetadata(converseRequest.requestMetadata())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is recently added via 45baa39.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Dropped commit.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this is missing. It was added for the ConverseRequest but the mapping to ConverseStreamRequest was missed in that commit.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emopti-jrufer oh yeah, thanks for catching that!

@emopti-jrufer
Copy link
Author

@ilayaperumalg Would you like me to create a back port PR off of the 1.0.x branch? Just trying to understand what is need to get this merged in as there are some critical issues this addresses. Most importantly the finish reason and multiple tool requests for a single tool_use stop reason not being processed in a single request.

@ilayaperumalg
Copy link
Member

@emopti-jrufer Thanks for the follow up and your willingness to get these changes into 1.0.x.

The first impression of this PR looks really good. We will target to get this merged for 1.1.0-M2. Once merged, we can co-ordinate on the back-porting into 1.0.x.,

What can make this PR ready for the merge?

While reviewing this PR, we also noticed that concurrency handling needs to be improved across - as a separate issue. Could you help with identifying specific concurrency issues related to this PR (this can help as a base for other models as well)? Thank you!

@emopti-jrufer
Copy link
Author

@ilayaperumalg I have updated the since version to reflect the targeted release. Also noticed I didn’t remove the dead code from ConvesationApiUtils.

With regard to concurrency I am glad to help and assume you are referring to the use of some of the classes in the java.util.concurrent namespace. In the case of this PR I think the issue is more of ensuring the visibility of changes to variables across multiple threads. The ConverseStreamResponseHandler documents that events will be processed sequentially however that does not mean the events will be processed on the same thread. Reviewing the changes I updated the StreamingToolCallBuilder to ensure consistency.

- Correct finish reason when stop reason is not tool_use
- Populate finish reason for non-tool_use cases
- Ensure multiple tool calls are output in ChatResponse

Closes spring-projectsgh-4374, spring-projectsgh-4126, spring-projectsgh-3251

Signed-off-by: Jared Rufer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid finish reason when max_tokens is the stop reason for Bedrock Converse Stream
3 participants