FailoverChatClient.OnRoutingUpdateAsync Method

Definition

Invoked after a client invocation completes, fails, or is abandoned.

protected:
 virtual System::Threading::Tasks::ValueTask OnRoutingUpdateAsync(Microsoft::Extensions::AI::RoutingContext ^ context, Microsoft::Extensions::AI::FailoverChatClientAttempt ^ attempt, bool isTerminal, System::Threading::CancellationToken cancellationToken);
protected virtual System.Threading.Tasks.ValueTask OnRoutingUpdateAsync(Microsoft.Extensions.AI.RoutingContext context, Microsoft.Extensions.AI.FailoverChatClientAttempt attempt, bool isTerminal, System.Threading.CancellationToken cancellationToken);
abstract member OnRoutingUpdateAsync : Microsoft.Extensions.AI.RoutingContext * Microsoft.Extensions.AI.FailoverChatClientAttempt * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
override this.OnRoutingUpdateAsync : Microsoft.Extensions.AI.RoutingContext * Microsoft.Extensions.AI.FailoverChatClientAttempt * bool * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Protected Overridable Function OnRoutingUpdateAsync (context As RoutingContext, attempt As FailoverChatClientAttempt, isTerminal As Boolean, cancellationToken As CancellationToken) As ValueTask

Parameters

context
RoutingContext

The request-specific inputs.

attempt
FailoverChatClientAttempt

The attempted client invocation.

isTerminal
Boolean

true if the base will not select another client after this method returns successfully; otherwise, false.

cancellationToken
CancellationToken

The cancellation token supplied for the request.

Returns

A task representing the update operation.

Remarks

The default implementation performs no operation. A nonterminal update always contains an uncanceled, pre-output failed attempt. State changes made by the override are visible to the next call to SelectClientAsync(RoutingContext, CancellationToken).

This method is invoked once after each selected-client invocation, whether it completes, fails, or is abandoned. Selection failures are not reported. A selector that retains request-scoped state must release it before throwing; a request may therefore end without a terminal update when selection fails.

Exceptions from this method propagate to the caller. A terminal update exception replaces the response or exception already produced by the request. A nonterminal update exception stops routing without another update. An override that retains per-request state must release that state before throwing because no later update is made after an update exception.

Applies to