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

commonMain.aws.sdk.kotlin.services.bedrockagent.model.PromptConfiguration.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 override a prompt template in one part of an agent sequence. For more information, see [Advanced prompts](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts.html).
 */
public class PromptConfiguration private constructor(builder: Builder) {
    /**
     * Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see [Prompt template placeholder variables](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html). For more information, see [Configure the prompt templates](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts-configure.html).
     */
    public val basePromptTemplate: kotlin.String? = builder.basePromptTemplate
    /**
     * 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 val inferenceConfiguration: aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration? = builder.inferenceConfiguration
    /**
     * Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the `promptType`. If you set the field as `OVERRIDEN`, the `overrideLambda` field in the [PromptOverrideConfiguration](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html) must be specified with the ARN of a Lambda function.
     */
    public val parserMode: aws.sdk.kotlin.services.bedrockagent.model.CreationMode? = builder.parserMode
    /**
     * Specifies whether to override the default prompt template for this `promptType`. Set this value to `OVERRIDDEN` to use the prompt that you provide in the `basePromptTemplate`. If you leave it as `DEFAULT`, the agent uses a default prompt template.
     */
    public val promptCreationMode: aws.sdk.kotlin.services.bedrockagent.model.CreationMode? = builder.promptCreationMode
    /**
     * Specifies whether to allow the agent to carry out the step specified in the `promptType`. If you set this value to `DISABLED`, the agent skips that step. The default state for each `promptType` is as follows.
     * + `PRE_PROCESSING` – `ENABLED`
     * + `ORCHESTRATION` – `ENABLED`
     * + `KNOWLEDGE_BASE_RESPONSE_GENERATION` – `ENABLED`
     * + `POST_PROCESSING` – `DISABLED`
     */
    public val promptState: aws.sdk.kotlin.services.bedrockagent.model.PromptState? = builder.promptState
    /**
     * The step in the agent sequence that this prompt configuration applies to.
     */
    public val promptType: aws.sdk.kotlin.services.bedrockagent.model.PromptType? = builder.promptType

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

    override fun toString(): kotlin.String = buildString {
        append("PromptConfiguration(")
        append("basePromptTemplate=*** Sensitive Data Redacted ***,")
        append("inferenceConfiguration=$inferenceConfiguration,")
        append("parserMode=$parserMode,")
        append("promptCreationMode=$promptCreationMode,")
        append("promptState=$promptState,")
        append("promptType=$promptType")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = basePromptTemplate?.hashCode() ?: 0
        result = 31 * result + (inferenceConfiguration?.hashCode() ?: 0)
        result = 31 * result + (parserMode?.hashCode() ?: 0)
        result = 31 * result + (promptCreationMode?.hashCode() ?: 0)
        result = 31 * result + (promptState?.hashCode() ?: 0)
        result = 31 * result + (promptType?.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 PromptConfiguration

        if (basePromptTemplate != other.basePromptTemplate) return false
        if (inferenceConfiguration != other.inferenceConfiguration) return false
        if (parserMode != other.parserMode) return false
        if (promptCreationMode != other.promptCreationMode) return false
        if (promptState != other.promptState) return false
        if (promptType != other.promptType) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Defines the prompt template with which to replace the default prompt template. You can use placeholder variables in the base prompt template to customize the prompt. For more information, see [Prompt template placeholder variables](https://docs.aws.amazon.com/bedrock/latest/userguide/prompt-placeholders.html). For more information, see [Configure the prompt templates](https://docs.aws.amazon.com/bedrock/latest/userguide/advanced-prompts-configure.html).
         */
        public var basePromptTemplate: kotlin.String? = null
        /**
         * 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 var inferenceConfiguration: aws.sdk.kotlin.services.bedrockagent.model.InferenceConfiguration? = null
        /**
         * Specifies whether to override the default parser Lambda function when parsing the raw foundation model output in the part of the agent sequence defined by the `promptType`. If you set the field as `OVERRIDEN`, the `overrideLambda` field in the [PromptOverrideConfiguration](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_agent_PromptOverrideConfiguration.html) must be specified with the ARN of a Lambda function.
         */
        public var parserMode: aws.sdk.kotlin.services.bedrockagent.model.CreationMode? = null
        /**
         * Specifies whether to override the default prompt template for this `promptType`. Set this value to `OVERRIDDEN` to use the prompt that you provide in the `basePromptTemplate`. If you leave it as `DEFAULT`, the agent uses a default prompt template.
         */
        public var promptCreationMode: aws.sdk.kotlin.services.bedrockagent.model.CreationMode? = null
        /**
         * Specifies whether to allow the agent to carry out the step specified in the `promptType`. If you set this value to `DISABLED`, the agent skips that step. The default state for each `promptType` is as follows.
         * + `PRE_PROCESSING` – `ENABLED`
         * + `ORCHESTRATION` – `ENABLED`
         * + `KNOWLEDGE_BASE_RESPONSE_GENERATION` – `ENABLED`
         * + `POST_PROCESSING` – `DISABLED`
         */
        public var promptState: aws.sdk.kotlin.services.bedrockagent.model.PromptState? = null
        /**
         * The step in the agent sequence that this prompt configuration applies to.
         */
        public var promptType: aws.sdk.kotlin.services.bedrockagent.model.PromptType? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.bedrockagent.model.PromptConfiguration) : this() {
            this.basePromptTemplate = x.basePromptTemplate
            this.inferenceConfiguration = x.inferenceConfiguration
            this.parserMode = x.parserMode
            this.promptCreationMode = x.promptCreationMode
            this.promptState = x.promptState
            this.promptType = x.promptType
        }

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

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

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy