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

com.amazonaws.services.bedrockagent.model.ChunkingConfiguration Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Agents for Amazon Bedrock module holds the client classes that are used for communicating with Agents for Amazon Bedrock Service

The newest version!
/*
 * Copyright 2019-2024 Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */
package com.amazonaws.services.bedrockagent.model;

import java.io.Serializable;
import javax.annotation.Generated;
import com.amazonaws.protocol.StructuredPojo;
import com.amazonaws.protocol.ProtocolMarshaller;

/**
 * 

* Details about how to chunk the documents in the data source. A chunk refers to an excerpt from a data source * that is returned when the knowledge base that it belongs to is queried. *

* * @see AWS API Documentation */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class ChunkingConfiguration implements Serializable, Cloneable, StructuredPojo { /** *

* Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data source * that is returned when the knowledge base that it belongs to is queried. You have the following options for * chunking your data. If you opt for NONE, then you may want to pre-process your files by splitting * them up such that each file corresponds to a chunk. *

*
    *
  • *

    * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that you set * in the fixedSizeChunkingConfiguration. *

    *
  • *
  • *

    * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large chunks, * and the second layer contains smaller chunks derived from the first layer. *

    *
  • *
  • *

    * SEMANTIC – Split documents into chunks based on groups of similar content derived with natural * language processing. *

    *
  • *
  • *

    * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want to * pre-process your documents by splitting them into separate files. *

    *
  • *
*/ private String chunkingStrategy; /** *

* Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. *

*/ private FixedSizeChunkingConfiguration fixedSizeChunkingConfiguration; /** *

* Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents into layers * of chunks where the first layer contains large chunks, and the second layer contains smaller chunks derived from * the first layer. *

*/ private HierarchicalChunkingConfiguration hierarchicalChunkingConfiguration; /** *

* Settings for semantic document chunking for a data source. Semantic chunking splits a document into into smaller * documents based on groups of similar content derived from the text with natural language processing. *

*/ private SemanticChunkingConfiguration semanticChunkingConfiguration; /** *

* Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data source * that is returned when the knowledge base that it belongs to is queried. You have the following options for * chunking your data. If you opt for NONE, then you may want to pre-process your files by splitting * them up such that each file corresponds to a chunk. *

*
    *
  • *

    * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that you set * in the fixedSizeChunkingConfiguration. *

    *
  • *
  • *

    * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large chunks, * and the second layer contains smaller chunks derived from the first layer. *

    *
  • *
  • *

    * SEMANTIC – Split documents into chunks based on groups of similar content derived with natural * language processing. *

    *
  • *
  • *

    * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want to * pre-process your documents by splitting them into separate files. *

    *
  • *
* * @param chunkingStrategy * Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data * source that is returned when the knowledge base that it belongs to is queried. You have the following * options for chunking your data. If you opt for NONE, then you may want to pre-process your * files by splitting them up such that each file corresponds to a chunk.

*
    *
  • *

    * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that * you set in the fixedSizeChunkingConfiguration. *

    *
  • *
  • *

    * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large * chunks, and the second layer contains smaller chunks derived from the first layer. *

    *
  • *
  • *

    * SEMANTIC – Split documents into chunks based on groups of similar content derived with * natural language processing. *

    *
  • *
  • *

    * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want * to pre-process your documents by splitting them into separate files. *

    *
  • * @see ChunkingStrategy */ public void setChunkingStrategy(String chunkingStrategy) { this.chunkingStrategy = chunkingStrategy; } /** *

    * Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data source * that is returned when the knowledge base that it belongs to is queried. You have the following options for * chunking your data. If you opt for NONE, then you may want to pre-process your files by splitting * them up such that each file corresponds to a chunk. *

    *
      *
    • *

      * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that you set * in the fixedSizeChunkingConfiguration. *

      *
    • *
    • *

      * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large chunks, * and the second layer contains smaller chunks derived from the first layer. *

      *
    • *
    • *

      * SEMANTIC – Split documents into chunks based on groups of similar content derived with natural * language processing. *

      *
    • *
    • *

      * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want to * pre-process your documents by splitting them into separate files. *

      *
    • *
    * * @return Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data * source that is returned when the knowledge base that it belongs to is queried. You have the following * options for chunking your data. If you opt for NONE, then you may want to pre-process your * files by splitting them up such that each file corresponds to a chunk.

    *
      *
    • *

      * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that * you set in the fixedSizeChunkingConfiguration. *

      *
    • *
    • *

      * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large * chunks, and the second layer contains smaller chunks derived from the first layer. *

      *
    • *
    • *

      * SEMANTIC – Split documents into chunks based on groups of similar content derived with * natural language processing. *

      *
    • *
    • *

      * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want * to pre-process your documents by splitting them into separate files. *

      *
    • * @see ChunkingStrategy */ public String getChunkingStrategy() { return this.chunkingStrategy; } /** *

      * Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data source * that is returned when the knowledge base that it belongs to is queried. You have the following options for * chunking your data. If you opt for NONE, then you may want to pre-process your files by splitting * them up such that each file corresponds to a chunk. *

      *
        *
      • *

        * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that you set * in the fixedSizeChunkingConfiguration. *

        *
      • *
      • *

        * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large chunks, * and the second layer contains smaller chunks derived from the first layer. *

        *
      • *
      • *

        * SEMANTIC – Split documents into chunks based on groups of similar content derived with natural * language processing. *

        *
      • *
      • *

        * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want to * pre-process your documents by splitting them into separate files. *

        *
      • *
      * * @param chunkingStrategy * Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data * source that is returned when the knowledge base that it belongs to is queried. You have the following * options for chunking your data. If you opt for NONE, then you may want to pre-process your * files by splitting them up such that each file corresponds to a chunk.

      *
        *
      • *

        * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that * you set in the fixedSizeChunkingConfiguration. *

        *
      • *
      • *

        * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large * chunks, and the second layer contains smaller chunks derived from the first layer. *

        *
      • *
      • *

        * SEMANTIC – Split documents into chunks based on groups of similar content derived with * natural language processing. *

        *
      • *
      • *

        * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want * to pre-process your documents by splitting them into separate files. *

        *
      • * @return Returns a reference to this object so that method calls can be chained together. * @see ChunkingStrategy */ public ChunkingConfiguration withChunkingStrategy(String chunkingStrategy) { setChunkingStrategy(chunkingStrategy); return this; } /** *

        * Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data source * that is returned when the knowledge base that it belongs to is queried. You have the following options for * chunking your data. If you opt for NONE, then you may want to pre-process your files by splitting * them up such that each file corresponds to a chunk. *

        *
          *
        • *

          * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that you set * in the fixedSizeChunkingConfiguration. *

          *
        • *
        • *

          * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large chunks, * and the second layer contains smaller chunks derived from the first layer. *

          *
        • *
        • *

          * SEMANTIC – Split documents into chunks based on groups of similar content derived with natural * language processing. *

          *
        • *
        • *

          * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want to * pre-process your documents by splitting them into separate files. *

          *
        • *
        * * @param chunkingStrategy * Knowledge base can split your source data into chunks. A chunk refers to an excerpt from a data * source that is returned when the knowledge base that it belongs to is queried. You have the following * options for chunking your data. If you opt for NONE, then you may want to pre-process your * files by splitting them up such that each file corresponds to a chunk.

        *
          *
        • *

          * FIXED_SIZE – Amazon Bedrock splits your source data into chunks of the approximate size that * you set in the fixedSizeChunkingConfiguration. *

          *
        • *
        • *

          * HIERARCHICAL – Split documents into layers of chunks where the first layer contains large * chunks, and the second layer contains smaller chunks derived from the first layer. *

          *
        • *
        • *

          * SEMANTIC – Split documents into chunks based on groups of similar content derived with * natural language processing. *

          *
        • *
        • *

          * NONE – Amazon Bedrock treats each file as one chunk. If you choose this option, you may want * to pre-process your documents by splitting them into separate files. *

          *
        • * @return Returns a reference to this object so that method calls can be chained together. * @see ChunkingStrategy */ public ChunkingConfiguration withChunkingStrategy(ChunkingStrategy chunkingStrategy) { this.chunkingStrategy = chunkingStrategy.toString(); return this; } /** *

          * Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. *

          * * @param fixedSizeChunkingConfiguration * Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. */ public void setFixedSizeChunkingConfiguration(FixedSizeChunkingConfiguration fixedSizeChunkingConfiguration) { this.fixedSizeChunkingConfiguration = fixedSizeChunkingConfiguration; } /** *

          * Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. *

          * * @return Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. */ public FixedSizeChunkingConfiguration getFixedSizeChunkingConfiguration() { return this.fixedSizeChunkingConfiguration; } /** *

          * Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. *

          * * @param fixedSizeChunkingConfiguration * Configurations for when you choose fixed-size chunking. If you set the chunkingStrategy as * NONE, exclude this field. * @return Returns a reference to this object so that method calls can be chained together. */ public ChunkingConfiguration withFixedSizeChunkingConfiguration(FixedSizeChunkingConfiguration fixedSizeChunkingConfiguration) { setFixedSizeChunkingConfiguration(fixedSizeChunkingConfiguration); return this; } /** *

          * Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents into layers * of chunks where the first layer contains large chunks, and the second layer contains smaller chunks derived from * the first layer. *

          * * @param hierarchicalChunkingConfiguration * Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents into * layers of chunks where the first layer contains large chunks, and the second layer contains smaller chunks * derived from the first layer. */ public void setHierarchicalChunkingConfiguration(HierarchicalChunkingConfiguration hierarchicalChunkingConfiguration) { this.hierarchicalChunkingConfiguration = hierarchicalChunkingConfiguration; } /** *

          * Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents into layers * of chunks where the first layer contains large chunks, and the second layer contains smaller chunks derived from * the first layer. *

          * * @return Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents * into layers of chunks where the first layer contains large chunks, and the second layer contains smaller * chunks derived from the first layer. */ public HierarchicalChunkingConfiguration getHierarchicalChunkingConfiguration() { return this.hierarchicalChunkingConfiguration; } /** *

          * Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents into layers * of chunks where the first layer contains large chunks, and the second layer contains smaller chunks derived from * the first layer. *

          * * @param hierarchicalChunkingConfiguration * Settings for hierarchical document chunking for a data source. Hierarchical chunking splits documents into * layers of chunks where the first layer contains large chunks, and the second layer contains smaller chunks * derived from the first layer. * @return Returns a reference to this object so that method calls can be chained together. */ public ChunkingConfiguration withHierarchicalChunkingConfiguration(HierarchicalChunkingConfiguration hierarchicalChunkingConfiguration) { setHierarchicalChunkingConfiguration(hierarchicalChunkingConfiguration); return this; } /** *

          * Settings for semantic document chunking for a data source. Semantic chunking splits a document into into smaller * documents based on groups of similar content derived from the text with natural language processing. *

          * * @param semanticChunkingConfiguration * Settings for semantic document chunking for a data source. Semantic chunking splits a document into into * smaller documents based on groups of similar content derived from the text with natural language * processing. */ public void setSemanticChunkingConfiguration(SemanticChunkingConfiguration semanticChunkingConfiguration) { this.semanticChunkingConfiguration = semanticChunkingConfiguration; } /** *

          * Settings for semantic document chunking for a data source. Semantic chunking splits a document into into smaller * documents based on groups of similar content derived from the text with natural language processing. *

          * * @return Settings for semantic document chunking for a data source. Semantic chunking splits a document into into * smaller documents based on groups of similar content derived from the text with natural language * processing. */ public SemanticChunkingConfiguration getSemanticChunkingConfiguration() { return this.semanticChunkingConfiguration; } /** *

          * Settings for semantic document chunking for a data source. Semantic chunking splits a document into into smaller * documents based on groups of similar content derived from the text with natural language processing. *

          * * @param semanticChunkingConfiguration * Settings for semantic document chunking for a data source. Semantic chunking splits a document into into * smaller documents based on groups of similar content derived from the text with natural language * processing. * @return Returns a reference to this object so that method calls can be chained together. */ public ChunkingConfiguration withSemanticChunkingConfiguration(SemanticChunkingConfiguration semanticChunkingConfiguration) { setSemanticChunkingConfiguration(semanticChunkingConfiguration); return this; } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getChunkingStrategy() != null) sb.append("ChunkingStrategy: ").append(getChunkingStrategy()).append(","); if (getFixedSizeChunkingConfiguration() != null) sb.append("FixedSizeChunkingConfiguration: ").append(getFixedSizeChunkingConfiguration()).append(","); if (getHierarchicalChunkingConfiguration() != null) sb.append("HierarchicalChunkingConfiguration: ").append(getHierarchicalChunkingConfiguration()).append(","); if (getSemanticChunkingConfiguration() != null) sb.append("SemanticChunkingConfiguration: ").append(getSemanticChunkingConfiguration()); sb.append("}"); return sb.toString(); } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof ChunkingConfiguration == false) return false; ChunkingConfiguration other = (ChunkingConfiguration) obj; if (other.getChunkingStrategy() == null ^ this.getChunkingStrategy() == null) return false; if (other.getChunkingStrategy() != null && other.getChunkingStrategy().equals(this.getChunkingStrategy()) == false) return false; if (other.getFixedSizeChunkingConfiguration() == null ^ this.getFixedSizeChunkingConfiguration() == null) return false; if (other.getFixedSizeChunkingConfiguration() != null && other.getFixedSizeChunkingConfiguration().equals(this.getFixedSizeChunkingConfiguration()) == false) return false; if (other.getHierarchicalChunkingConfiguration() == null ^ this.getHierarchicalChunkingConfiguration() == null) return false; if (other.getHierarchicalChunkingConfiguration() != null && other.getHierarchicalChunkingConfiguration().equals(this.getHierarchicalChunkingConfiguration()) == false) return false; if (other.getSemanticChunkingConfiguration() == null ^ this.getSemanticChunkingConfiguration() == null) return false; if (other.getSemanticChunkingConfiguration() != null && other.getSemanticChunkingConfiguration().equals(this.getSemanticChunkingConfiguration()) == false) return false; return true; } @Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getChunkingStrategy() == null) ? 0 : getChunkingStrategy().hashCode()); hashCode = prime * hashCode + ((getFixedSizeChunkingConfiguration() == null) ? 0 : getFixedSizeChunkingConfiguration().hashCode()); hashCode = prime * hashCode + ((getHierarchicalChunkingConfiguration() == null) ? 0 : getHierarchicalChunkingConfiguration().hashCode()); hashCode = prime * hashCode + ((getSemanticChunkingConfiguration() == null) ? 0 : getSemanticChunkingConfiguration().hashCode()); return hashCode; } @Override public ChunkingConfiguration clone() { try { return (ChunkingConfiguration) super.clone(); } catch (CloneNotSupportedException e) { throw new IllegalStateException("Got a CloneNotSupportedException from Object.clone() " + "even though we're Cloneable!", e); } } @com.amazonaws.annotation.SdkInternalApi @Override public void marshall(ProtocolMarshaller protocolMarshaller) { com.amazonaws.services.bedrockagent.model.transform.ChunkingConfigurationMarshaller.getInstance().marshall(this, protocolMarshaller); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy