Table of Contents

Class Message

Namespace
OpenAI.Responses
Assembly
OpenAI-DotNet.dll
public sealed class Message : BaseResponse, IResponseItem, IServerSentEvent, IListItem
Inheritance
Message
Implements
Inherited Members

Constructors

Message()

public Message()

Message(Role, IResponseContent)

public Message(Role role, IResponseContent content)

Parameters

role Role
content IResponseContent

Message(Role, IEnumerable<IResponseContent>)

public Message(Role role, IEnumerable<IResponseContent> content)

Parameters

role Role
content IEnumerable<IResponseContent>

Message(Role, string)

public Message(Role role, string text)

Parameters

role Role
text string

Properties

Content

[JsonInclude]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
[JsonPropertyName("content")]
public IReadOnlyList<IResponseContent> Content { get; }

Property Value

IReadOnlyList<IResponseContent>

Id

The unique ID of this response item.

[JsonInclude]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("id")]
public string Id { get; }

Property Value

string

Object

[JsonInclude]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("object")]
public string Object { get; }

Property Value

string

Role

[JsonInclude]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("role")]
public Role Role { get; }

Property Value

Role

Status

The status of the response item.

[JsonInclude]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
[JsonPropertyName("status")]
public ResponseStatus Status { get; }

Property Value

ResponseStatus

Type

[JsonInclude]
[JsonIgnore(Condition = JsonIgnoreCondition.Never)]
[JsonPropertyName("type")]
public ResponseItemType Type { get; }

Property Value

ResponseItemType

Methods

FromSchema<T>(JsonSerializerOptions)

public T FromSchema<T>(JsonSerializerOptions options = null)

Parameters

options JsonSerializerOptions

Returns

T

Type Parameters

T

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(string)

public static implicit operator Message(string input)

Parameters

input string

Returns

Message