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

commonMain.aws.sdk.kotlin.services.bedrockruntime.model.ConverseResponse.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.SdkDsl
import aws.smithy.kotlin.runtime.content.Document

public class ConverseResponse private constructor(builder: Builder) {
    /**
     * Additional fields in the response that are unique to the model.
     */
    public val additionalModelResponseFields: aws.smithy.kotlin.runtime.content.Document? = builder.additionalModelResponseFields
    /**
     * Metrics for the call to `Converse`.
     */
    public val metrics: aws.sdk.kotlin.services.bedrockruntime.model.ConverseMetrics? = builder.metrics
    /**
     * The result from the call to `Converse`.
     */
    public val output: aws.sdk.kotlin.services.bedrockruntime.model.ConverseOutput? = builder.output
    /**
     * Model performance settings for the request.
     */
    public val performanceConfig: aws.sdk.kotlin.services.bedrockruntime.model.PerformanceConfiguration? = builder.performanceConfig
    /**
     * The reason why the model stopped generating output.
     */
    public val stopReason: aws.sdk.kotlin.services.bedrockruntime.model.StopReason = requireNotNull(builder.stopReason) { "A non-null value must be provided for stopReason" }
    /**
     * A trace object that contains information about the Guardrail behavior.
     */
    public val trace: aws.sdk.kotlin.services.bedrockruntime.model.ConverseTrace? = builder.trace
    /**
     * The total number of tokens used in the call to `Converse`. The total includes the tokens input to the model and the tokens generated by the model.
     */
    public val usage: aws.sdk.kotlin.services.bedrockruntime.model.TokenUsage? = builder.usage

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

    override fun toString(): kotlin.String = buildString {
        append("ConverseResponse(")
        append("additionalModelResponseFields=$additionalModelResponseFields,")
        append("metrics=$metrics,")
        append("output=$output,")
        append("performanceConfig=$performanceConfig,")
        append("stopReason=$stopReason,")
        append("trace=$trace,")
        append("usage=$usage")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = additionalModelResponseFields?.hashCode() ?: 0
        result = 31 * result + (metrics?.hashCode() ?: 0)
        result = 31 * result + (output?.hashCode() ?: 0)
        result = 31 * result + (performanceConfig?.hashCode() ?: 0)
        result = 31 * result + (stopReason.hashCode())
        result = 31 * result + (trace?.hashCode() ?: 0)
        result = 31 * result + (usage?.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 ConverseResponse

        if (additionalModelResponseFields != other.additionalModelResponseFields) return false
        if (metrics != other.metrics) return false
        if (output != other.output) return false
        if (performanceConfig != other.performanceConfig) return false
        if (stopReason != other.stopReason) return false
        if (trace != other.trace) return false
        if (usage != other.usage) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Additional fields in the response that are unique to the model.
         */
        public var additionalModelResponseFields: aws.smithy.kotlin.runtime.content.Document? = null
        /**
         * Metrics for the call to `Converse`.
         */
        public var metrics: aws.sdk.kotlin.services.bedrockruntime.model.ConverseMetrics? = null
        /**
         * The result from the call to `Converse`.
         */
        public var output: aws.sdk.kotlin.services.bedrockruntime.model.ConverseOutput? = null
        /**
         * Model performance settings for the request.
         */
        public var performanceConfig: aws.sdk.kotlin.services.bedrockruntime.model.PerformanceConfiguration? = null
        /**
         * The reason why the model stopped generating output.
         */
        public var stopReason: aws.sdk.kotlin.services.bedrockruntime.model.StopReason? = null
        /**
         * A trace object that contains information about the Guardrail behavior.
         */
        public var trace: aws.sdk.kotlin.services.bedrockruntime.model.ConverseTrace? = null
        /**
         * The total number of tokens used in the call to `Converse`. The total includes the tokens input to the model and the tokens generated by the model.
         */
        public var usage: aws.sdk.kotlin.services.bedrockruntime.model.TokenUsage? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrockruntime.model.ConverseResponse) : this() {
            this.additionalModelResponseFields = x.additionalModelResponseFields
            this.metrics = x.metrics
            this.output = x.output
            this.performanceConfig = x.performanceConfig
            this.stopReason = x.stopReason
            this.trace = x.trace
            this.usage = x.usage
        }

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

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

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

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

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

        internal fun correctErrors(): Builder {
            if (stopReason == null) stopReason = StopReason.SdkUnknown("no value provided")
            return this
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy