Constructor ChatClientProvider
- Namespace
- IntentSharp.Extensions.AI
- Assembly
- IntentSharp.Extensions.AI.dll
ChatClientProvider(IChatClient, IEmbeddingGenerator<string, Embedding<float>>?, string?, string?, ILogger?)
Wraps the chat client, and optionally an embedding generator, as a provider. The name and the default model come from the chat client's metadata unless they are given here.
public ChatClientProvider(IChatClient chatClient, IEmbeddingGenerator<string, Embedding<float>>? embeddingGenerator = null, string? name = null, string? model = null, ILogger? logger = null)
Parameters
chatClientIChatClientThe chat client every request is sent to.
embeddingGeneratorIEmbeddingGenerator<string, Embedding<float>>Optional embedding generator; without one SupportsEmbeddings is false.
namestringProvider name for results, rate limiting, logs and per-request provider overrides. Defaults to the provider name in the client's Microsoft.Extensions.AI.ChatClientMetadata, or DefaultName. Give the primary and the fallback different names when both are chat clients for the same backend.
modelstringModel used when a request does not name one. Defaults to the default model in the client's Microsoft.Extensions.AI.ChatClientMetadata; when neither is known, requests leave the model to the chat client and DefaultModel is empty.
loggerILoggerOptional logger for translated failures, written at
Debug.
Exceptions
- ArgumentNullException
chatClientis null.- ArgumentException
nameormodelis empty or white space. Pass null to use the chat client's metadata.