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 Summary
ConstructorsConstructorDescriptionThreadMessage
(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. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadMessage
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of ThreadMessage from the JsonReader.Get the assistantId property: If applicable, the ID of the assistant 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 assistant thread message.Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created.getId()
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'.getRole()
Get the role property: The role associated with the assistant thread message.getRunId()
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
-
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
Get the id property: The identifier, which can be referenced in API endpoints.- Returns:
- the id value.
-
getObject
Get the object property: The object type, which is always 'thread.message'.- Returns:
- the object value.
-
getCreatedAt
Get the createdAt property: The Unix timestamp, in seconds, representing when this object was created.- Returns:
- the createdAt value.
-
getThreadId
Get the threadId property: The ID of the thread that this message belongs to.- Returns:
- the threadId value.
-
getRole
Get the role property: The role associated with the assistant thread message.- Returns:
- the role value.
-
getContent
Get the content property: The list of content items associated with the assistant thread message.- Returns:
- the content value.
-
getAssistantId
Get the assistantId property: If applicable, the ID of the assistant that authored this message.- Returns:
- the assistantId value.
-
getRunId
Get the runId property: If applicable, the ID of the run associated with the authoring of this message.- Returns:
- the runId value.
-
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
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<ThreadMessage>
- Throws:
IOException
-
fromJson
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
Get the status property: The status of the message.- Returns:
- the status value.
-
getIncompleteDetails
Get the incompleteDetails property: On an incomplete message, details about why the message is incomplete.- Returns:
- the incompleteDetails value.
-
getCompletedAt
Get the completedAt property: The Unix timestamp (in seconds) for when the message was completed.- Returns:
- the completedAt value.
-
getIncompleteAt
Get the incompleteAt property: The Unix timestamp (in seconds) for when the message was marked as incomplete.- Returns:
- the incompleteAt value.
-
getAttachments
Get the attachments property: A list of files attached to the message, and the tools they were added to.- Returns:
- the attachments value.
-