io.github.cdklabs.generative_ai_cdk_constructs.bedrock.HierarchicalChunkingProps Maven / Gradle / Ivy
Show all versions of generative-ai-cdk-constructs Show documentation
package io.github.cdklabs.generative_ai_cdk_constructs.bedrock;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-10-01T15:41:28.740Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.generative_ai_cdk_constructs.$Module.class, fqn = "@cdklabs/generative-ai-cdk-constructs.bedrock.HierarchicalChunkingProps")
@software.amazon.jsii.Jsii.Proxy(HierarchicalChunkingProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface HierarchicalChunkingProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Maximum number of tokens that a child chunk can contain.
*
* Keep in mind the maximum chunk size depends on the embedding model chosen.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getMaxChildTokenSize();
/**
* (experimental) Maximum number of tokens that a parent chunk can contain.
*
* Keep in mind the maximum chunk size depends on the embedding model chosen.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getMaxParentTokenSize();
/**
* (experimental) The overlap tokens between adjacent chunks.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getOverlapTokens();
/**
* @return a {@link Builder} of {@link HierarchicalChunkingProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link HierarchicalChunkingProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number maxChildTokenSize;
java.lang.Number maxParentTokenSize;
java.lang.Number overlapTokens;
/**
* Sets the value of {@link HierarchicalChunkingProps#getMaxChildTokenSize}
* @param maxChildTokenSize Maximum number of tokens that a child chunk can contain. This parameter is required.
* Keep in mind the maximum chunk size depends on the embedding model chosen.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxChildTokenSize(java.lang.Number maxChildTokenSize) {
this.maxChildTokenSize = maxChildTokenSize;
return this;
}
/**
* Sets the value of {@link HierarchicalChunkingProps#getMaxParentTokenSize}
* @param maxParentTokenSize Maximum number of tokens that a parent chunk can contain. This parameter is required.
* Keep in mind the maximum chunk size depends on the embedding model chosen.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxParentTokenSize(java.lang.Number maxParentTokenSize) {
this.maxParentTokenSize = maxParentTokenSize;
return this;
}
/**
* Sets the value of {@link HierarchicalChunkingProps#getOverlapTokens}
* @param overlapTokens The overlap tokens between adjacent chunks. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder overlapTokens(java.lang.Number overlapTokens) {
this.overlapTokens = overlapTokens;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link HierarchicalChunkingProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public HierarchicalChunkingProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link HierarchicalChunkingProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements HierarchicalChunkingProps {
private final java.lang.Number maxChildTokenSize;
private final java.lang.Number maxParentTokenSize;
private final java.lang.Number overlapTokens;
/**
* 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.maxChildTokenSize = software.amazon.jsii.Kernel.get(this, "maxChildTokenSize", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.maxParentTokenSize = software.amazon.jsii.Kernel.get(this, "maxParentTokenSize", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.overlapTokens = software.amazon.jsii.Kernel.get(this, "overlapTokens", software.amazon.jsii.NativeType.forClass(java.lang.Number.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.maxChildTokenSize = java.util.Objects.requireNonNull(builder.maxChildTokenSize, "maxChildTokenSize is required");
this.maxParentTokenSize = java.util.Objects.requireNonNull(builder.maxParentTokenSize, "maxParentTokenSize is required");
this.overlapTokens = java.util.Objects.requireNonNull(builder.overlapTokens, "overlapTokens is required");
}
@Override
public final java.lang.Number getMaxChildTokenSize() {
return this.maxChildTokenSize;
}
@Override
public final java.lang.Number getMaxParentTokenSize() {
return this.maxParentTokenSize;
}
@Override
public final java.lang.Number getOverlapTokens() {
return this.overlapTokens;
}
@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("maxChildTokenSize", om.valueToTree(this.getMaxChildTokenSize()));
data.set("maxParentTokenSize", om.valueToTree(this.getMaxParentTokenSize()));
data.set("overlapTokens", om.valueToTree(this.getOverlapTokens()));
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.HierarchicalChunkingProps"));
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;
HierarchicalChunkingProps.Jsii$Proxy that = (HierarchicalChunkingProps.Jsii$Proxy) o;
if (!maxChildTokenSize.equals(that.maxChildTokenSize)) return false;
if (!maxParentTokenSize.equals(that.maxParentTokenSize)) return false;
return this.overlapTokens.equals(that.overlapTokens);
}
@Override
public final int hashCode() {
int result = this.maxChildTokenSize.hashCode();
result = 31 * result + (this.maxParentTokenSize.hashCode());
result = 31 * result + (this.overlapTokens.hashCode());
return result;
}
}
}