RoutingChatClient.SelectClientAsync(RoutingContext, CancellationToken) Method

Definition

Selects the client to invoke for the request.

protected:
 abstract System::Threading::Tasks::ValueTask<Microsoft::Extensions::AI::IChatClient ^> SelectClientAsync(Microsoft::Extensions::AI::RoutingContext ^ context, System::Threading::CancellationToken cancellationToken);
protected abstract System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.IChatClient> SelectClientAsync(Microsoft.Extensions.AI.RoutingContext context, System.Threading.CancellationToken cancellationToken);
abstract member SelectClientAsync : Microsoft.Extensions.AI.RoutingContext * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.IChatClient>
Protected MustOverride Function SelectClientAsync (context As RoutingContext, cancellationToken As CancellationToken) As ValueTask(Of IChatClient)

Parameters

context
RoutingContext

The request-specific inputs.

cancellationToken
CancellationToken

The cancellation token supplied for the request.

Returns

The client to invoke.

Remarks

Client-specific behavior should generally be attached to the returned client. Modifying ChatOptions changes the options for the request itself, including any later invocation of a different client for the same request. Exceptions from this method propagate to the caller.

Applies to