Method UseChatClient
- Namespace
- IntentSharp.Extensions.AI
- Assembly
- IntentSharp.Extensions.AI.dll
UseChatClient(IntentClientBuilder, IChatClient, IEmbeddingGenerator<string, Embedding<float>>?, string?, string?, ILogger?)
Uses the chat client as the primary provider, wrapped in a ChatClientProvider. Calling it again replaces the primary.
public static IntentClientBuilder UseChatClient(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 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 fallback'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
The provider does not take the builder's WithLoggerFactory(ILoggerFactory) logger; 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 fallback provider already has this provider's name (compared case-insensitively).