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
builderIntentClientBuilderThe builder to configure.
chatClientIChatClientThe chat client every fallback request is sent to. The caller keeps ownership of it.
embeddingGeneratorIEmbeddingGenerator<string, Embedding<float>>Optional embedding generator; without one the provider does not support embeddings.
namestringProvider 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.
modelstringModel 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.
loggerILoggerOptional logger for the chat client's translated failures.
Returns
Remarks
Pass logger to see the chat client's translated failures at Debug.
Exceptions
- ArgumentNullException
builderorchatClientis null.- ArgumentException
nameormodelis 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).