AzureOpenAIModelProvider
AgentPrism.Azure.dllThe IModelProvider implementation for Azure OpenAI.
public sealed class AzureOpenAIModelProvider : IModelProvider, IModelProviderHealthCheck, IModelProviderConfigurationDiagnosticsInheritance
Section titled “Inheritance”object ← AzureOpenAIModelProvider
Implements
Section titled “Implements”IModelProvider, IModelProviderHealthCheck, IModelProviderConfigurationDiagnostics
Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”The provider does not reject a deployment name absent from the catalog. Deployment names are chosen by whoever sets up the Azure resource, and AgentPrism’s configuration is not expected to be updated when a new deployment is opened; when the catalog is non-empty, only an informational log entry is left.
Circuit-breaker and content-filter detection live outside this type,
at the ModelProviderRegistry level; this package gets both for free.
When Azure’s own content filter cuts a response short,
ContentFilterDetectingChatClient records it as content_filtered
— there is no extra code in this package for it.
Constructors
Section titled “Constructors”AzureOpenAIModelProvider(string, AzureOpenAIChatClientFactory, IReadOnlyList<ModelDescriptor>, ILogger<AzureOpenAIModelProvider>?, AzureOpenAIProviderOptions?, EgressSocketGuard?)
Section titled “ AzureOpenAIModelProvider(string, AzureOpenAIChatClientFactory, IReadOnlyList<ModelDescriptor>, ILogger<AzureOpenAIModelProvider>?, AzureOpenAIProviderOptions?, EgressSocketGuard?)”Creates a new provider.
public AzureOpenAIModelProvider(string name, AzureOpenAIChatClientFactory chatClientFactory, IReadOnlyList<ModelDescriptor> models, ILogger<AzureOpenAIModelProvider>? logger = null, AzureOpenAIProviderOptions? healthCheckOptions = null, EgressSocketGuard? egressGuard = null)Parameters
Section titled “Parameters”name string
The provider name. ModelBinding.Provider in agent definitions matches this value.
chatClientFactory AzureOpenAIChatClientFactory
The chat client factory.
models IReadOnlyList<ModelDescriptor>
The deployments this provider offers.
logger ILogger<AzureOpenAIModelProvider>?
The logger.
healthCheckOptions AzureOpenAIProviderOptions?
When given, AzureOpenAIModelProvider.CheckHealthAsync calls the
GET {endpoint}/openai/models endpoint using this option’s address
and credential. When null, health status always returns
ModelProviderHealthStatus.Unknown.
egressGuard EgressSocketGuard?
The outbound network guard. Attached only to a client built from a tenant-supplied endpoint override; when null, such an override is not guarded.
Exceptions
Section titled “Exceptions”One of the required dependencies is null.
name is empty.
Properties
Section titled “Properties”Models
Section titled “ Models”The models this provider offers.
public IReadOnlyList<ModelDescriptor> Models { get; }Property Value
Section titled “Property Value”IReadOnlyList<ModelDescriptor>
The provider name. ModelBinding.Provider matches this value. Comparison is case-insensitive.
public string Name { get; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”CheckHealthAsync(CancellationToken)
Section titled “ CheckHealthAsync(CancellationToken)”Checks the provider’s reachability.
public ValueTask<ModelProviderHealth> CheckHealthAsync(CancellationToken cancellationToken = default)Parameters
Section titled “Parameters”cancellationToken CancellationToken
The cancellation token.
Returns
Section titled “Returns”ValueTask<ModelProviderHealth>
The check result.
CreateChatClient(ModelBinding, ModelProviderCredential?)
Section titled “ CreateChatClient(ModelBinding, ModelProviderCredential?)”Produces a raw chat client for the given binding.
public IChatClient CreateChatClient(ModelBinding binding, ModelProviderCredential? credential = null)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
credential ModelProviderCredential?
A resolved per-tenant credential (BYOK). When null, the provider’s own setup-time credential is used and behavior is identical to a setup without per-tenant credentials. When given, the provider builds (or reuses a cached) client using ModelProviderCredential.ApiKey and, if present, ModelProviderCredential.Endpoint, instead of its setup-time credential.
Returns
Section titled “Returns”IChatClient
The provider-specific client. Decorators specific to the provider (example: Anthropic’s settings decorator) may be added here.
Remarks
Section titled “Remarks”Do not build the common pipeline here.
UseFunctionInvocation, UseOpenTelemetry, the content
guard, the circuit breaker, and extra resolution are added by
ModelProviderRegistry.CreateChatClient. Before that shared pipeline, every
provider package built the tool-call loop inside itself; the result
was that no ring the registry wraps around could see the loop’s turns
— a tool result entered the model uninspected.
If the loop is also built here, two nested FunctionInvokingChatClient
instances form: the inner one resolves tools, the outer one never sees
any call. The damage is not functional but measurable (double
wrapping, a misleading span tree).
GetConfigurationDiagnostic()
Section titled “ GetConfigurationDiagnostic()”Returns the resolution status of the configuration key required by this provider.
public ConfigurationDiagnostic? GetConfigurationDiagnostic()Returns
Section titled “Returns”null when the provider was not configured with an options object.