Class Document

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

public class Document extends Object
Document
  • Constructor Details

    • Document

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

    • id

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

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

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

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

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

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

      public void setMetadata(@Nullable List<RetrievalDocumentKeyValueListPair> metadata)
      Set the metadata of this Document instance.
      Parameters:
      metadata - The metadata of this Document
    • chunks

      @Nonnull public Document chunks(@Nonnull List<RetrievalChunk> chunks)
      Set the chunks of this Document instance and return the same instance.
      Parameters:
      chunks - The chunks of this Document
      Returns:
      The same instance of this Document class
    • addChunksItem

      @Nonnull public Document addChunksItem(@Nonnull RetrievalChunk chunksItem)
      Add one chunks instance to this Document.
      Parameters:
      chunksItem - The chunks that should be added
      Returns:
      The same instance of type Document
    • getChunks

      @Nonnull public List<RetrievalChunk> getChunks()
      Get chunks
      Returns:
      chunks The chunks of this Document instance.
    • setChunks

      public void setChunks(@Nonnull List<RetrievalChunk> chunks)
      Set the chunks of this Document instance.
      Parameters:
      chunks - The chunks of this Document
    • getCustomFieldNames

      @Nonnull public Set<String> getCustomFieldNames()
      Get the names of the unrecognizable properties of the Document.
      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 Document 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 Document 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 Document 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 Document.Builder create()
      Create a type-safe, fluent-api builder object to construct a new Document instance with all required arguments.