AspireConfigurableOpenAIExtensions.AddKeyedOpenAIClientFromConfiguration 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 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);
public static Aspire.OpenAI.AspireOpenAIClientBuilder AddKeyedOpenAIClientFromConfiguration(this Microsoft.Extensions.Hosting.IHostApplicationBuilder builder, string name);
static member AddKeyedOpenAIClientFromConfiguration : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string -> unit
static member AddKeyedOpenAIClientFromConfiguration : Microsoft.Extensions.Hosting.IHostApplicationBuilder * string -> Aspire.OpenAI.AspireOpenAIClientBuilder
<Extension()>
Public Sub AddKeyedOpenAIClientFromConfiguration (builder As IHostApplicationBuilder, name As String)
<Extension()>
Public Function AddKeyedOpenAIClientFromConfiguration (builder As IHostApplicationBuilder, name As String) As AspireOpenAIClientBuilder
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.
Returns
An AspireOpenAIClientBuilder that can be used to register additional services.