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

commonMain.aws.sdk.kotlin.services.bedrockagent.model.ChatPromptTemplateConfiguration.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

/**
 * Contains configurations to use a prompt in a conversational format. For more information, see [Create a prompt using Prompt management](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-management-create.html).
 */
public class ChatPromptTemplateConfiguration private constructor(builder: Builder) {
    /**
     * An array of the variables in the prompt template.
     */
    public val inputVariables: List? = builder.inputVariables
    /**
     * Contains messages in the chat for the prompt.
     */
    public val messages: List = requireNotNull(builder.messages) { "A non-null value must be provided for messages" }
    /**
     * Contains system prompts to provide context to the model or to describe how it should behave.
     */
    public val system: List? = builder.system
    /**
     * Configuration information for the tools that the model can use when generating a response.
     */
    public val toolConfiguration: aws.sdk.kotlin.services.bedrockagent.model.ToolConfiguration? = builder.toolConfiguration

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.bedrockagent.model.ChatPromptTemplateConfiguration = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("ChatPromptTemplateConfiguration(")
        append("*** Sensitive Data Redacted ***")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = inputVariables?.hashCode() ?: 0
        result = 31 * result + (messages.hashCode())
        result = 31 * result + (system?.hashCode() ?: 0)
        result = 31 * result + (toolConfiguration?.hashCode() ?: 0)
        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 ChatPromptTemplateConfiguration

        if (inputVariables != other.inputVariables) return false
        if (messages != other.messages) return false
        if (system != other.system) return false
        if (toolConfiguration != other.toolConfiguration) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.bedrockagent.model.ChatPromptTemplateConfiguration = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * An array of the variables in the prompt template.
         */
        public var inputVariables: List? = null
        /**
         * Contains messages in the chat for the prompt.
         */
        public var messages: List? = null
        /**
         * Contains system prompts to provide context to the model or to describe how it should behave.
         */
        public var system: List? = null
        /**
         * Configuration information for the tools that the model can use when generating a response.
         */
        public var toolConfiguration: aws.sdk.kotlin.services.bedrockagent.model.ToolConfiguration? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrockagent.model.ChatPromptTemplateConfiguration) : this() {
            this.inputVariables = x.inputVariables
            this.messages = x.messages
            this.system = x.system
            this.toolConfiguration = x.toolConfiguration
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.bedrockagent.model.ChatPromptTemplateConfiguration = ChatPromptTemplateConfiguration(this)

        /**
         * construct an [aws.sdk.kotlin.services.bedrockagent.model.ToolConfiguration] inside the given [block]
         */
        public fun toolConfiguration(block: aws.sdk.kotlin.services.bedrockagent.model.ToolConfiguration.Builder.() -> kotlin.Unit) {
            this.toolConfiguration = aws.sdk.kotlin.services.bedrockagent.model.ToolConfiguration.invoke(block)
        }

        internal fun correctErrors(): Builder {
            if (messages == null) messages = emptyList()
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy