Class OpenAiUserMessage

java.lang.Object
com.sap.ai.sdk.foundationmodels.openai.OpenAiUserMessage
All Implemented Interfaces:
OpenAiMessage

public final class OpenAiUserMessage extends Object implements OpenAiMessage
Represents a chat message as 'user' to OpenAI service. *
Since:
1.4.0
  • Method Details

    • withText

      @Nonnull public OpenAiUserMessage withText(@Nonnull String message)
      Add text to the message.
      Parameters:
      message - the text to add.
      Returns:
      the new message.
    • withImage

      @Nonnull public OpenAiUserMessage withImage(@Nonnull String imageUrl, @Nonnull OpenAiImageItem.DetailLevel detailLevel)
      Add an image to the message with the given image URL and detail level.
      Parameters:
      imageUrl - the URL of the image.
      detailLevel - the detail level of the image.
      Returns:
      the new message.
    • withImage

      @Nonnull public OpenAiUserMessage withImage(@Nonnull String imageUrl)
      Add an image to the message with the given image URL.
      Parameters:
      imageUrl - the URL of the image.
      Returns:
      the new message.
    • role

      @Nonnull public String role()
      The role associated with this message.
      Specified by:
      role in interface OpenAiMessage
      Returns:
      the role.
    • equals

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

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

      public String toString()
      Overrides:
      toString in class Object
    • content

      @Nonnull public OpenAiMessageContent content()
      The content of the message.
      Specified by:
      content in interface OpenAiMessage
      Returns:
      the content.