Class UserMessage

java.lang.Object
org.springframework.ai.chat.messages.AbstractMessage
org.springframework.ai.chat.messages.UserMessage
All Implemented Interfaces:
Message, org.springframework.ai.content.Content, org.springframework.ai.content.MediaContent

public class UserMessage extends AbstractMessage implements org.springframework.ai.content.MediaContent
A message of the type 'user' passed as input Messages with the user role are from the end-user or developer. They represent questions, prompts, or any input that you want the generative to respond to.
  • Field Details

    • media

      protected final List<org.springframework.ai.content.Media> media
  • Constructor Details

    • UserMessage

      public UserMessage(String textContent)
    • UserMessage

      public UserMessage(org.springframework.core.io.Resource resource)
  • Method Details

    • toString

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

      @NonNull public String getText()
      Description copied from class: AbstractMessage
      Get the content of the message.
      Specified by:
      getText in interface org.springframework.ai.content.Content
      Overrides:
      getText in class AbstractMessage
      Returns:
      the content of the message
    • getMedia

      public List<org.springframework.ai.content.Media> getMedia()
      Specified by:
      getMedia in interface org.springframework.ai.content.MediaContent
    • copy

      public UserMessage copy()
    • mutate

      public UserMessage.Builder mutate()
    • builder

      public static UserMessage.Builder builder()