Class ChatRequestUserMessage

java.lang.Object
com.azure.ai.openai.models.ChatRequestMessage
com.azure.ai.openai.models.ChatRequestUserMessage
All Implemented Interfaces:
com.azure.json.JsonSerializable<ChatRequestMessage>

public final class ChatRequestUserMessage extends ChatRequestMessage
A request chat message representing user input to the assistant.
  • Constructor Details

    • ChatRequestUserMessage

      public ChatRequestUserMessage(String content)
      Creates a new instance of ChatRequestUserMessage using plain text content.
      Parameters:
      content - The plain text content associated with the message.
    • ChatRequestUserMessage

      public ChatRequestUserMessage(ChatMessageContentItem[] content)
      Creates a new instance of ChatRequestUserMessage using a collection of structured content.
      Parameters:
      content - The collection of structured content associated with the message.
    • ChatRequestUserMessage

      public ChatRequestUserMessage(List<ChatMessageContentItem> content)
      Creates a new instance of ChatRequestUserMessage using a collection of structured content.
      Parameters:
      content - The collection of structured content associated with the message.
  • Method Details

    • getContent

      public com.azure.core.util.BinaryData getContent()
      Get the content property: The contents of the user message, with available input types varying by selected model.
      Returns:
      the content value.
    • getName

      public String getName()
      Get the name property: An optional name for the participant.
      Returns:
      the name value.
    • setName

      public ChatRequestUserMessage setName(String name)
      Set the name property: An optional name for the participant.
      Parameters:
      name - the name value to set.
      Returns:
      the ChatRequestUserMessage object itself.
    • getRole

      public ChatRole getRole()
      Get the role property: The chat role associated with this message.
      Overrides:
      getRole in class ChatRequestMessage
      Returns:
      the role value.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<ChatRequestMessage>
      Overrides:
      toJson in class ChatRequestMessage
      Throws:
      IOException
    • fromJson

      public static ChatRequestUserMessage fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of ChatRequestUserMessage from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of ChatRequestUserMessage if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the ChatRequestUserMessage.