Class Chunk

java.lang.Object
com.sap.ai.sdk.grounding.model.Chunk

public class Chunk extends Object
Chunk
  • Constructor Details

    • Chunk

      protected Chunk()
      Default constructor for Chunk.
  • Method Details

    • id

      @Nonnull public Chunk id(@Nonnull String id)
      Set the id of this Chunk instance and return the same instance.
      Parameters:
      id - The id of this Chunk
      Returns:
      The same instance of this Chunk class
    • getId

      @Nonnull public String getId()
      Get id
      Returns:
      id The id of this Chunk instance.
    • setId

      public void setId(@Nonnull String id)
      Set the id of this Chunk instance.
      Parameters:
      id - The id of this Chunk
    • content

      @Nonnull public Chunk content(@Nonnull String content)
      Set the content of this Chunk instance and return the same instance.
      Parameters:
      content - The content of this Chunk
      Returns:
      The same instance of this Chunk class
    • getContent

      @Nonnull public String getContent()
      Get content
      Returns:
      content The content of this Chunk instance.
    • setContent

      public void setContent(@Nonnull String content)
      Set the content of this Chunk instance.
      Parameters:
      content - The content of this Chunk
    • metadata

      @Nonnull public Chunk metadata(@Nullable List<KeyValueListPair> metadata)
      Set the metadata of this Chunk instance and return the same instance.
      Parameters:
      metadata - The metadata of this Chunk
      Returns:
      The same instance of this Chunk class
    • addMetadataItem

      @Nonnull public Chunk addMetadataItem(@Nonnull KeyValueListPair metadataItem)
      Add one metadata instance to this Chunk.
      Parameters:
      metadataItem - The metadata that should be added
      Returns:
      The same instance of type Chunk
    • getMetadata

      @Nonnull public List<KeyValueListPair> getMetadata()
      Get metadata
      Returns:
      metadata The metadata of this Chunk instance.
    • setMetadata

      public void setMetadata(@Nullable List<KeyValueListPair> metadata)
      Set the metadata of this Chunk instance.
      Parameters:
      metadata - The metadata of this Chunk
    • getCustomFieldNames

      @Nonnull public Set<String> getCustomFieldNames()
      Get the names of the unrecognizable properties of the Chunk.
      Returns:
      The set of properties names
    • getCustomField

      @Nullable @Deprecated public Object getCustomField(@Nonnull String name) throws NoSuchElementException
      Deprecated.
      Use toMap() instead.
      Get the value of an unrecognizable property of this Chunk instance.
      Parameters:
      name - The name of the property
      Returns:
      The value of the property
      Throws:
      NoSuchElementException - If no property with the given name could be found.
    • toMap

      @Nonnull public Map<String,Object> toMap()
      Get the value of all properties of this Chunk instance including unrecognized properties.
      Returns:
      The map of all properties
    • setCustomField

      public void setCustomField(@Nonnull String customFieldName, @Nullable Object customFieldValue)
      Set an unrecognizable property of this Chunk instance. If the map previously contained a mapping for the key, the old value is replaced by the specified value.
      Parameters:
      customFieldName - The name of the property
      customFieldValue - The value of the property
    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object
    • create

      public static Chunk.Builder create()
      Create a type-safe, fluent-api builder object to construct a new Chunk instance with all required arguments.