IOpenAIClient.WaitForAssistantMessageAsync

IOpenAIClient.WaitForAssistantMessageAsync method

Waits for the first message from the assistant within a thread asynchronously.

public Task<ThreadMessageResponse> WaitForAssistantMessageAsync(string threadId, 
    ThreadMessageListQueryParameters queryParameters = null, 
    CancellationToken? cancellationToken = default)
ParameterTypeDescription
threadIdStringThe ID of the thread to monitor for the first assistant message.
queryParametersThreadMessageListQueryParametersOptional query parameters to filter the list of messages.
cancellationTokenNullable`1A token to cancel the operation.

Return Value

A task that represents the asynchronous operation. The task result contains the first assistant message in the thread.

Exceptions

exceptioncondition
AIClientExceptionThrown when the thread Id is null or empty.

See Also