Skip to content

AzureOpenAIProviderOptions

Namespace AgentPrism · Assembly AgentPrism.Azure.dll

AgentPrism’s Azure OpenAI provider options.

public sealed class AzureOpenAIProviderOptions

objectAzureOpenAIProviderOptions

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

This type is deliberately a class, not a record: the ToString a record generates writes every property, and a single log line would expose the API key.

Validation is done by hand inside AzureOpenAIProviderOptionsValidator; DataAnnotations relies on reflection and breaks AOT compatibility.

public AzureOpenAIProviderOptions()

The full path of the configuration section options are read from.

public const string SectionName = "AgentPrism:Providers:AzureOpenAI"

string

The Azure OpenAI resource’s API key.

public string? ApiKey { get; set; }

string?

This value is a secret and is not written to a file. Use dotnet user-secrets, an environment variable, or a secret manager.

When AzureOpenAIProviderOptions.CredentialFactory is given, this field is not used. At least one of the two must be filled in.

The token scope (audience) requested with the Entra credential. The Azure public cloud is used when null.

public string? Audience { get; set; }

string?

Affects only the AzureOpenAIProviderOptions.CredentialFactory path; it is not used on the API key path. Sovereign clouds (Azure Government, Azure China) require a different scope.

Public cloud value: https://cognitiveservices.azure.com/.default. Azure Government: https://cognitiveservices.azure.us/.default.

The factory that produces a Microsoft Entra credential. When given, this is used instead of the API key.

public Func<TokenCredential>? CredentialFactory { get; set; }

Func<TokenCredential>?

The factory deliberately comes from the consumer. The DefaultAzureCredential type needed for a managed credential lives in the Azure.Identity package; that package is not small and pulls in the Microsoft.Identity.Client chain too. AgentPrism.Azure does not take it as a dependency; it only binds to the Azure.Core abstraction and leaves the credential choice to the consumer.

// In the consumer's project: <PackageReference Include="Azure.Identity" />
options.CredentialFactory = static () => new DefaultAzureCredential();

The factory is called once while the client is built. The returned TokenCredential manages token renewal itself.

The deployment name used when ModelBinding.Model is left empty.

public string? DefaultDeployment { get; set; }

string?

What Azure calls is not a model name, it is a deployment name. The same model can be deployed under different names, and the person who sets up the resource chooses the deployment name. Detail: AzureOpenAIChatClientFactory.

The Azure OpenAI resource’s address. Example: https://my-resource.openai.azure.com/.

public Uri? Endpoint { get; set; }

Uri?

Required; Azure has no single global address, each resource has its own. The address is not a secret, but it exposes an organization’s topology; it is not shown in error messages or health-check detail.

The model catalog shown to the UI. Each entry’s Name field is the deployment name.

public IList<ModelDescriptor> Models { get; }

IList<ModelDescriptor>

AgentPrism carries no built-in model list; the catalog comes entirely from here. This list is not a validation list: a deployment name absent from it can still be used.

The upper time limit for a single request. The library default is used when null.

public TimeSpan? Timeout { get; set; }

TimeSpan?