.NET API
AzureOpenAIProviderExtensions
Tracon.Azure.dllExtensions that add the Azure OpenAI provider to the Tracon chain.
public static class AzureOpenAIProviderExtensionsInheritance
Section titled “Inheritance”object ← AzureOpenAIProviderExtensions
Inherited Members
Section titled “Inherited Members”object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Methods
Section titled “Methods”UseAzureOpenAI(ITraconBuilder, Uri, string, Action<AzureOpenAIProviderOptions>?)
Section titled “ UseAzureOpenAI(ITraconBuilder, Uri, string, Action<AzureOpenAIProviderOptions>?)”Adds the Azure OpenAI provider by giving an endpoint and API key.
public static ITraconBuilder UseAzureOpenAI(this ITraconBuilder builder, Uri endpoint, string apiKey, Action<AzureOpenAIProviderOptions>? configure = null)Parameters
Section titled “Parameters”builder ITraconBuilder
The Tracon chain.
endpoint Uri
The Azure OpenAI resource’s address.
apiKey string
The resource’s API key.
configure Action<AzureOpenAIProviderOptions>?
An extra option modifier.
Returns
Section titled “Returns”The continuation of the chain.
Remarks
Section titled “Remarks”To use a managed credential, use AzureOpenAIProviderExtensions.UseAzureOpenAI instead of this overload, and give AzureOpenAIProviderOptions.CredentialFactory.
builder.AddTracon() .UseAzureOpenAI( new Uri(builder.Configuration["AzureOpenAI:Endpoint"]!), builder.Configuration["AzureOpenAI:ApiKey"]!);Exceptions
Section titled “Exceptions”builder
or
endpoint
is null.
apiKey is empty.
UseAzureOpenAI(ITraconBuilder, IConfiguration)
Section titled “ UseAzureOpenAI(ITraconBuilder, IConfiguration)”Adds the Azure OpenAI provider by reading options from the
Tracon:Providers:AzureOpenAI section.
public static ITraconBuilder UseAzureOpenAI(this ITraconBuilder builder, IConfiguration configurationSection)Parameters
Section titled “Parameters”builder ITraconBuilder
The Tracon chain.
configurationSection IConfiguration
The section to read options from. Typically
configuration.GetSection(AzureOpenAIProviderOptions.SectionName).
Returns
Section titled “Returns”The continuation of the chain.
Remarks
Section titled “Remarks”AzureOpenAIProviderOptions.CredentialFactory cannot be read from configuration; call the AzureOpenAIProviderExtensions.UseAzureOpenAI overload afterward to set it in code.
Exceptions
Section titled “Exceptions”builder
or
configurationSection
is null.
UseAzureOpenAI(ITraconBuilder, Action<AzureOpenAIProviderOptions>)
Section titled “ UseAzureOpenAI(ITraconBuilder, Action<AzureOpenAIProviderOptions>)”Adds the Azure OpenAI provider by giving options in code.
public static ITraconBuilder UseAzureOpenAI(this ITraconBuilder builder, Action<AzureOpenAIProviderOptions> configure)Parameters
Section titled “Parameters”builder ITraconBuilder
The Tracon chain.
configure Action<AzureOpenAIProviderOptions>
The option modifier.
Returns
Section titled “Returns”The continuation of the chain.
Remarks
Section titled “Remarks”This call registers exactly one provider: AzureOpenAIProviderNames.AzureOpenAI.
Registration happens through AddModelProvider(...); no existing
service is replaced. When called more than
once, the options are merged; the provider is registered only once.
Exceptions
Section titled “Exceptions”One of the parameters is null.