ContentBlock

sealed class ContentBlock

A block of content for a message that you pass to, or receive from, a model with the Converse or ConverseStream API operations.

Inheritors

Types

Link copied to clipboard
data class CachePoint(val value: CachePointBlock) : ContentBlock

CachePoint to include in the message.

Link copied to clipboard

A content block that contains both generated text and associated citation information, providing traceability between the response and source documents.

Link copied to clipboard
data class Document(val value: DocumentBlock) : ContentBlock

A document to include in the message.

Link copied to clipboard

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.

Link copied to clipboard
data class Image(val value: ImageBlock) : ContentBlock

Image to include in the message.

Link copied to clipboard

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.

Link copied to clipboard
Link copied to clipboard
data class Text(val value: String) : ContentBlock

Text to include in the message.

Link copied to clipboard
data class ToolResult(val value: ToolResultBlock) : ContentBlock

The result for a tool request that a model makes.

Link copied to clipboard
data class ToolUse(val value: ToolUseBlock) : ContentBlock

Information about a tool use request from a model.

Link copied to clipboard
data class Video(val value: VideoBlock) : ContentBlock

Video to include in the message.

Functions

Link copied to clipboard

Casts this ContentBlock as a CachePoint and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.CachePointBlock value. Throws an exception if the ContentBlock is not a CachePoint.

Link copied to clipboard
Link copied to clipboard

Casts this ContentBlock as a Document and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock value. Throws an exception if the ContentBlock is not a Document.

Link copied to clipboard
Link copied to clipboard

Casts this ContentBlock as a Image and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock value. Throws an exception if the ContentBlock is not a Image.

Link copied to clipboard

Casts this ContentBlock as a Image and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock value. Returns null if the ContentBlock is not a Image.

Link copied to clipboard
fun asText(): String

Casts this ContentBlock as a Text and retrieves its kotlin.String value. Throws an exception if the ContentBlock is not a Text.

Link copied to clipboard

Casts this ContentBlock as a Text and retrieves its kotlin.String value. Returns null if the ContentBlock is not a Text.

Link copied to clipboard

Casts this ContentBlock as a ToolResult and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.ToolResultBlock value. Throws an exception if the ContentBlock is not a ToolResult.

Link copied to clipboard
Link copied to clipboard

Casts this ContentBlock as a ToolUse and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.ToolUseBlock value. Throws an exception if the ContentBlock is not a ToolUse.

Link copied to clipboard

Casts this ContentBlock as a ToolUse and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.ToolUseBlock value. Returns null if the ContentBlock is not a ToolUse.

Link copied to clipboard

Casts this ContentBlock as a Video and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.VideoBlock value. Throws an exception if the ContentBlock is not a Video.

Link copied to clipboard

Casts this ContentBlock as a Video and retrieves its aws.sdk.kotlin.services.bedrockruntime.model.VideoBlock value. Returns null if the ContentBlock is not a Video.