ModelBinding
AgentPrism.Abstractions.dllDetermines the provider and the model an agent runs with. It carries no credentials; the API key is resolved from configuration.
public sealed record ModelBinding : IEquatable<ModelBinding>Inheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Constructors
Section titled “Constructors”ModelBinding()
Section titled “ ModelBinding()”public ModelBinding()Properties
Section titled “Properties”Fallbacks
Section titled “ Fallbacks”Gets the ordered fallback chain tried when the primary provider is unavailable. Empty by default.
public IReadOnlyList<ModelFallback> Fallbacks { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”Empty by default: with no fallback configured, today’s behavior is preserved exactly — a provider failure (for example an open circuit) still throws, and no fallback code path runs.
A fallback link carries only a provider and a model, not a full ModelBinding: ModelBinding.Temperature, ModelBinding.ProviderSettings, and the other fields do not carry over to the fallback call. A fallback model that needs its own settings is a separate configuration concern, not something this chain expresses.
Switching to a fallback is never silent: the run record gets an
explicit ModelFallbackUsed event, and cost and model attribution
(RunStatistics.ByModel) reflect the model that actually answered,
not the primary binding.
MaxOutputTokens
Section titled “ MaxOutputTokens”Gets the upper output token limit. The provider default is used when it is null.
public int? MaxOutputTokens { get; init; }Property Value
Section titled “Property Value”int?
Gets the model name, for example gpt-5.4-mini.
public required string Model { get; init; }Property Value
Section titled “Property Value”Provider
Section titled “ Provider”Gets the provider name, for example openai.
public required string Provider { get; init; }Property Value
Section titled “Property Value”ProviderSettings
Section titled “ ProviderSettings”Gets the provider-specific extra settings. A key has the form {provider}.{setting}.
public IReadOnlyDictionary<string, JsonElement> ProviderSettings { get; init; }Property Value
Section titled “Property Value”IReadOnlyDictionary<string, JsonElement>
Remarks
Section titled “Remarks”The prompt caching of Anthropic or the safety thresholds of Gemini do not fit the
fixed fields of this contract. Adding them to the body of ModelBinding
would leak one vendor’s concept into AgentPrism.Abstractions. This dictionary
keeps the contract clean: each provider reads only its own prefix.
An unknown key is not ignored silently. When a provider sees a key it does not recognize, the build fails and lists the keys it supports. The reason is the same as for ModelBinding.ReasoningEffort: a setting that is ignored silently makes the user miss the behaviour they expect without seeing why.
Keys are compared with StringComparer.OrdinalIgnoreCase. Use the
ModelProviderSettings helpers to read them.
"ProviderSettings": { "anthropic.promptCaching": true, "anthropic.thinking.budgetTokens": 8000, "google.safety.harassment": "BLOCK_ONLY_HIGH"}ReasoningEffort
Section titled “ ReasoningEffort”Gets the reasoning effort level. Models that support it use the value; the other providers ignore it.
public string? ReasoningEffort { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The valid values are the Microsoft.Extensions.AI.ReasoningEffort names:
None, Low, Medium, High, ExtraHigh. The
comparison is case insensitive. An unrecognized value is rejected while the agent
is built, with AgentPrismCompilationException; it is not ignored silently.
ResponseFormat
Section titled “ ResponseFormat”Gets the requested output format. When it is null today’s behaviour does not change: no format constraint is sent to the provider.
public AgentResponseFormat? ResponseFormat { get; init; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”AgentResponseFormatKind.Text differs from null:
null means “say nothing”, Text means “ask for plain text
explicitly”. An invalid combination (for example
AgentResponseFormatKind.JsonSchema without a schema) is rejected
while the agent is built, with AgentPrismCompilationException.
Temperature
Section titled “ Temperature”Gets the sampling temperature. The provider default is used when it is null.
public float? Temperature { get; init; }Property Value
Section titled “Property Value”Gets the nucleus sampling threshold. The provider default is used when it is null.
public float? TopP { get; init; }Property Value
Section titled “Property Value”Methods
Section titled “Methods”Equals(object?)
Section titled “ Equals(object?)”public override bool Equals(object? obj)Parameters
Section titled “Parameters”obj object?
Returns
Section titled “Returns”Equals(ModelBinding?)
Section titled “ Equals(ModelBinding?)”public bool Equals(ModelBinding? other)Parameters
Section titled “Parameters”other ModelBinding?
Returns
Section titled “Returns”GetHashCode()
Section titled “ GetHashCode()”public override int GetHashCode()Returns
Section titled “Returns”ToString()
Section titled “ ToString()”public override string ToString()Returns
Section titled “Returns”Operators
Section titled “Operators”operator ==(ModelBinding?, ModelBinding?)
Section titled “ operator ==(ModelBinding?, ModelBinding?)”public static bool operator ==(ModelBinding? left, ModelBinding? right)Parameters
Section titled “Parameters”left ModelBinding?
right ModelBinding?
Returns
Section titled “Returns”operator !=(ModelBinding?, ModelBinding?)
Section titled “ operator !=(ModelBinding?, ModelBinding?)”public static bool operator !=(ModelBinding? left, ModelBinding? right)Parameters
Section titled “Parameters”left ModelBinding?
right ModelBinding?