ChatClientBuilder Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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(Func<IServiceProvider,IChatClient>) |
Initializes a new instance of the ChatClientBuilder class. |
ChatClientBuilder(IChatClient) |
Initializes a new instance of the ChatClientBuilder class. |
Methods
Build(IServiceProvider) |
Builds an IChatClient that represents the entire pipeline. Calls to this instance will pass through each of the pipeline stages in turn. |
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(AnonymousDelegatingChatClient+CompleteSharedFunc) |
Adds to the chat client pipeline an anonymous delegating chat client based on a delegate that provides an implementation for both CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken). |
Use(Func<IChatClient,IChatClient>) |
Adds a factory for an intermediate chat client to the chat client pipeline. |
Use(Func<IChatClient,IServiceProvider,IChatClient>) |
Adds a factory for an intermediate chat client to the chat client pipeline. |
Use(Func<IList<ChatMessage>,ChatOptions,IChatClient,CancellationToken, Task<ChatCompletion>>, Func<IList<ChatMessage>,ChatOptions,IChatClient, CancellationToken,IAsyncEnumerable<StreamingChatCompletionUpdate>>) |
Adds to the chat client pipeline an anonymous delegating chat client based on a delegate that provides an implementation for both CompleteAsync(IList<ChatMessage>, ChatOptions, CancellationToken) and CompleteStreamingAsync(IList<ChatMessage>, ChatOptions, CancellationToken). |
Extension Methods
ConfigureOptions(ChatClientBuilder, Action<ChatOptions>) |
Adds a callback that configures a ChatOptions to be passed to the next client in the pipeline. |
UseDistributedCache(ChatClientBuilder, IDistributedCache, Action<DistributedCachingChatClient>) |
Adds a DistributedCachingChatClient as the next stage in the pipeline. |
UseFunctionInvocation(ChatClientBuilder, ILoggerFactory, Action<FunctionInvokingChatClient>) |
Enables automatic function call invocation on the chat pipeline. |
UseLogging(ChatClientBuilder, ILoggerFactory, 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. |