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

commonMain.aws.sdk.kotlin.services.bedrockagent.model.Message.kt Maven / Gradle / Ivy

There is a newer version: 1.3.77
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.bedrockagent.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * A message input or response from a model. For more information, see [Create a prompt using Prompt management](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-create.html).
 */
public class Message private constructor(builder: Builder) {
    /**
     * The content in the message.
     */
    public val content: List = requireNotNull(builder.content) { "A non-null value must be provided for content" }
    /**
     * The role that the message belongs to.
     */
    public val role: aws.sdk.kotlin.services.bedrockagent.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.bedrockagent.model.Message = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("Message(")
        append("content=*** Sensitive Data Redacted ***,")
        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.bedrockagent.model.Message = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * The content in the message.
         */
        public var content: List? = null
        /**
         * The role that the message belongs to.
         */
        public var role: aws.sdk.kotlin.services.bedrockagent.model.ConversationRole? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrockagent.model.Message) : this() {
            this.content = x.content
            this.role = x.role
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.bedrockagent.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 - 2024 Weber Informatics LLC | Privacy Policy