Class ThreadMessage

java.lang.Object
com.azure.ai.openai.assistants.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 assistant thread.
  • Constructor Details

    • ThreadMessage

      public ThreadMessage(String id, OffsetDateTime createdAt, String threadId, MessageStatus status, MessageIncompleteDetails incompleteDetails, OffsetDateTime completedAt, OffsetDateTime incompleteAt, MessageRole role, List<MessageContent> content, String assistantId, String runId, List<MessageAttachment> attachments, Map<String,String> metadata)
      Creates an instance of ThreadMessage class.
      Parameters:
      id - the id value to set.
      createdAt - the createdAt value to set.
      threadId - the threadId value to set.
      status - the status value to set.
      incompleteDetails - the incompleteDetails value to set.
      completedAt - the completedAt value to set.
      incompleteAt - the incompleteAt value to set.
      role - the role value to set.
      content - the content value to set.
      assistantId - the assistantId value to set.
      runId - the runId value to set.
      attachments - the attachments value to set.
      metadata - the metadata value to set.
  • 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.
    • getRole

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

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

      public String getAssistantId()
      Get the assistantId property: If applicable, the ID of the assistant 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.
    • 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.
    • 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.
    • 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.