Class ThreadMessage

java.lang.Object
com.azure.ai.agents.persistent.models.ThreadMessage
All Implemented Interfaces:
com.azure.json.JsonSerializable<ThreadMessage>

public final class ThreadMessage extends Object implements com.azure.json.JsonSerializable<ThreadMessage>
A single, existing message within an agent thread.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of ThreadMessage from the JsonReader.
    Get the assistantId property: If applicable, the ID of the agent that authored this message.
    Get the attachments property: A list of files attached to the message, and the tools they were added to.
    Get the completedAt property: The Unix timestamp (in seconds) for when the message was completed.
    Get the content property: The list of content items associated with the agent thread message.
    Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created.
    Get the id property: The identifier, which can be referenced in API endpoints.
    Get the incompleteAt property: The Unix timestamp (in seconds) for when the message was marked as incomplete.
    Get the incompleteDetails property: On an incomplete message, details about why the message is incomplete.
    Get the metadata property: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format.
    Get the object property: The object type, which is always 'thread.message'.
    Get the role property: The role associated with the agent thread message.
    Get the runId property: If applicable, the ID of the run associated with the authoring of this message.
    Get the status property: The status of the message.
    Get the threadId property: The ID of the thread that this message belongs to.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Method Details

    • getId

      public String getId()
      Get the id property: The identifier, which can be referenced in API endpoints.
      Returns:
      the id value.
    • getObject

      public String getObject()
      Get the object property: The object type, which is always 'thread.message'.
      Returns:
      the object value.
    • getCreatedAt

      public OffsetDateTime getCreatedAt()
      Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created.
      Returns:
      the createdAt value.
    • getThreadId

      public String getThreadId()
      Get the threadId property: The ID of the thread that this message belongs to.
      Returns:
      the threadId value.
    • getStatus

      public MessageStatus getStatus()
      Get the status property: The status of the message.
      Returns:
      the status value.
    • getIncompleteDetails

      public MessageIncompleteDetails getIncompleteDetails()
      Get the incompleteDetails property: On an incomplete message, details about why the message is incomplete.
      Returns:
      the incompleteDetails value.
    • getCompletedAt

      public OffsetDateTime getCompletedAt()
      Get the completedAt property: The Unix timestamp (in seconds) for when the message was completed.
      Returns:
      the completedAt value.
    • getIncompleteAt

      public OffsetDateTime getIncompleteAt()
      Get the incompleteAt property: The Unix timestamp (in seconds) for when the message was marked as incomplete.
      Returns:
      the incompleteAt value.
    • getRole

      public MessageRole getRole()
      Get the role property: The role associated with the agent thread message.
      Returns:
      the role value.
    • getContent

      public List<MessageContent> getContent()
      Get the content property: The list of content items associated with the agent thread message.
      Returns:
      the content value.
    • getAssistantId

      public String getAssistantId()
      Get the assistantId property: If applicable, the ID of the agent that authored this message.
      Returns:
      the assistantId value.
    • getRunId

      public String getRunId()
      Get the runId property: If applicable, the ID of the run associated with the authoring of this message.
      Returns:
      the runId value.
    • getAttachments

      public List<MessageAttachment> getAttachments()
      Get the attachments property: A list of files attached to the message, and the tools they were added to.
      Returns:
      the attachments value.
    • getMetadata

      public Map<String,String> getMetadata()
      Get the metadata property: A set of up to 16 key/value pairs that can be attached to an object, used for storing additional information about that object in a structured format. Keys may be up to 64 characters in length and values may be up to 512 characters in length.
      Returns:
      the metadata value.
    • toJson

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

      public static ThreadMessage fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of ThreadMessage from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of ThreadMessage 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 ThreadMessage.