ChatClientBuilder Class

Definition

A builder for creating pipelines of IChatClient.

public ref class ChatClientBuilder sealed
public sealed class ChatClientBuilder
type ChatClientBuilder = class
Public NotInheritable Class ChatClientBuilder
Inheritance
ChatClientBuilder

Constructors

ChatClientBuilder(IServiceProvider)

Initializes a new instance of the ChatClientBuilder class.

Properties

Services

Gets the IServiceProvider associated with the builder instance.

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
Use(Func<IChatClient,IChatClient>)

Adds a factory for an intermediate chat client to the chat client pipeline.

Use(Func<IServiceProvider,IChatClient,IChatClient>)

Adds a factory for an intermediate chat client to the chat client pipeline.

Use(IChatClient)

Completes the pipeline by adding a final IChatClient that represents the underlying backend. This is typically a client for an LLM service.

Extension Methods

UseChatOptions(ChatClientBuilder, Func<ChatOptions,ChatOptions>)

Adds a callback that updates or replaces ChatOptions. This can be used to set default options.

UseDistributedCache(ChatClientBuilder, IDistributedCache, Action<DistributedCachingChatClient>)

Adds a DistributedCachingChatClient as the next stage in the pipeline.

UseFunctionInvocation(ChatClientBuilder, Action<FunctionInvokingChatClient>)

Enables automatic function call invocation on the chat pipeline.

UseLogging(ChatClientBuilder, ILogger, Action<LoggingChatClient>)

Adds logging to the chat client pipeline.

UseOpenTelemetry(ChatClientBuilder, ILoggerFactory, String, Action<OpenTelemetryChatClient>)

Adds OpenTelemetry support to the chat client pipeline, following the OpenTelemetry Semantic Conventions for Generative AI systems.

Applies to