FailoverChatClient Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Provides a template for a RoutingChatClient that can select another client after an invocation fails.
public ref class FailoverChatClient abstract : Microsoft::Extensions::AI::RoutingChatClient
[System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")]
public abstract class FailoverChatClient : Microsoft.Extensions.AI.RoutingChatClient
[<System.Diagnostics.CodeAnalysis.Experimental("MEAI001", UrlFormat="https://aka.ms/dotnet-extensions-warnings/{0}")>]
type FailoverChatClient = class
inherit RoutingChatClient
Public MustInherit Class FailoverChatClient
Inherits RoutingChatClient
- Inheritance
- Derived
- Attributes
Remarks
The client for each attempt is supplied by SelectClientAsync(RoutingContext, CancellationToken). After an invocation, OnRoutingUpdateAsync(RoutingContext, FailoverChatClientAttempt, Boolean, CancellationToken) reports the concrete attempt and whether another selection will follow. An uncanceled failure causes another selection only when it happened before any streaming output was exposed and the attempt limit permits it.
The base class owns invocation, streaming commitment, attempt limits, and attempt reporting. Derived classes own client selection, policy state, selection-failure cleanup, and the lifetime of clients they retain.
Once streaming enumeration begins, callers must dispose the enumerator. Abandoning an active enumerator without disposing it prevents both inner enumerator disposal and the terminal routing update.
Constructors
| Name | Description |
|---|---|
| FailoverChatClient() | |
Properties
| Name | Description |
|---|---|
| MaximumAttemptsPerRequest |
Gets or sets the maximum number of client invocations permitted for one request. |
Methods
| Name | Description |
|---|---|
| Dispose() |
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. (Inherited from RoutingChatClient) |
| Dispose(Boolean) |
Provides a mechanism for releasing resources owned by the derived instance. (Inherited from RoutingChatClient) |
| GetResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) | |
| GetService(Type, Object) |
Asks the IChatClient for an object of the specified type |
| GetStreamingResponseAsync(IEnumerable<ChatMessage>, ChatOptions, CancellationToken) | |
| OnRoutingUpdateAsync(RoutingContext, FailoverChatClientAttempt, Boolean, CancellationToken) |
Invoked after a client invocation completes, fails, or is abandoned. |
| SelectClientAsync(RoutingContext, CancellationToken) |
Selects the client to invoke for the request. (Inherited from RoutingChatClient) |