commonMain.aws.sdk.kotlin.services.bedrockruntime.model.Message.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrockruntime-jvm Show documentation
Show all versions of bedrockruntime-jvm Show documentation
The AWS Kotlin client for Bedrock Runtime
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockruntime.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* A message input, or returned from, a call to [Converse](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html) or [ConverseStream](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_ConverseStream.html).
*/
public class Message private constructor(builder: Builder) {
/**
* 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 `document` field in the array, you must also include a `ContentBlock` with a `text` field.
* + You can only include images and documents if the `role` is `user`.
*/
public val content: List = requireNotNull(builder.content) { "A non-null value must be provided for content" }
/**
* The role that the message plays in the message.
*/
public val role: aws.sdk.kotlin.services.bedrockruntime.model.ConversationRole = requireNotNull(builder.role) { "A non-null value must be provided for role" }
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.bedrockruntime.model.Message = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("Message(")
append("content=$content,")
append("role=$role")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = content.hashCode()
result = 31 * result + (role.hashCode())
return result
}
override fun equals(other: kotlin.Any?): kotlin.Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as Message
if (content != other.content) return false
if (role != other.role) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.bedrockruntime.model.Message = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* 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 `document` field in the array, you must also include a `ContentBlock` with a `text` field.
* + You can only include images and documents if the `role` is `user`.
*/
public var content: List? = null
/**
* The role that the message plays in the message.
*/
public var role: aws.sdk.kotlin.services.bedrockruntime.model.ConversationRole? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.bedrockruntime.model.Message) : this() {
this.content = x.content
this.role = x.role
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.bedrockruntime.model.Message = Message(this)
internal fun correctErrors(): Builder {
if (content == null) content = emptyList()
if (role == null) role = ConversationRole.SdkUnknown("no value provided")
return this
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy