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

io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptConfiguration Maven / Gradle / Ivy

Go to download

AWS Generative AI CDK Constructs is a library for well-architected generative AI patterns.

There is a newer version: 0.1.271
Show newest version
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;

/**
 * (experimental) Contains configurations to override a prompt template in one part of an agent sequence.
 */
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-23T22:27:31.978Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.PromptConfiguration")
@software.amazon.jsii.Jsii.Proxy(PromptConfiguration.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface PromptConfiguration extends software.amazon.jsii.JsiiSerializable {

    /**
     * (experimental) Defines the prompt template with which to replace the default prompt template.
     * 

* length 0-100000 */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @org.jetbrains.annotations.NotNull java.lang.String getBasePromptTemplate(); /** * (experimental) Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the promptType. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.InferenceConfiguration getInferenceConfiguration(); /** * (experimental) 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. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptCreationMode getPromptCreationMode(); /** * (experimental) 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
     * 
*/ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptState getPromptState(); /** * (experimental) The step in the agent sequence that this prompt configuration applies to. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @org.jetbrains.annotations.NotNull io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptType getPromptType(); /** * (experimental) 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 must be specified * with the ARN of a Lambda function. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) default @org.jetbrains.annotations.Nullable io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ParserMode getParserMode() { return null; } /** * @return a {@link Builder} of {@link PromptConfiguration} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) static Builder builder() { return new Builder(); } /** * A builder for {@link PromptConfiguration} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public static final class Builder implements software.amazon.jsii.Builder { java.lang.String basePromptTemplate; io.github.cdklabs.generative_ai_cdk_constructs.bedrock.InferenceConfiguration inferenceConfiguration; io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptCreationMode promptCreationMode; io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptState promptState; io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptType promptType; io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ParserMode parserMode; /** * Sets the value of {@link PromptConfiguration#getBasePromptTemplate} * @param basePromptTemplate Defines the prompt template with which to replace the default prompt template. This parameter is required. * length 0-100000 * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder basePromptTemplate(java.lang.String basePromptTemplate) { this.basePromptTemplate = basePromptTemplate; return this; } /** * Sets the value of {@link PromptConfiguration#getInferenceConfiguration} * @param inferenceConfiguration Contains inference parameters to use when the agent invokes a foundation model in the part of the agent sequence defined by the promptType. This parameter is required. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder inferenceConfiguration(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.InferenceConfiguration inferenceConfiguration) { this.inferenceConfiguration = inferenceConfiguration; return this; } /** * Sets the value of {@link PromptConfiguration#getPromptCreationMode} * @param promptCreationMode Specifies whether to override the default prompt template for this promptType. This parameter is required. * 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. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder promptCreationMode(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptCreationMode promptCreationMode) { this.promptCreationMode = promptCreationMode; return this; } /** * Sets the value of {@link PromptConfiguration#getPromptState} * @param promptState Specifies whether to allow the agent to carry out the step specified in the promptType. This parameter is required. * 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
         *                    
* @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder promptState(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptState promptState) { this.promptState = promptState; return this; } /** * Sets the value of {@link PromptConfiguration#getPromptType} * @param promptType The step in the agent sequence that this prompt configuration applies to. This parameter is required. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder promptType(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptType promptType) { this.promptType = promptType; return this; } /** * Sets the value of {@link PromptConfiguration#getParserMode} * @param parserMode 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 must be specified * with the ARN of a Lambda function. * @return {@code this} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) public Builder parserMode(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ParserMode parserMode) { this.parserMode = parserMode; return this; } /** * Builds the configured instance. * @return a new instance of {@link PromptConfiguration} * @throws NullPointerException if any required attribute was not provided */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @Override public PromptConfiguration build() { return new Jsii$Proxy(this); } } /** * An implementation for {@link PromptConfiguration} */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental) @software.amazon.jsii.Internal final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements PromptConfiguration { private final java.lang.String basePromptTemplate; private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.InferenceConfiguration inferenceConfiguration; private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptCreationMode promptCreationMode; private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptState promptState; private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptType promptType; private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ParserMode parserMode; /** * Constructor that initializes the object based on values retrieved from the JsiiObject. * @param objRef Reference to the JSII managed object. */ protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); this.basePromptTemplate = software.amazon.jsii.Kernel.get(this, "basePromptTemplate", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); this.inferenceConfiguration = software.amazon.jsii.Kernel.get(this, "inferenceConfiguration", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.InferenceConfiguration.class)); this.promptCreationMode = software.amazon.jsii.Kernel.get(this, "promptCreationMode", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptCreationMode.class)); this.promptState = software.amazon.jsii.Kernel.get(this, "promptState", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptState.class)); this.promptType = software.amazon.jsii.Kernel.get(this, "promptType", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptType.class)); this.parserMode = software.amazon.jsii.Kernel.get(this, "parserMode", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ParserMode.class)); } /** * Constructor that initializes the object based on literal property values passed by the {@link Builder}. */ protected Jsii$Proxy(final Builder builder) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); this.basePromptTemplate = java.util.Objects.requireNonNull(builder.basePromptTemplate, "basePromptTemplate is required"); this.inferenceConfiguration = java.util.Objects.requireNonNull(builder.inferenceConfiguration, "inferenceConfiguration is required"); this.promptCreationMode = java.util.Objects.requireNonNull(builder.promptCreationMode, "promptCreationMode is required"); this.promptState = java.util.Objects.requireNonNull(builder.promptState, "promptState is required"); this.promptType = java.util.Objects.requireNonNull(builder.promptType, "promptType is required"); this.parserMode = builder.parserMode; } @Override public final java.lang.String getBasePromptTemplate() { return this.basePromptTemplate; } @Override public final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.InferenceConfiguration getInferenceConfiguration() { return this.inferenceConfiguration; } @Override public final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptCreationMode getPromptCreationMode() { return this.promptCreationMode; } @Override public final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptState getPromptState() { return this.promptState; } @Override public final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptType getPromptType() { return this.promptType; } @Override public final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.ParserMode getParserMode() { return this.parserMode; } @Override @software.amazon.jsii.Internal public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() { final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE; final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); data.set("basePromptTemplate", om.valueToTree(this.getBasePromptTemplate())); data.set("inferenceConfiguration", om.valueToTree(this.getInferenceConfiguration())); data.set("promptCreationMode", om.valueToTree(this.getPromptCreationMode())); data.set("promptState", om.valueToTree(this.getPromptState())); data.set("promptType", om.valueToTree(this.getPromptType())); if (this.getParserMode() != null) { data.set("parserMode", om.valueToTree(this.getParserMode())); } final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); struct.set("fqn", om.valueToTree("@cdklabs/generative-ai-cdk-constructs.bedrock.PromptConfiguration")); struct.set("data", data); final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode(); obj.set("$jsii.struct", struct); return obj; } @Override public final boolean equals(final Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; PromptConfiguration.Jsii$Proxy that = (PromptConfiguration.Jsii$Proxy) o; if (!basePromptTemplate.equals(that.basePromptTemplate)) return false; if (!inferenceConfiguration.equals(that.inferenceConfiguration)) return false; if (!promptCreationMode.equals(that.promptCreationMode)) return false; if (!promptState.equals(that.promptState)) return false; if (!promptType.equals(that.promptType)) return false; return this.parserMode != null ? this.parserMode.equals(that.parserMode) : that.parserMode == null; } @Override public final int hashCode() { int result = this.basePromptTemplate.hashCode(); result = 31 * result + (this.inferenceConfiguration.hashCode()); result = 31 * result + (this.promptCreationMode.hashCode()); result = 31 * result + (this.promptState.hashCode()); result = 31 * result + (this.promptType.hashCode()); result = 31 * result + (this.parserMode != null ? this.parserMode.hashCode() : 0); return result; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy