Documentation
Table of Contents

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

builder IntentClientBuilder

The builder to configure.

chatClient IChatClient

The chat client every 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 fallback'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

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

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 fallback provider already has this provider's name (compared case-insensitively).