Class ThreadMessageOptions
java.lang.Object
com.azure.ai.openai.assistants.models.ThreadMessageOptions
- All Implemented Interfaces:
com.azure.json.JsonSerializable<ThreadMessageOptions>
public final class ThreadMessageOptions
extends Object
implements com.azure.json.JsonSerializable<ThreadMessageOptions>
A single message within an assistant thread, as provided during that thread's creation for its initial state.
-
Constructor Summary
ConstructorsConstructorDescriptionThreadMessageOptions
(MessageRole role, String content) Creates an instance of ThreadMessageOptions class. -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadMessageOptions
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of ThreadMessageOptions from the JsonReader.Get the attachments property: A list of files attached to the message, and the tools they should be added to.Get the content property: The textual content of the initial message.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.getRole()
Get the role property: The role of the entity that is creating the message.setAttachments
(List<MessageAttachment> attachments) Set the attachments property: A list of files attached to the message, and the tools they should be added to.setMetadata
(Map<String, String> metadata) Set 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.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
-
ThreadMessageOptions
Creates an instance of ThreadMessageOptions class.- Parameters:
role
- the role value to set.content
- the content value to set.
-
-
Method Details
-
getRole
Get the role property: The role of the entity that is creating the message. Allowed values include: - `user`: Indicates the message is sent by an actual user and should be used in most cases to represent user-generated messages. - `assistant`: Indicates the message is generated by the assistant. Use this value to insert messages from the assistant into the conversation.- Returns:
- the role value.
-
getContent
Get the content property: The textual content of the initial message. Currently, robust input including images and annotated text may only be provided via a separate call to the create message API.- Returns:
- the content value.
-
getAttachments
Get the attachments property: A list of files attached to the message, and the tools they should be added to.- Returns:
- the attachments value.
-
setAttachments
Set the attachments property: A list of files attached to the message, and the tools they should be added to.- Parameters:
attachments
- the attachments value to set.- Returns:
- the ThreadMessageOptions object itself.
-
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.
-
setMetadata
Set 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.- Parameters:
metadata
- the metadata value to set.- Returns:
- the ThreadMessageOptions object itself.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<ThreadMessageOptions>
- Throws:
IOException
-
fromJson
public static ThreadMessageOptions fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of ThreadMessageOptions from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of ThreadMessageOptions 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 ThreadMessageOptions.
-