io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptProps Maven / Gradle / Ivy
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-07T16:14:00.741Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.PromptProps")
@software.amazon.jsii.Jsii.Proxy(PromptProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface PromptProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The name of the prompt.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.String getPromptName();
/**
* (experimental) The Prompt Variant that will be used by default.
*
* Default: - No default variant provided.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant getDefaultVariant() {
return null;
}
/**
* (experimental) A description of what the prompt does.
*
* Default: - No description provided.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getDescription() {
return null;
}
/**
* (experimental) The KMS key that the prompt is encrypted with.
*
* Default: - AWS owned and managed key.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.kms.IKey getEncryptionKey() {
return null;
}
/**
* (experimental) The variants of your prompt.
*
* Variants can use different messages, models,
* or configurations so that you can compare their outputs to decide the best
* variant for your use case. Maximum of 3 variants.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getVariants() {
return null;
}
/**
* @return a {@link Builder} of {@link PromptProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link PromptProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String promptName;
io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant defaultVariant;
java.lang.String description;
software.amazon.awscdk.services.kms.IKey encryptionKey;
java.util.List variants;
/**
* Sets the value of {@link PromptProps#getPromptName}
* @param promptName The name of the prompt. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder promptName(java.lang.String promptName) {
this.promptName = promptName;
return this;
}
/**
* Sets the value of {@link PromptProps#getDefaultVariant}
* @param defaultVariant The Prompt Variant that will be used by default.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder defaultVariant(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant defaultVariant) {
this.defaultVariant = defaultVariant;
return this;
}
/**
* Sets the value of {@link PromptProps#getDescription}
* @param description A description of what the prompt does.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder description(java.lang.String description) {
this.description = description;
return this;
}
/**
* Sets the value of {@link PromptProps#getEncryptionKey}
* @param encryptionKey The KMS key that the prompt is encrypted with.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder encryptionKey(software.amazon.awscdk.services.kms.IKey encryptionKey) {
this.encryptionKey = encryptionKey;
return this;
}
/**
* Sets the value of {@link PromptProps#getVariants}
* @param variants The variants of your prompt.
* Variants can use different messages, models,
* or configurations so that you can compare their outputs to decide the best
* variant for your use case. Maximum of 3 variants.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder variants(java.util.List extends io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant> variants) {
this.variants = (java.util.List)variants;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link PromptProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public PromptProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link PromptProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements PromptProps {
private final java.lang.String promptName;
private final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant defaultVariant;
private final java.lang.String description;
private final software.amazon.awscdk.services.kms.IKey encryptionKey;
private final java.util.List variants;
/**
* 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.promptName = software.amazon.jsii.Kernel.get(this, "promptName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.defaultVariant = software.amazon.jsii.Kernel.get(this, "defaultVariant", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant.class));
this.description = software.amazon.jsii.Kernel.get(this, "description", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.encryptionKey = software.amazon.jsii.Kernel.get(this, "encryptionKey", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.kms.IKey.class));
this.variants = software.amazon.jsii.Kernel.get(this, "variants", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant.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.promptName = java.util.Objects.requireNonNull(builder.promptName, "promptName is required");
this.defaultVariant = builder.defaultVariant;
this.description = builder.description;
this.encryptionKey = builder.encryptionKey;
this.variants = (java.util.List)builder.variants;
}
@Override
public final java.lang.String getPromptName() {
return this.promptName;
}
@Override
public final io.github.cdklabs.generative_ai_cdk_constructs.bedrock.PromptVariant getDefaultVariant() {
return this.defaultVariant;
}
@Override
public final java.lang.String getDescription() {
return this.description;
}
@Override
public final software.amazon.awscdk.services.kms.IKey getEncryptionKey() {
return this.encryptionKey;
}
@Override
public final java.util.List getVariants() {
return this.variants;
}
@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("promptName", om.valueToTree(this.getPromptName()));
if (this.getDefaultVariant() != null) {
data.set("defaultVariant", om.valueToTree(this.getDefaultVariant()));
}
if (this.getDescription() != null) {
data.set("description", om.valueToTree(this.getDescription()));
}
if (this.getEncryptionKey() != null) {
data.set("encryptionKey", om.valueToTree(this.getEncryptionKey()));
}
if (this.getVariants() != null) {
data.set("variants", om.valueToTree(this.getVariants()));
}
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.PromptProps"));
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;
PromptProps.Jsii$Proxy that = (PromptProps.Jsii$Proxy) o;
if (!promptName.equals(that.promptName)) return false;
if (this.defaultVariant != null ? !this.defaultVariant.equals(that.defaultVariant) : that.defaultVariant != null) return false;
if (this.description != null ? !this.description.equals(that.description) : that.description != null) return false;
if (this.encryptionKey != null ? !this.encryptionKey.equals(that.encryptionKey) : that.encryptionKey != null) return false;
return this.variants != null ? this.variants.equals(that.variants) : that.variants == null;
}
@Override
public final int hashCode() {
int result = this.promptName.hashCode();
result = 31 * result + (this.defaultVariant != null ? this.defaultVariant.hashCode() : 0);
result = 31 * result + (this.description != null ? this.description.hashCode() : 0);
result = 31 * result + (this.encryptionKey != null ? this.encryptionKey.hashCode() : 0);
result = 31 * result + (this.variants != null ? this.variants.hashCode() : 0);
return result;
}
}
}