io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptOverrideConfiguration Maven / Gradle / Ivy
Show all versions of generative-ai-cdk-constructs Show documentation
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
* (experimental) Contains configurations to override prompts in different parts of an agent sequence.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-01T15:41:28.758Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.PromptOverrideConfiguration")
@software.amazon.jsii.Jsii.Proxy(PromptOverrideConfiguration.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface PromptOverrideConfiguration extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Contains configurations to override a prompt template in one part of an agent sequence.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.util.List getPromptConfigurations();
/**
* (experimental) The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
*
* If you specify this field,
* at least one of the promptConfigurations must contain a parserMode value
* that is set to OVERRIDDEN.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getOverrideLambda() {
return null;
}
/**
* @return a {@link Builder} of {@link PromptOverrideConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link PromptOverrideConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.List promptConfigurations;
java.lang.String overrideLambda;
/**
* Sets the value of {@link PromptOverrideConfiguration#getPromptConfigurations}
* @param promptConfigurations Contains configurations to override a prompt template in one part of an agent sequence. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder promptConfigurations(java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptConfiguration> promptConfigurations) {
this.promptConfigurations = (java.util.List)promptConfigurations;
return this;
}
/**
* Sets the value of {@link PromptOverrideConfiguration#getOverrideLambda}
* @param overrideLambda The ARN of the Lambda function to use when parsing the raw foundation model output in parts of the agent sequence.
* If you specify this field,
* at least one of the promptConfigurations must contain a parserMode value
* that is set to OVERRIDDEN.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder overrideLambda(java.lang.String overrideLambda) {
this.overrideLambda = overrideLambda;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link PromptOverrideConfiguration}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public PromptOverrideConfiguration build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link PromptOverrideConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements PromptOverrideConfiguration {
private final java.util.List promptConfigurations;
private final java.lang.String overrideLambda;
/**
* 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.promptConfigurations = software.amazon.jsii.Kernel.get(this, "promptConfigurations", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptConfiguration.class)));
this.overrideLambda = software.amazon.jsii.Kernel.get(this, "overrideLambda", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.promptConfigurations = (java.util.List)java.util.Objects.requireNonNull(builder.promptConfigurations, "promptConfigurations is required");
this.overrideLambda = builder.overrideLambda;
}
@Override
public final java.util.List getPromptConfigurations() {
return this.promptConfigurations;
}
@Override
public final java.lang.String getOverrideLambda() {
return this.overrideLambda;
}
@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("promptConfigurations", om.valueToTree(this.getPromptConfigurations()));
if (this.getOverrideLambda() != null) {
data.set("overrideLambda", om.valueToTree(this.getOverrideLambda()));
}
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.PromptOverrideConfiguration"));
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;
PromptOverrideConfiguration.Jsii$Proxy that = (PromptOverrideConfiguration.Jsii$Proxy) o;
if (!promptConfigurations.equals(that.promptConfigurations)) return false;
return this.overrideLambda != null ? this.overrideLambda.equals(that.overrideLambda) : that.overrideLambda == null;
}
@Override
public final int hashCode() {
int result = this.promptConfigurations.hashCode();
result = 31 * result + (this.overrideLambda != null ? this.overrideLambda.hashCode() : 0);
return result;
}
}
}