commonMain.aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bedrockagent-jvm Show documentation
Show all versions of bedrockagent-jvm Show documentation
The AWS SDK for Kotlin client for Bedrock Agent
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.bedrockagent.model
import aws.smithy.kotlin.runtime.SdkDsl
/**
* Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the `promptType`. For more information, see [Inference parameters for foundation models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters.html).
*/
public class InferenceConfiguration private constructor(builder: Builder) {
/**
* The maximum number of tokens to allow in the generated response.
*/
public val maximumLength: kotlin.Int? = builder.maximumLength
/**
* A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
*/
public val stopSequences: List? = builder.stopSequences
/**
* The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
*/
public val temperature: kotlin.Float? = builder.temperature
/**
* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for `topK` is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set `topK` to 50, the model selects the next token from among the top 50 most likely choices.
*/
public val topK: kotlin.Int? = builder.topK
/**
* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for `Top P` determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set `topP` to 80, the model only selects the next token from the top 80% of the probability distribution of next tokens.
*/
public val topP: kotlin.Float? = builder.topP
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("InferenceConfiguration(")
append("maximumLength=$maximumLength,")
append("stopSequences=$stopSequences,")
append("temperature=$temperature,")
append("topK=$topK,")
append("topP=$topP")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = maximumLength ?: 0
result = 31 * result + (stopSequences?.hashCode() ?: 0)
result = 31 * result + (temperature?.hashCode() ?: 0)
result = 31 * result + (topK ?: 0)
result = 31 * result + (topP?.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 InferenceConfiguration
if (maximumLength != other.maximumLength) return false
if (stopSequences != other.stopSequences) return false
if (!(temperature?.equals(other.temperature) ?: (other.temperature == null))) return false
if (topK != other.topK) return false
if (!(topP?.equals(other.topP) ?: (other.topP == null))) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* The maximum number of tokens to allow in the generated response.
*/
public var maximumLength: kotlin.Int? = null
/**
* A list of stop sequences. A stop sequence is a sequence of characters that causes the model to stop generating the response.
*/
public var stopSequences: List? = null
/**
* The likelihood of the model selecting higher-probability options while generating a response. A lower value makes the model more likely to choose higher-probability options, while a higher value makes the model more likely to choose lower-probability options.
*/
public var temperature: kotlin.Float? = null
/**
* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for `topK` is the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set `topK` to 50, the model selects the next token from among the top 50 most likely choices.
*/
public var topK: kotlin.Int? = null
/**
* While generating a response, the model determines the probability of the following token at each point of generation. The value that you set for `Top P` determines the number of most-likely candidates from which the model chooses the next token in the sequence. For example, if you set `topP` to 80, the model only selects the next token from the top 80% of the probability distribution of next tokens.
*/
public var topP: kotlin.Float? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration) : this() {
this.maximumLength = x.maximumLength
this.stopSequences = x.stopSequences
this.temperature = x.temperature
this.topK = x.topK
this.topP = x.topP
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration = InferenceConfiguration(this)
internal fun correctErrors(): Builder {
return this
}
}
}