Sends messages to the specified Amazon Bedrock model. Converse provides a consistent interface that works with all models that support messages. This allows you to write code once and use it with different models. If a model has unique inference parameters, you can also pass those unique parameters to the model.
Amazon Bedrock doesn't store any text, images, or documents that you provide as content. The data is only used to generate the response.
You can submit a prompt by including it in the messages field, specifying the modelId of a foundation model or inference profile to run inference on it, and including any other fields that are relevant to your use case.
You can also submit a prompt from Prompt management by specifying the ARN of the prompt version and including a map of variables to values in the promptVariables field. You can append more messages to the prompt by using the messages field. If you use a prompt from Prompt management, you can't include the following fields in the request: additionalModelRequestFields, inferenceConfig, system, or toolConfig. Instead, these fields must be defined through Prompt management. For more information, see Test a prompt using Prompt management.
For information about the Converse API, see Use the Converse API. To use a guardrail, see Use a guardrail with the Converse API. To use a tool with a model, see Tool use (Function calling).
For example code, see Converse API examples.
This operation requires permission for the bedrock:InvokeModel action.
POST /model/modelId/converse HTTP/1.1
Content-type: application/json
{
"additionalModelRequestFields": JSON value,
"additionalModelResponseFieldPaths": [ "string" ],
"guardrailConfig": {
"guardrailIdentifier": "string",
"guardrailVersion": "string",
"trace": "string"
},
"inferenceConfig": {
"maxTokens": number,
"stopSequences": [ "string" ],
"temperature": number,
"topP": number
},
"messages": [
{
"content": [
{ ... }
],
"role": "string"
}
],
"performanceConfig": {
"latency": "string"
},
"promptVariables": {
"string" : { ... }
},
"requestMetadata": {
"string" : "string"
},
"system": [
{ ... }
],
"toolConfig": {
"toolChoice": { ... },
"tools": [
{ ... }
]
}
}The request uses the following URI parameters.
Specifies the model or throughput with which to run inference, or the prompt resource to use in inference. The value depends on the resource that you use:
-
If you use a base model, specify the model ID or its ARN. For a list of model IDs for base models, see Amazon Bedrock base model IDs (on-demand throughput) in the Amazon Bedrock User Guide.
-
If you use an Amazon Bedrock Marketplace model, specify the ID or ARN of the marketplace endpoint that you created. For more information about Amazon Bedrock Marketplace and setting up an endpoint, see Amazon Bedrock Marketplace in the Amazon Bedrock User Guide.
-
If you use an inference profile, specify the inference profile ID or its ARN. For a list of inference profile IDs, see Supported Regions and models for cross-region inference in the Amazon Bedrock User Guide.
-
If you use a prompt created through Prompt management, specify the ARN of the prompt version. For more information, see Test a prompt using Prompt management.
-
If you use a provisioned model, specify the ARN of the Provisioned Throughput. For more information, see Run inference using a Provisioned Throughput in the Amazon Bedrock User Guide.
-
If you use a custom model, first purchase Provisioned Throughput for it. Then specify the ARN of the resulting provisioned model. For more information, see Use a custom model in Amazon Bedrock in the Amazon Bedrock User Guide.
Length Constraints: Minimum length of 1. Maximum length of 2048.
Pattern:
^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:(([0-9]{12}:custom-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}/[a-z0-9]{12})|(:foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|([0-9]{12}:imported-model/[a-z0-9]{12})|([0-9]{12}:provisioned-model/[a-z0-9]{12})|([0-9]{12}:(inference-profile|application-inference-profile)/[a-zA-Z0-9-:.]+)))|([a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}))|(([0-9a-zA-Z][_-]?)+)|([a-zA-Z0-9-:.]+)|(^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:prompt/[0-9a-zA-Z]{10}(?::[0-9]{1,5})?))$|(^arn:aws:sagemaker:[a-z0-9-]+:[0-9]{12}:endpoint/[a-zA-Z0-9-]+$)|(^arn:aws(-[^:]+)?:bedrock:([0-9a-z-]{1,20}):([0-9]{12}):(default-)?prompt-router/[a-zA-Z0-9-:.]+$)$
Required: Yes
The request accepts the following data in JSON format.
Additional inference parameters that the model supports, beyond the base set of inference parameters that Converse and ConverseStream support in the inferenceConfig field. For more information, see Model parameters.
Type: JSON value
Required: No
additionalModelResponseFieldPaths
Additional model parameters field paths to return in the response. Converse and ConverseStream return the requested fields as a JSON Pointer object in the additionalModelResponseFields field. The following is example JSON for additionalModelResponseFieldPaths.
["/stop_sequence"]For information about the JSON Pointer syntax, see the Internet Engineering Task Force (IETF) documentation.
Converse and ConverseStream reject an empty JSON Pointer or incorrectly structured JSON Pointer with a 400 error code. If the JSON Pointer is valid, but the requested field is not in the model response, it is ignored by Converse.
Type: Array of strings
Array Members: Minimum number of 0 items. Maximum number of 10 items.
Length Constraints: Minimum length of 1. Maximum length of 256.
Required: No
Configuration information for a guardrail that you want to use in the request. If you include guardContent blocks in the content field in the messages field, the guardrail operates only on those messages. If you include no guardContent blocks, the guardrail operates on all messages in the request body and in any included prompt resource.
Type: GuardrailConfiguration object
Required: No
Inference parameters to pass to the model. Converse and ConverseStream support a base set of inference parameters. If you need to pass additional parameters that the model supports, use the additionalModelRequestFields request field.
Type: InferenceConfiguration object
Required: No
The messages that you want to send to the model.
Type: Array of Message objects
Required: No
Model performance settings for the request.
Type: PerformanceConfiguration object
Required: No
Contains a map of variables in a prompt from Prompt management to objects containing the values to fill in for them when running model invocation. This field is ignored if you don't specify a prompt resource in the modelId field.
Type: String to PromptVariableValues object map
Required: No
Key-value pairs that you can use to filter invocation logs.
Type: String to string map
Map Entries: Maximum number of 16 items.
Key Length Constraints: Minimum length of 1. Maximum length of 256.
Key Pattern: ^[a-zA-Z0-9\s:_@$#=/+,-.]{1,256}$
Value Length Constraints: Minimum length of 0. Maximum length of 256.
Value Pattern: ^[a-zA-Z0-9\s:_@$#=/+,-.]{0,256}$
Required: No
A prompt that provides instructions or context to the model about the task it should perform, or the persona it should adopt during the conversation.
Type: Array of SystemContentBlock objects
Required: No
Configuration information for the tools that the model can use when generating a response.
For information about models that support tool use, see Supported models and model features.
Type: ToolConfiguration object
Required: No
HTTP/1.1 200
Content-type: application/json
{
"additionalModelResponseFields": JSON value,
"metrics": {
"latencyMs": number
},
"output": { ... },
"performanceConfig": {
"latency": "string"
},
"stopReason": "string",
"trace": {
"guardrail": {
"actionReason": "string",
"inputAssessment": {
"string" : {
"contentPolicy": {
"filters": [
{
"action": "string",
"confidence": "string",
"detected": boolean,
"filterStrength": "string",
"type": "string"
}
]
},
"contextualGroundingPolicy": {
"filters": [
{
"action": "string",
"detected": boolean,
"score": number,
"threshold": number,
"type": "string"
}
]
},
"invocationMetrics": {
"guardrailCoverage": {
"images": {
"guarded": number,
"total": number
},
"textCharacters": {
"guarded": number,
"total": number
}
},
"guardrailProcessingLatency": number,
"usage": {
"contentPolicyImageUnits": number,
"contentPolicyUnits": number,
"contextualGroundingPolicyUnits": number,
"sensitiveInformationPolicyFreeUnits": number,
"sensitiveInformationPolicyUnits": number,
"topicPolicyUnits": number,
"wordPolicyUnits": number
}
},
"sensitiveInformationPolicy": {
"piiEntities": [
{
"action": "string",
"detected": boolean,
"match": "string",
"type": "string"
}
],
"regexes": [
{
"action": "string",
"detected": boolean,
"match": "string",
"name": "string",
"regex": "string"
}
]
},
"topicPolicy": {
"topics": [
{
"action": "string",
"detected": boolean,
"name": "string",
"type": "string"
}
]
},
"wordPolicy": {
"customWords": [
{
"action": "string",
"detected": boolean,
"match": "string"
}
],
"managedWordLists": [
{
"action": "string",
"detected": boolean,
"match": "string",
"type": "string"
}
]
}
}
},
"modelOutput": [ "string" ],
"outputAssessments": {
"string" : [
{
"contentPolicy": {
"filters": [
{
"action": "string",
"confidence": "string",
"detected": boolean,
"filterStrength": "string",
"type": "string"
}
]
},
"contextualGroundingPolicy": {
"filters": [
{
"action": "string",
"detected": boolean,
"score": number,
"threshold": number,
"type": "string"
}
]
},
"invocationMetrics": {
"guardrailCoverage": {
"images": {
"guarded": number,
"total": number
},
"textCharacters": {
"guarded": number,
"total": number
}
},
"guardrailProcessingLatency": number,
"usage": {
"contentPolicyImageUnits": number,
"contentPolicyUnits": number,
"contextualGroundingPolicyUnits": number,
"sensitiveInformationPolicyFreeUnits": number,
"sensitiveInformationPolicyUnits": number,
"topicPolicyUnits": number,
"wordPolicyUnits": number
}
},
"sensitiveInformationPolicy": {
"piiEntities": [
{
"action": "string",
"detected": boolean,
"match": "string",
"type": "string"
}
],
"regexes": [
{
"action": "string",
"detected": boolean,
"match": "string",
"name": "string",
"regex": "string"
}
]
},
"topicPolicy": {
"topics": [
{
"action": "string",
"detected": boolean,
"name": "string",
"type": "string"
}
]
},
"wordPolicy": {
"customWords": [
{
"action": "string",
"detected": boolean,
"match": "string"
}
],
"managedWordLists": [
{
"action": "string",
"detected": boolean,
"match": "string",
"type": "string"
}
]
}
}
]
}
},
"promptRouter": {
"invokedModelId": "string"
}
},
"usage": {
"cacheReadInputTokens": number,
"cacheWriteInputTokens": number,
"inputTokens": number,
"outputTokens": number,
"totalTokens": number
}
}If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in JSON format by the service.
Additional fields in the response that are unique to the model.
Type: JSON value
Metrics for the call to Converse.
Type: ConverseMetrics object
The result from the call to Converse.
Type: ConverseOutput object
Note: This object is a Union. Only one member of this object can be specified or returned.
Model performance settings for the request.
Type: PerformanceConfiguration object
The reason why the model stopped generating output.
Type: String
Valid Values: end_turn | tool_use | max_tokens | stop_sequence | guardrail_intervened | content_filtered
A trace object that contains information about the Guardrail behavior.
Type: ConverseTrace object
The total number of tokens used in the call to Converse. The total includes the tokens input to the model and the tokens generated by the model.
Type: TokenUsage object
For information about the errors that are common to all actions, see Common Errors.
The request is denied because you do not have sufficient permissions to perform the requested action. For troubleshooting this error, see AccessDeniedException in the Amazon Bedrock User Guide.
HTTP Status Code: 403
An internal server error occurred. For troubleshooting this error, see InternalFailure in the Amazon Bedrock User Guide.
HTTP Status Code: 500
The request failed due to an error while processing the model.
HTTP Status Code: 424
The model specified in the request is not ready to serve inference requests. The AWS SDK will automatically retry the operation up to 5 times. For information about configuring automatic retries, see Retry behavior in the AWS SDKs and Tools reference guide.
HTTP Status Code: 429
The request took too long to process. Processing time exceeded the model timeout length.
HTTP Status Code: 408
The specified resource ARN was not found. For troubleshooting this error, see ResourceNotFound in the Amazon Bedrock User Guide.
HTTP Status Code: 404
The service isn't currently available. For troubleshooting this error, see ServiceUnavailable in the Amazon Bedrock User Guide.
HTTP Status Code: 503
Your request was denied due to exceeding the account quotas for Amazon Bedrock. For troubleshooting this error, see ThrottlingException in the Amazon Bedrock User Guide.
HTTP Status Code: 429
The input fails to satisfy the constraints specified by Amazon Bedrock. For troubleshooting this error, see ValidationError in the Amazon Bedrock User Guide.
HTTP Status Code: 400
ConverseStream works almost exactly like Converse on the input side (same modelId, messages, inferenceConfig, toolConfig, etc.), but returns an incremental stream of events instead of one big JSON blob.
If you already know Converse, here’s all you need to get started with streaming.
POST /model/{modelId}/converse-stream HTTP/1.1
Content-Type: application/json• IAM action: bedrock:InvokeModelWithResponseStream
• To deny streaming and non-streaming: deny both bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream
Use the same fields as Converse, with these differences:
• guardrailConfig
Type: GuardrailStreamConfiguration (adds optional streamProcessingMode: string)
• All other fields (additionalModelRequestFields, inferenceConfig, messages, system, toolConfig, etc.) are identical—refer to the Converse docs.
Example skeleton:
{
"additionalModelRequestFields": { … },
"additionalModelResponseFieldPaths": ["/foo","/bar"],
"guardrailConfig": {
"guardrailIdentifier": "…",
"guardrailVersion": "…",
"streamProcessingMode": "…", ← new
"trace": "…"
},
"inferenceConfig": { … },
"messages": [ … ],
"performanceConfig": { … },
"promptVariables": { … },
"requestMetadata": { … },
"system": [ … ],
"toolConfig": { … }
}Instead of one JSON document, you’ll receive an HTTP/2 or SSE stream of discrete JSON events. Handle each event by its top-level key:
-
messageStart
Type:MessageStartEvent
Fields:
•role(string) -
contentBlockStart
Type:ContentBlockStartEvent
Fields:
•contentBlockIndex(number)
•start(ContentBlock– identical to the blocks inConverseOutput) -
contentBlockDelta
Type:ContentBlockDeltaEvent
Fields:
•contentBlockIndex(number)
•delta(ContentBlock– partial content chunk) -
contentBlockStop
Type:ContentBlockStopEvent
Fields:
•contentBlockIndex(number) -
messageStop
Type:MessageStopEvent
Fields:
•additionalModelResponseFields(JSON value)
•stopReason(string:end_turn | tool_use | max_tokens | stop_sequence | guardrail_intervened | content_filtered) -
metadata
Type:ConverseStreamMetadataEvent
Fields:
•metrics(ConverseMetrics)
•performanceConfig(PerformanceConfiguration)
•trace(ConverseTrace)
•promptRouter(PromptRouter)
•usage(TokenUsage) -
Error Events (each terminates the stream)
•modelStreamErrorException(HTTP 424)
•serviceUnavailableException(HTTP 503)
•throttlingException(HTTP 429)
•validationException(HTTP 400)
All non-stream errors (access denied, model not ready, etc.) still come back as a single HTTP error response. Stream-specific failures appear as one of the Error Events listed above in the event stream.
Configuration information for the tools that you pass to a model. For more information, see Tool use (function calling) in the Amazon Bedrock User Guide.
Contents
tools
An array of tools that you want to pass to a model.
Type: Array of Tool objects
Array Members: Minimum number of 1 item.
Required: Yes
toolChoice
If supported by the model, forces the model to request a tool.
Type: ToolChoice object
Note: This object is a UNION. Only one member of this object can be specified or returned.
Required: No
Configuration information for a guardrail that you use with the Converse operation.
Contents
guardrailIdentifier
The identifier for the guardrail.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 2048.
Pattern:
^C([a-z0-9]+)|(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:guardrail/[a-z0-9]+)$
Required: Yes
guardrailVersion
The version of the guardrail.
Type: String
Pattern: ^([1-9][0-9]{0,7}|DRAFT)$
Required: Yes
trace
The trace behavior for the guardrail.
Type: String
Valid Values: enabled | disabled | enabled_full
Required: No
Base inference parameters to pass to a model in a call to Converse or ConverseStream.
Contents
maxTokens
The maximum number of tokens to allow in the generated response.
Type: Integer
Valid Range: Minimum value of 1.
Required: No
stopSequences
A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
Type: Array of strings
Array Members: Minimum number of 0 items. Maximum number of 4 items.
Length Constraints: Minimum length of 1.
Required: No
temperature
The likelihood of the model selecting higher-probability options while generating a response.
Type: Float
Valid Range: Minimum value of 0. Maximum value of 1.
Required: No
topP
The percentage of most-likely candidates that the model considers for the next token.
Type: Float
Valid Range: Minimum value of 0. Maximum value of 1.
Required: No
A message input, or returned from, a call to Converse or ConverseStream.
Contents
content
The message content. Note the following restrictions:
- You can include up to 20 images. Each image’s size, height, and width must be no more than 3.75 MB, 8000 px, and 8000 px, respectively.
- You can include up to five documents. Each document’s size must be no more than 4.5 MB.
- If you include a ContentBlock with a
documentfield in the array, you must also include a ContentBlock with atextfield. - You can only include images and documents if the
roleisuser.
Type: Array of ContentBlock objects
Required: Yes
role
The role that the message plays in the conversation.
Type: String
Valid Values: user | assistant
Required: Yes
Performance settings for a model.
Contents
latency
To use a latency-optimized version of the model, set to optimized.
Type: String
Valid Values: standard | optimized
Required: No
Contains a map of variables in a prompt from Prompt management to an object containing the values to fill in for them when running model invocation.
Important:
This data type is a UNION, so only one of the following members can be specified when used or returned.
Contents
text
The text value that the variable maps to.
Type: String
Required: No
Contains configurations for instructions to provide the model for how to handle input.
Important:
This data type is a UNION, so only one of the following members can be specified when used or returned.
Contents
cachePoint
CachePoint to include in the system prompt.
Type: CachePointBlock object
Required: No
guardContent
A content block to assess with the guardrail. Use with the Converse or ConverseStream API operations.
Type: GuardrailConverseContentBlock object
Note: This object is a UNION. Only one member of this object can be specified or returned.
Required: No
text
A system prompt for the model.
Type: String
Length Constraints: Minimum length of 1.
Required: No
Metrics for a call to Converse.
Contents
latencyMs
The latency of the call to Converse, in milliseconds.
Type: Long
Required: Yes
The output from a call to Converse.
Important:
This data type is a UNION, so only one of the following members can be specified when used or returned.
Contents
message
The message that the model generates.
Type: Message object
Required: No
The trace object in a response from Converse.
Contents
guardrail
The guardrail trace object.
Type: GuardrailTraceAssessment object
Required: No
promptRouter
The request’s prompt router trace.
Type: PromptRouterTrace object
Required: No
Information about a tool that you can use with the Converse API. For more information, see Call a tool with the Converse API in the Amazon Bedrock User Guide.
Contents
Important
This data type is a UNION, so only one of the following members can be specified when used or returned.
cachePoint
CachePoint to include in the tool configuration.
Type: CachePointBlock object
Required: No
toolSpec
The specification for the tool.
Type: ToolSpecification object
Required: No
Determines which tools the model should request in a call to Converse or ConverseStream. For more information, see Call a tool with the Converse API in the Amazon Bedrock User Guide.
Contents
Important
This data type is a UNION, so only one of the following members can be specified when used or returned.
any
The model must request at least one tool (no text is generated).
Type: AnyToolChoice object
Required: No
auto
(Default). The model automatically decides if a tool should be called or whether to generate text instead.
Type: AutoToolChoice object
Required: No
tool
The model must request the specified tool. Only supported by Anthropic Claude 3 models.
Type: SpecificToolChoice object
Required: No
Important
This data type is a UNION, so only one of the following members can be specified when used or returned.
Contents
cachePoint
CachePoint to include in the message.
Type: CachePointBlock object
Required: No
document
A document to include in the message.
Type: DocumentBlock object
Required: No
guardContent
Contains the content to assess with the guardrail. If you don't specify guardContent in a call to the Converse API, the guardrail (if passed in the Converse API) assesses the entire message. For more information, see Use a guardrail with the Converse API.
Type: GuardrailConverseContentBlock object
Note: This object is a UNION. Only one member of this object can be specified or returned.
Required: No
image
Image to include in the message.
Note
This field is only supported by Anthropic Claude 3 models.
Type: ImageBlock object
Required: No
reasoningContent
Contains content regarding the reasoning that is carried out by the model. Reasoning refers to a Chain of Thought (CoT) that the model generates to enhance the accuracy of its final response.
Type: ReasoningContentBlock object
Note: This object is a UNION. Only one member of this object can be specified or returned.
Required: No
text
Text to include in the message.
Type: String
Required: No
toolResult
The result for a tool request that a model makes.
Type: ToolResultBlock object
Required: No
toolUse
Information about a tool use request from a model.
Type: ToolUseBlock object
Required: No
video
Video to include in the message.
Type: VideoBlock object
Required: No
Configuration information for a guardrail that you use with the ConverseStream action.
Contents
guardrailIdentifier
The identifier for the guardrail.
Type: String
Length Constraints: Minimum length of 0. Maximum length of 2048.
Pattern: ^C([a-z0-9]+)|(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:guardrail/[a-z0-9]+)$
Required: Yes
guardrailVersion
The version of the guardrail.
Type: String
Pattern: ^([1-9][0-9]{0,7}|DRAFT)$
Required: Yes
streamProcessingMode
The processing mode. For more information, see Configure streaming response behavior.
Type: String
Valid Values: sync | async
Required: No
trace
The trace behavior for the guardrail.
Type: String
Valid Values: enabled | disabled | enabled_full
Required: No
A content block for selective guarding with the Converse or ConverseStream API operations.
Important
This data type is a UNION, so only one of the following members can be specified when used or returned.
Contents
image
Image within converse content block to be evaluated by the guardrail.
Type: GuardrailConverseImageBlock object
Required: No
text
The text to guard.
Type: GuardrailConverseTextBlock object
Required: No
Defines a section of content to be cached for reuse in subsequent API calls.
Contents
type
Specifies the type of cache point within the CachePointBlock.
Type: String
Valid Values: default
Required: Yes
A prompt router trace.
Contents
invokedModelId
The ID of the invoked model.
Type: String
Pattern:
^(arn:aws(-[^:]+)?:bedrock:[a-z0-9-]{1,20}::foundation-model/[a-z0-9-]{1,63}[.]{1}[a-z0-9-]{1,63}([.:]?[a-z0-9-]{1,63}){0,2})|(arn:aws(-us-gov|-cn|-isol|-iso-b):bedrock:([0-9a-z-]{1,20}):([0-9]{12}):inference-profile/[a-zA-Z0-9-:.]+)$
Required: No
The tokens used in a message API inference call.
Contents
inputTokens
The number of tokens sent in the request to the model.
Type: Integer
Valid Range: Minimum value of 0.
Required: Yes
outputTokens
The number of tokens that the model generated for the request.
Type: Integer
Valid Range: Minimum value of 0.
Required: Yes
totalTokens
The total of input tokens and tokens generated by the model.
Type: Integer
Valid Range: Minimum value of 0.
Required: Yes
cacheReadInputTokens
The number of input tokens read from the cache for the request.
Type: Integer
Valid Range: Minimum value of 0.
Required: No
cacheWriteInputTokens
The number of input tokens written to the cache for the request.
Type: Integer
Valid Range: Minimum value of 0.
Required: No
The start of a message.
Contents
role
The role for the message.
Type: String
Valid Values: user | assistant
Required: Yes
Content block start event.
Contents
contentBlockIndex
The index for a content block start event.
Type: Integer
Valid Range: Minimum value of 0.
Required: Yes
start
Start information about a content block start event.
Type: ContentBlockStart object
Note
This object is a UNION. Only one member of this object can be specified or returned.
Required: Yes
The content block delta event.
Contents
contentBlockIndex
The block index for a content block delta event.
Type: Integer
Valid Range: Minimum value of 0.
Required: Yes
delta
The delta for a content block delta event.
Type: ContentBlockDelta object
Note: This object is a Union. Only one member of this object can be specified or returned.
Required: Yes
A content block stop event.
Contents
contentBlockIndex
The index for a content block.
Type: Integer
Valid Range: Minimum value of 0.
Required: Yes
The stop event for a message.
Contents
stopReason
The reason why the model stopped generating output.
Type: String
Valid Values: end_turn | tool_use | max_tokens | stop_sequence | guardrail_intervened | content_filtered
Required: Yes
additionalModelResponseFields
The additional model response fields.
Type: JSON value
Required: No
A conversation stream metadata event.
Contents
metrics
The metrics for the conversation stream metadata event.
Type: ConverseStreamMetrics object
Required: Yes
usage
Usage information for the conversation stream event.
Type: TokenUsage object
Required: Yes
performanceConfig
Model performance configuration metadata for the conversation stream event.
Type: PerformanceConfiguration object
Required: No
trace
The trace object in the response from ConverseStream that contains information about the guardrail behavior.
Type: ConverseStreamTrace object
Required: No
Metrics for the stream.
Contents
latencyMs
The latency for the streaming request, in milliseconds.
Type: Long
Required: Yes
The trace object in a response from ConverseStream.
Contents
guardrail
The guardrail trace object.
Type: GuardrailTraceAssessment object
Required: No
promptRouter
The request's prompt router.
Type: PromptRouterTrace object
Required: No