Compartilhar via


AgentsClient.GetMessagesAsync Method

Definition

Gets a list of messages that exist on a thread.

public virtual System.Threading.Tasks.Task<Azure.Response<Azure.AI.Projects.PageableList<Azure.AI.Projects.ThreadMessage>>> GetMessagesAsync (string threadId, string runId = default, int? limit = default, Azure.AI.Projects.ListSortOrder? order = default, string after = default, string before = default, System.Threading.CancellationToken cancellationToken = default);
abstract member GetMessagesAsync : string * string * Nullable<int> * Nullable<Azure.AI.Projects.ListSortOrder> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Projects.PageableList<Azure.AI.Projects.ThreadMessage>>>
override this.GetMessagesAsync : string * string * Nullable<int> * Nullable<Azure.AI.Projects.ListSortOrder> * string * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Azure.Response<Azure.AI.Projects.PageableList<Azure.AI.Projects.ThreadMessage>>>
Public Overridable Function GetMessagesAsync (threadId As String, Optional runId As String = Nothing, Optional limit As Nullable(Of Integer) = Nothing, Optional order As Nullable(Of ListSortOrder) = Nothing, Optional after As String = Nothing, Optional before As String = Nothing, Optional cancellationToken As CancellationToken = Nothing) As Task(Of Response(Of PageableList(Of ThreadMessage)))

Parameters

threadId
String

Identifier of the thread.

runId
String

Filter messages by the run ID that generated them.

limit
Nullable<Int32>

A limit on the number of objects to be returned. Limit can range between 1 and 100, and the default is 20.

order
Nullable<ListSortOrder>

Sort order by the created_at timestamp of the objects. asc for ascending order and desc for descending order.

after
String

A cursor for use in pagination. after is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include after=obj_foo in order to fetch the next page of the list.

before
String

A cursor for use in pagination. before is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, ending with obj_foo, your subsequent call can include before=obj_foo in order to fetch the previous page of the list.

cancellationToken
CancellationToken

The cancellation token to use.

Returns

Exceptions

threadId is null.

threadId is an empty string, and was expected to be non-empty.

Applies to