Class TextItem

java.lang.Object
com.sap.ai.sdk.orchestration.TextItem
All Implemented Interfaces:
CacheablePrompt, ContentItem

public final class TextItem extends Object implements ContentItem, CacheablePrompt
Represents a text item in a MessageContent object.
Since:
1.3.0
  • Constructor Details

    • TextItem

      public TextItem(@Nonnull String text, @Nullable CacheControl cacheControl)
      Constructs text item
      Parameters:
      text - - text content
      cacheControl - - nullable cache control param
    • TextItem

      public TextItem(@Nonnull String text)
      Compatibility constructor conforming with the previous API to avoid breaking changes
      Parameters:
      text - value of the item
  • Method Details

    • text

      @Nonnull public String text()
      Compatibility method to support conversion from record to class without breaking changes, the same as getText()
      Returns:
      text
    • equals

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

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

      public String getText()
    • getCacheControl

      public CacheControl getCacheControl()
      Description copied from interface: CacheablePrompt
      Returns cache control for a given cacheable prompt (if set)
      Specified by:
      getCacheControl in interface CacheablePrompt
      Returns:
      cacheControl, nullable
    • toString

      public String toString()
      Overrides:
      toString in class Object