Class ChatMessage

java.lang.Object
com.azure.ai.openai.models.ChatMessage

public final class ChatMessage extends Object
A single, role-attributed message within a chat completion interaction.
  • Constructor Details

    • ChatMessage

      public ChatMessage(ChatRole role, String content)
      Creates an instance of ChatMessage class.
      Parameters:
      role - the role value to set.
      content - the content value to set.
  • Method Details

    • getRole

      public ChatRole getRole()
      Get the role property: The role associated with this message payload.
      Returns:
      the role value.
    • getContent

      public String getContent()
      Get the content property: The text associated with this message payload.
      Returns:
      the content value.
    • getName

      public String getName()
      Get the name property: The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
      Returns:
      the name value.
    • setName

      public ChatMessage setName(String name)
      Set the name property: The name of the author of this message. `name` is required if role is `function`, and it should be the name of the function whose response is in the `content`. May contain a-z, A-Z, 0-9, and underscores, with a maximum length of 64 characters.
      Parameters:
      name - the name value to set.
      Returns:
      the ChatMessage object itself.
    • getFunctionCall

      public FunctionCall getFunctionCall()
      Get the functionCall property: The name and arguments of a function that should be called, as generated by the model.
      Returns:
      the functionCall value.
    • setFunctionCall

      public ChatMessage setFunctionCall(FunctionCall functionCall)
      Set the functionCall property: The name and arguments of a function that should be called, as generated by the model.
      Parameters:
      functionCall - the functionCall value to set.
      Returns:
      the ChatMessage object itself.