AzureOpenAIProviderExtensions
AgentPrism.Azure.dllExtensions that add the Azure OpenAI provider to the AgentPrism 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(IAgentPrismBuilder, Uri, string, Action<AzureOpenAIProviderOptions>?)
Section titled “ UseAzureOpenAI(IAgentPrismBuilder, Uri, string, Action<AzureOpenAIProviderOptions>?)”Adds the Azure OpenAI provider by giving an endpoint and API key.
public static IAgentPrismBuilder UseAzureOpenAI(this IAgentPrismBuilder builder, Uri endpoint, string apiKey, Action<AzureOpenAIProviderOptions>? configure = null)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The AgentPrism 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.AddAgentPrism() .UseAzureOpenAI( new Uri(builder.Configuration["AzureOpenAI:Endpoint"]!), builder.Configuration["AzureOpenAI:ApiKey"]!);Exceptions
Section titled “Exceptions”builder
or
endpoint
is null.
apiKey is empty.
UseAzureOpenAI(IAgentPrismBuilder, IConfiguration)
Section titled “ UseAzureOpenAI(IAgentPrismBuilder, IConfiguration)”Adds the Azure OpenAI provider by reading options from the
AgentPrism:Providers:AzureOpenAI section.
public static IAgentPrismBuilder UseAzureOpenAI(this IAgentPrismBuilder builder, IConfiguration configurationSection)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The AgentPrism 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(IAgentPrismBuilder, Action<AzureOpenAIProviderOptions>)
Section titled “ UseAzureOpenAI(IAgentPrismBuilder, Action<AzureOpenAIProviderOptions>)”Adds the Azure OpenAI provider by giving options in code.
public static IAgentPrismBuilder UseAzureOpenAI(this IAgentPrismBuilder builder, Action<AzureOpenAIProviderOptions> configure)Parameters
Section titled “Parameters”builder IAgentPrismBuilder
The AgentPrism 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.