Skip to content

Is the Bedrock Converse API response able to indicate which of the stopSequences was the stopReason?

0

When using the converse API, multiple stopSequences can be provided. When the response comes back, I would like to be able to tell which of those stopSequences was responsible if the stopReason is "stop_sequence". With invokeModel, at least for the Claude series of models, the particular sequence causing the "stop_sequence" is provided in the response. From what I can tell, converse does not supply this information. Is it something planned for converse, or do not enough models support that for it to be included (or is there a good way to get the stop sequence that I just haven't found)?

asked 2 years ago1.3K views

1 Answer
0

Based on the available information about the Amazon Bedrock Converse API, it does not appear that the API currently provides the specific stop sequence that caused the model to stop generating content when multiple stop sequences are provided.

The Converse API response includes a stopReason field in the metrics, which can indicate that the model stopped due to a stop sequence being encountered. However, the API does not seem to specify which particular stop sequence from the provided list was responsible for halting the generation.

This level of detail about which specific stop sequence was triggered is not mentioned in the documentation for the Converse API response structure. The response typically includes the generated message, usage metrics (such as token counts), and general stop reasons, but does not appear to offer the granularity of identifying the exact stop sequence that was encountered.

It's worth noting that the behavior you described for the invokeModel API with Claude models, where the specific stop sequence is provided, is not mentioned as a feature of the Converse API. This could be due to the Converse API being designed to work across multiple model types, and not all models may support or provide this level of detail in their responses.

If this feature is important for your use case, you might want to check for updates to the Converse API documentation or consider reaching out to AWS support to inquire about future plans for including this information in the API response. Alternatively, you may need to implement your own logic to determine which stop sequence was likely triggered based on the model's output.
Sources
Using the Converse API - Amazon Bedrock

answered 2 years ago

AWS
EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.