All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.bedrockruntime.model.ToolResultContentBlock.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.bedrockruntime.model

import aws.smithy.kotlin.runtime.content.Document

/**
 * The tool result content block.
 */
public sealed class ToolResultContentBlock {
    /**
     * A tool result that is a document.
     */
    public data class Document(val value: aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock) : aws.sdk.kotlin.services.bedrockruntime.model.ToolResultContentBlock() {
    }

    /**
     * A tool result that is an image.
     *
     * This field is only supported by Anthropic Claude 3 models.
     */
    public data class Image(val value: aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock) : aws.sdk.kotlin.services.bedrockruntime.model.ToolResultContentBlock() {
    }

    /**
     * A tool result that is JSON format data.
     */
    public data class Json(val value: aws.smithy.kotlin.runtime.content.Document) : aws.sdk.kotlin.services.bedrockruntime.model.ToolResultContentBlock() {
    }

    /**
     * A tool result that is text.
     */
    public data class Text(val value: kotlin.String) : aws.sdk.kotlin.services.bedrockruntime.model.ToolResultContentBlock() {
    }

    public object SdkUnknown : aws.sdk.kotlin.services.bedrockruntime.model.ToolResultContentBlock() {
    }

    /**
     * Casts this [ToolResultContentBlock] as a [Document] and retrieves its [aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock] value. Throws an exception if the [ToolResultContentBlock] is not a
     * [Document].
     */
    public fun asDocument(): aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock = (this as ToolResultContentBlock.Document).value

    /**
     * Casts this [ToolResultContentBlock] as a [Document] and retrieves its [aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock] value. Returns null if the [ToolResultContentBlock] is not a [Document].
     */
    public fun asDocumentOrNull(): aws.sdk.kotlin.services.bedrockruntime.model.DocumentBlock? = (this as? ToolResultContentBlock.Document)?.value

    /**
     * Casts this [ToolResultContentBlock] as a [Image] and retrieves its [aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock] value. Throws an exception if the [ToolResultContentBlock] is not a
     * [Image].
     */
    public fun asImage(): aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock = (this as ToolResultContentBlock.Image).value

    /**
     * Casts this [ToolResultContentBlock] as a [Image] and retrieves its [aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock] value. Returns null if the [ToolResultContentBlock] is not a [Image].
     */
    public fun asImageOrNull(): aws.sdk.kotlin.services.bedrockruntime.model.ImageBlock? = (this as? ToolResultContentBlock.Image)?.value

    /**
     * Casts this [ToolResultContentBlock] as a [Json] and retrieves its [aws.smithy.kotlin.runtime.content.Document] value. Throws an exception if the [ToolResultContentBlock] is not a
     * [Json].
     */
    public fun asJson(): aws.smithy.kotlin.runtime.content.Document = (this as ToolResultContentBlock.Json).value

    /**
     * Casts this [ToolResultContentBlock] as a [Json] and retrieves its [aws.smithy.kotlin.runtime.content.Document] value. Returns null if the [ToolResultContentBlock] is not a [Json].
     */
    public fun asJsonOrNull(): aws.smithy.kotlin.runtime.content.Document? = (this as? ToolResultContentBlock.Json)?.value

    /**
     * Casts this [ToolResultContentBlock] as a [Text] and retrieves its [kotlin.String] value. Throws an exception if the [ToolResultContentBlock] is not a
     * [Text].
     */
    public fun asText(): kotlin.String = (this as ToolResultContentBlock.Text).value

    /**
     * Casts this [ToolResultContentBlock] as a [Text] and retrieves its [kotlin.String] value. Returns null if the [ToolResultContentBlock] is not a [Text].
     */
    public fun asTextOrNull(): kotlin.String? = (this as? ToolResultContentBlock.Text)?.value
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy