ThreadMessageOptions Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
ThreadMessageOptions(MessageRole, BinaryData) |
Initializes a new instance of ThreadMessageOptions. |
ThreadMessageOptions(MessageRole, IEnumerable<MessageInputContentBlock>) |
Initializes a new instance of the ThreadMessageOptions class, converting one or more structured blocks into JSON and storing them as Content. |
ThreadMessageOptions(MessageRole, String) |
Initializes a new instance of the ThreadMessageOptions class, setting the message content to a single, plain-text string. |
ThreadMessageOptions(MessageRole, BinaryData)
- Source:
- ThreadMessageOptions.cs
- Source:
- ThreadMessageOptions.cs
Initializes a new instance of ThreadMessageOptions.
public ThreadMessageOptions(Azure.AI.Agents.Persistent.MessageRole role, BinaryData content);
new Azure.AI.Agents.Persistent.ThreadMessageOptions : Azure.AI.Agents.Persistent.MessageRole * BinaryData -> Azure.AI.Agents.Persistent.ThreadMessageOptions
Public Sub New (role As MessageRole, content As BinaryData)
Parameters
- role
- MessageRole
The role of the entity that is creating the message. Allowed values include:
user
, which indicates the message is sent by an actual user (and should be
used in most cases to represent user-generated messages), and assistant
,
which indicates the message is generated by the agent (use this value to insert
messages from the agent into the conversation).
- content
- BinaryData
The content of the initial message. This may be a basic string (if you only need text) or an array of typed content blocks (for example, text, image_file, image_url, and so on).
Exceptions
content
is null.
Applies to
ThreadMessageOptions(MessageRole, IEnumerable<MessageInputContentBlock>)
- Source:
- ThreadMessageOptions.cs
- Source:
- ThreadMessageOptions.cs
Initializes a new instance of the ThreadMessageOptions class, converting one or more structured blocks into JSON and storing them as Content.
public ThreadMessageOptions(Azure.AI.Agents.Persistent.MessageRole role, System.Collections.Generic.IEnumerable<Azure.AI.Agents.Persistent.MessageInputContentBlock> contentBlocks);
new Azure.AI.Agents.Persistent.ThreadMessageOptions : Azure.AI.Agents.Persistent.MessageRole * seq<Azure.AI.Agents.Persistent.MessageInputContentBlock> -> Azure.AI.Agents.Persistent.ThreadMessageOptions
Public Sub New (role As MessageRole, contentBlocks As IEnumerable(Of MessageInputContentBlock))
Parameters
- role
- MessageRole
The role of the entity creating the message (e.g., user or agent). Valid values typically include User or Agent.
- contentBlocks
- IEnumerable<MessageInputContentBlock>
A collection of specialized content blocks (e.g., MessageInputTextBlock, MessageInputImageFileBlock, MessageInputImageUriBlock) that can include text, images, or other media.
Exceptions
Thrown when contentBlocks
is null
.
Remarks
Each block expresses a particular piece of message content or media. This overload is best for advanced scenarios where messages contain multiple text segments, embedded images, or a mix of different content types.
Applies to
ThreadMessageOptions(MessageRole, String)
- Source:
- ThreadMessageOptions.cs
- Source:
- ThreadMessageOptions.cs
Initializes a new instance of the ThreadMessageOptions class, setting the message content to a single, plain-text string.
public ThreadMessageOptions(Azure.AI.Agents.Persistent.MessageRole role, string content);
new Azure.AI.Agents.Persistent.ThreadMessageOptions : Azure.AI.Agents.Persistent.MessageRole * string -> Azure.AI.Agents.Persistent.ThreadMessageOptions
Public Sub New (role As MessageRole, content As String)
Parameters
- role
- MessageRole
The role of the entity creating the message (e.g., user or agent). Valid values typically include User or Agent.
- content
- String
The plain-text content of the message. If content
is null
,
an ArgumentNullException is thrown.
Exceptions
Thrown when content
is null
.
Remarks
The string is internally converted into a BinaryData structure for further processing. This overload suits simple scenarios where only a single text block is needed.