Documentation
Table of Contents

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

chatClient IChatClient

The chat client every request is sent to.

embeddingGenerator IEmbeddingGenerator<string, Embedding<float>>

Optional embedding generator; without one SupportsEmbeddings is false.

name string

Provider 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.

model string

Model 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.

logger ILogger

Optional logger for translated failures, written at Debug.

Exceptions

ArgumentNullException

chatClient is null.

ArgumentException

name or model is empty or white space. Pass null to use the chat client's metadata.