Sdílet prostřednictvím


AspireConfigurableOpenAIExtensions.AddKeyedOpenAIClientFromConfiguration Method

Definition

Registers OpenAI.OpenAIClient as a singleton in the services provided by the builder. The concrete implementation is selected automatically from configuration.

public static void AddKeyedOpenAIClientFromConfiguration(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name);
static member AddKeyedOpenAIClientFromConfiguration : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string -> unit
<Extension()>
Public Sub AddKeyedOpenAIClientFromConfiguration (builder As IHostApplicationBuilder, name As String)

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.

Applies to