Class MessageResponse
A message created by an Assistant or a user. Messages can include text, images, and other files. Messages stored as a list on the Thread.
public sealed class MessageResponse : BaseResponse, IListItem, IServerSentEvent
- Inheritance
-
MessageResponse
- Implements
- Inherited Members
- Extension Methods
Constructors
MessageResponse()
public MessageResponse()
Properties
AssistantId
If applicable, the ID of the assistant that authored this message.
[JsonInclude]
[JsonPropertyName("assistant_id")]
public string AssistantId { get; }
Property Value
Attachments
A list of files attached to the message, and the tools they were added to.
[JsonInclude]
[JsonPropertyName("attachments")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyList<Attachment> Attachments { get; }
Property Value
CompletedAt
[JsonIgnore]
public DateTime? CompletedAt { get; }
Property Value
CompletedAtUnixTimeSeconds
The Unix timestamp (in seconds) for when the message was completed.
[JsonInclude]
[JsonPropertyName("completed_at")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? CompletedAtUnixTimeSeconds { get; }
Property Value
- int?
Content
The content of the message in array of text and/or images.
[JsonInclude]
[JsonPropertyName("content")]
public IReadOnlyList<Content> Content { get; }
Property Value
CreatedAt
[JsonIgnore]
public DateTime CreatedAt { get; }
Property Value
CreatedAtUnixTimeSeconds
The Unix timestamp (in seconds) for when the message was created.
[JsonInclude]
[JsonPropertyName("created_at")]
public int CreatedAtUnixTimeSeconds { get; }
Property Value
Delta
[JsonInclude]
[JsonPropertyName("delta")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public MessageDelta Delta { get; }
Property Value
Id
The identifier, which can be referenced in API endpoints.
[JsonInclude]
[JsonPropertyName("id")]
public string Id { get; }
Property Value
IncompleteAt
[JsonIgnore]
public DateTime? IncompleteAt { get; }
Property Value
IncompleteAtUnixTimeSeconds
The Unix timestamp (in seconds) for when the message was marked as incomplete.
[JsonInclude]
[JsonPropertyName("incomplete_at")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public int? IncompleteAtUnixTimeSeconds { get; }
Property Value
- int?
IncompleteDetails
On an incomplete message, details about why the message is incomplete.
[JsonInclude]
[JsonPropertyName("incomplete_details")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IncompleteDetails IncompleteDetails { get; }
Property Value
Metadata
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.
[JsonInclude]
[JsonPropertyName("metadata")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public IReadOnlyDictionary<string, string> Metadata { get; }
Property Value
Object
The object type, which is always message.
[JsonInclude]
[JsonPropertyName("object")]
public string Object { get; }
Property Value
Role
The entity that produced the message. One of user or assistant.
[JsonInclude]
[JsonPropertyName("role")]
public Role Role { get; }
Property Value
RunId
If applicable, the ID of the run associated with the authoring of this message.
[JsonInclude]
[JsonPropertyName("run_id")]
public string RunId { get; }
Property Value
Status
The status of the message, which can be either 'in_progress', 'incomplete', or 'completed'.
[JsonInclude]
[JsonPropertyName("status")]
[JsonConverter(typeof(JsonStringEnumConverter<MessageStatus>))]
public MessageStatus Status { get; }
Property Value
ThreadId
The thread ID that this message belongs to.
[JsonInclude]
[JsonPropertyName("thread_id")]
public string ThreadId { get; }
Property Value
Methods
FromSchema<T>(JsonSerializerOptions)
Converts the Content to the specified JsonSchema.
public T FromSchema<T>(JsonSerializerOptions options = null)
Parameters
Returns
- T
Deserialized JsonSchema object.
Type Parameters
TJsonSchema to used for structured outputs.
PrintContent()
Formats all of the Content items into a single string, putting each item on a new line.
public string PrintContent()
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
implicit operator Message(MessageResponse)
public static implicit operator Message(MessageResponse response)
Parameters
responseMessageResponse
Returns
implicit operator string(MessageResponse)
public static implicit operator string(MessageResponse message)
Parameters
messageMessageResponse