AspireAzureOpenAIExtensions Methods
ClassMethods2 members
Provides extension methods for registering
OpenAI.AzureOpenAIClient as a singleton in the services provided by the Hosting.IHostApplicationBuilder . AddAzureOpenAIClient(IHostApplicationBuilder, string, Action<AzureOpenAISettings>, Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>>) Section titled AddAzureOpenAIClient(IHostApplicationBuilder, string, Action<AzureOpenAISettings>, Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>>)extensionAspire Registers
OpenAI.AzureOpenAIClient as a singleton in the services provided by the builder. Additionally, registers the OpenAI.AzureOpenAIClient as an OpenAIClient service. public static class AspireAzureOpenAIExtensions{ public static AspireAzureOpenAIClientBuilder AddAzureOpenAIClient( this IHostApplicationBuilder builder, string connectionName, Action<AzureOpenAISettings>? configureSettings = null, Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>>? configureClientBuilder = null) { // ... }}Parameters
builderIHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.connectionName stringA name used to retrieve the connection string from the ConnectionStrings configuration section.configureSettings Action<AzureOpenAISettings> optionalAn optional method that can be used for customizing the AzureOpenAISettings . It's invoked after the settings are read from the configuration.configureClientBuilder Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>> optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2 .Returns
AspireAzureOpenAIClientBuilder An AspireAzureOpenAIClientBuilder that can be used to register additional services.Remarks
Reads the configuration from "Aspire.Azure.AI.OpenAI" section.
AddKeyedAzureOpenAIClient(IHostApplicationBuilder, string, Action<AzureOpenAISettings>, Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>>) Section titled AddKeyedAzureOpenAIClient(IHostApplicationBuilder, string, Action<AzureOpenAISettings>, Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>>)extensionAspire Registers
OpenAI.AzureOpenAIClient as a singleton for given name in the services provided by the builder. Additionally, registers the OpenAI.AzureOpenAIClient as an OpenAIClient service. public static class AspireAzureOpenAIExtensions{ public static AspireAzureOpenAIClientBuilder AddKeyedAzureOpenAIClient( this IHostApplicationBuilder builder, string name, Action<AzureOpenAISettings>? configureSettings = null, Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>>? configureClientBuilder = null) { // ... }}Parameters
builderIHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.namestringThe name of the component, which is used as the ServiceDescriptor.ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.configureSettings Action<AzureOpenAISettings> optionalAn optional method that can be used for customizing the AzureOpenAISettings . It's invoked after the settings are read from the configuration.configureClientBuilder Action<IAzureClientBuilder<AzureOpenAIClient, AzureOpenAIClientOptions>> optionalAn optional method that can be used for customizing the Extensions.IAzureClientBuilder`2 .Returns
AspireAzureOpenAIClientBuilder An AspireAzureOpenAIClientBuilder that can be used to register additional services.Remarks
Reads the configuration from "Aspire.Azure.AI.OpenAI:{name}" section.