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

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

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

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

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Configuration information for the tools that you pass to a model. For more information, see [Tool use (function calling)](https://docs.aws.amazon.com/bedrock/latest/userguide/tool-use.html) in the Amazon Bedrock User Guide.
 *
 * This field is only supported by Anthropic Claude 3, Cohere Command R, Cohere Command R+, and Mistral Large models.
 */
public class ToolConfiguration private constructor(builder: Builder) {
    /**
     * If supported by model, forces the model to request a tool.
     */
    public val toolChoice: aws.sdk.kotlin.services.bedrockruntime.model.ToolChoice? = builder.toolChoice
    /**
     * An array of tools that you want to pass to a model.
     */
    public val tools: List = requireNotNull(builder.tools) { "A non-null value must be provided for tools" }

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

    override fun toString(): kotlin.String = buildString {
        append("ToolConfiguration(")
        append("toolChoice=$toolChoice,")
        append("tools=$tools")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = toolChoice?.hashCode() ?: 0
        result = 31 * result + (tools.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 ToolConfiguration

        if (toolChoice != other.toolChoice) return false
        if (tools != other.tools) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * If supported by model, forces the model to request a tool.
         */
        public var toolChoice: aws.sdk.kotlin.services.bedrockruntime.model.ToolChoice? = null
        /**
         * An array of tools that you want to pass to a model.
         */
        public var tools: List? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrockruntime.model.ToolConfiguration) : this() {
            this.toolChoice = x.toolChoice
            this.tools = x.tools
        }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy