Class ThreadMessage
Represents a message within a thread.
Inheritance
object
ThreadMessage
Assembly: .dll
Syntax
[Serializable]
public class ThreadMessage : ChatMessage
Constructors
ThreadMessage()
Declaration
ThreadMessage(ChatRole, string)
Declaration
public ThreadMessage(ChatRole role, string content = null)
Parameters
Type |
Name |
Description |
ChatRole |
role |
|
string |
content |
|
Properties
AssistantId
If applicable, the Assistant that authored this message.
Declaration
public string AssistantId { get; set; }
Property Value
Attachments
A list of files attached to the message, and the tools they were added to.
Declaration
public Attachment[] Attachments { get; set; }
Property Value
Id
Declaration
public string Id { get; set; }
Property Value
Set of 16 key-value pairs that can be attached to an object.
This can be useful for storing additional information about the object in a structured format.
Keys can be a maximum of 64 characters long and values can be a maximum of 512 characters long.
Declaration
public Dictionary<string, string> Metadata { get; set; }
Property Value
Type |
Description |
Dictionary<string, string> |
|
Object
Declaration
public string Object { get; set; }
Property Value
Role
The role of the messages author.
Role
is abstract and overridden in derived classes to enforce consistency.
This avoids relying on constructor or deserialization logic to set the role.
JSON.NET does not call parameterized constructors or set get-only
properties during deserialization.
Declaration
public override ChatRole Role { get; }
Property Value
Overrides
RunId
The Run associated with the creation of this message.
Value is null when messages are created manually using the create message or create thread endpoints.
Declaration
public string RunId { get; set; }
Property Value
ThreadId
The Thread that this message belongs to.
Declaration
public string ThreadId { get; set; }
Property Value
[Required] Tool call that this message is responding to.
Declaration
public string ToolCallId { get; set; }
Property Value
Optional. A list of tool calls (functions) the model wants to use.
Declaration
public ToolCall[] Tools { get; set; }
Property Value
Extension Methods