io.github.cdklabs.generative_ai_cdk_constructs.bedrock.FoundationModelParsingStategyProps Maven / Gradle / Ivy
Show all versions of generative-ai-cdk-constructs Show documentation
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
* (experimental) Properties for configuring a Foundation Model parsing strategy.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-01T15:41:28.737Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.FoundationModelParsingStategyProps")
@software.amazon.jsii.Jsii.Proxy(FoundationModelParsingStategyProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface FoundationModelParsingStategyProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The Foundation Model to use for parsing non-textual information.
*
* Currently supported models are Claude 3 Sonnet and Claude 3 Haiku.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.bedrock.IModel getParsingModel();
/**
* (experimental) Custom prompt to instruct the parser on how to interpret the document.
*
* Default: - Uses the default instruction prompt as provided in the AWS Console.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getParsingPrompt() {
return null;
}
/**
* @return a {@link Builder} of {@link FoundationModelParsingStategyProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link FoundationModelParsingStategyProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.bedrock.IModel parsingModel;
java.lang.String parsingPrompt;
/**
* Sets the value of {@link FoundationModelParsingStategyProps#getParsingModel}
* @param parsingModel The Foundation Model to use for parsing non-textual information. This parameter is required.
* Currently supported models are Claude 3 Sonnet and Claude 3 Haiku.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder parsingModel(software.amazon.awscdk.services.bedrock.IModel parsingModel) {
this.parsingModel = parsingModel;
return this;
}
/**
* Sets the value of {@link FoundationModelParsingStategyProps#getParsingPrompt}
* @param parsingPrompt Custom prompt to instruct the parser on how to interpret the document.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder parsingPrompt(java.lang.String parsingPrompt) {
this.parsingPrompt = parsingPrompt;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link FoundationModelParsingStategyProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public FoundationModelParsingStategyProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link FoundationModelParsingStategyProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements FoundationModelParsingStategyProps {
private final software.amazon.awscdk.services.bedrock.IModel parsingModel;
private final java.lang.String parsingPrompt;
/**
* 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.parsingModel = software.amazon.jsii.Kernel.get(this, "parsingModel", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.bedrock.IModel.class));
this.parsingPrompt = software.amazon.jsii.Kernel.get(this, "parsingPrompt", software.amazon.jsii.NativeType.forClass(java.lang.String.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.parsingModel = java.util.Objects.requireNonNull(builder.parsingModel, "parsingModel is required");
this.parsingPrompt = builder.parsingPrompt;
}
@Override
public final software.amazon.awscdk.services.bedrock.IModel getParsingModel() {
return this.parsingModel;
}
@Override
public final java.lang.String getParsingPrompt() {
return this.parsingPrompt;
}
@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("parsingModel", om.valueToTree(this.getParsingModel()));
if (this.getParsingPrompt() != null) {
data.set("parsingPrompt", om.valueToTree(this.getParsingPrompt()));
}
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.FoundationModelParsingStategyProps"));
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;
FoundationModelParsingStategyProps.Jsii$Proxy that = (FoundationModelParsingStategyProps.Jsii$Proxy) o;
if (!parsingModel.equals(that.parsingModel)) return false;
return this.parsingPrompt != null ? this.parsingPrompt.equals(that.parsingPrompt) : that.parsingPrompt == null;
}
@Override
public final int hashCode() {
int result = this.parsingModel.hashCode();
result = 31 * result + (this.parsingPrompt != null ? this.parsingPrompt.hashCode() : 0);
return result;
}
}
}