Udostępnij za pośrednictwem


AspireConfigurableOpenAIExtensions.AddOpenAIClientFromConfiguration Method

Definition

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

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

Parameters

builder
IHostApplicationBuilder

The IHostApplicationBuilder to read config from and add services to.

connectionName
String

A name used to retrieve the connection string from the ConnectionStrings configuration section.

Applies to