Documentation
Table of Contents

Method UseChatClientAsFallback

Namespace
IntentSharp.Extensions.AI
Assembly
IntentSharp.Extensions.AI.dll

UseChatClientAsFallback(IntentClientBuilder, IChatClient, IEmbeddingGenerator<string, Embedding<float>>?, string?, string?, ILogger?)

Uses the chat client as the fallback provider, called when the primary fails with a transient error (see FallbackOnTransientErrors). Calling it again replaces the fallback.

public static IntentClientBuilder UseChatClientAsFallback(this IntentClientBuilder builder, IChatClient chatClient, IEmbeddingGenerator<string, Embedding<float>>? embeddingGenerator = null, string? name = null, string? model = null, ILogger? logger = null)

Parameters

builder IntentClientBuilder

The builder to configure.

chatClient IChatClient

The chat client every fallback request is sent to. The caller keeps ownership of it.

embeddingGenerator IEmbeddingGenerator<string, Embedding<float>>

Optional embedding generator; without one the provider does not support embeddings.

name string

Provider name for results, rate limiting, logs and per-request provider overrides. Defaults to the provider name in the chat client's metadata, or DefaultName. It must differ from the primary's name.

model string

Model used when a request does not name one. Defaults to the default model in the chat client's metadata; when neither is known, the chat client chooses.

logger ILogger

Optional logger for the chat client's translated failures.

Returns

IntentClientBuilder

Remarks

Pass logger to see the chat client's translated failures at Debug.

Exceptions

ArgumentNullException

builder or chatClient is null.

ArgumentException

name or model is empty or white space (pass null to use the chat client's metadata), or the primary provider already has this provider's name (compared case-insensitively).