AspireAzureOpenAIExtensions.AddKeyedAzureOpenAIClient Method
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.
Registers AzureOpenAIClient as a singleton for given name
in the services provided by the builder
.
Additionally, registers the AzureOpenAIClient as an OpenAI.OpenAIClient service.
public static void AddKeyedAzureOpenAIClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.Azure.AI.OpenAI.AzureOpenAISettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.AI.OpenAI.AzureOpenAIClient,Azure.AI.OpenAI.AzureOpenAIClientOptions>>? configureClientBuilder = default);
public static Aspire.Azure.AI.OpenAI.AspireAzureOpenAIClientBuilder AddKeyedAzureOpenAIClient(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name, Action<Aspire.Azure.AI.OpenAI.AzureOpenAISettings>? configureSettings = default, Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.AI.OpenAI.AzureOpenAIClient,Azure.AI.OpenAI.AzureOpenAIClientOptions>>? configureClientBuilder = default);
static member AddKeyedAzureOpenAIClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.AI.OpenAI.AzureOpenAISettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.AI.OpenAI.AzureOpenAIClient, Azure.AI.OpenAI.AzureOpenAIClientOptions>> -> unit
static member AddKeyedAzureOpenAIClient : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string * Action<Aspire.Azure.AI.OpenAI.AzureOpenAISettings> * Action<Azure.Core.Extensions.IAzureClientBuilder<Azure.AI.OpenAI.AzureOpenAIClient, Azure.AI.OpenAI.AzureOpenAIClientOptions>> -> Aspire.Azure.AI.OpenAI.AspireAzureOpenAIClientBuilder
<Extension()>
Public Sub AddKeyedAzureOpenAIClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of AzureOpenAISettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of AzureOpenAIClient, AzureOpenAIClientOptions)) = Nothing)
<Extension()>
Public Function AddKeyedAzureOpenAIClient (builder As IHostApplicationBuilder, name As String, Optional configureSettings As Action(Of AzureOpenAISettings) = Nothing, Optional configureClientBuilder As Action(Of IAzureClientBuilder(Of AzureOpenAIClient, AzureOpenAIClientOptions)) = Nothing) As AspireAzureOpenAIClientBuilder
Parameters
- builder
- IHostApplicationBuilder
The IHostApplicationBuilder to read config from and add services to.
- name
- String
The name of the component, which is used as the ServiceKey of the service and also to retrieve the connection string from the ConnectionStrings configuration section.
- configureSettings
- Action<AzureOpenAISettings>
An 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>>
An optional method that can be used for customizing the IAzureClientBuilder<TClient,TOptions>.
Returns
An AspireAzureOpenAIClientBuilder that can be used to register additional services.
Remarks
Reads the configuration from "Aspire.Azure.AI.OpenAI:{name}" section.