Skip to content
DocsTry Aspire
DocsTry

AspireOpenAIClientBuilderChatClientExtensions Methods

ClassMethods2 members
Provides extension methods for registering AI.IChatClient as a singleton in the services provided by the Hosting.IHostApplicationBuilder.
AddChatClient(AspireOpenAIClientBuilder, string?)Section titled AddChatClient(AspireOpenAIClientBuilder, string?)extensionChatClientBuilder
Registers a singleton AI.IChatClient in the services provided by the builder.
public static class AspireOpenAIClientBuilderChatClientExtensions
{
public static ChatClientBuilder AddChatClient(
this AspireOpenAIClientBuilder builder,
string? deploymentName = null)
{
// ...
}
}
deploymentNamestring?optionalOptionally specifies which model deployment to use. If not specified, a value will be taken from the connection string.
ChatClientBuilderA AI.ChatClientBuilder that can be used to build a pipeline around the inner AI.IChatClient.
AddKeyedChatClient(AspireOpenAIClientBuilder, string, string?)Section titled AddKeyedChatClient(AspireOpenAIClientBuilder, string, string?)extensionChatClientBuilder
Registers a keyed singleton AI.IChatClient in the services provided by the builder.
public static class AspireOpenAIClientBuilderChatClientExtensions
{
public static ChatClientBuilder AddKeyedChatClient(
this AspireOpenAIClientBuilder builder,
string serviceKey,
string? deploymentName = null)
{
// ...
}
}
serviceKeystringThe service key with which the AI.IChatClient will be registered.
deploymentNamestring?optionalOptionally specifies which model deployment to use. If not specified, a value will be taken from the connection string.
ChatClientBuilderA AI.ChatClientBuilder that can be used to build a pipeline around the inner AI.IChatClient.