ModelProviderSettings
AgentPrism.Abstractions.dllHelpers that read and validate the ModelBinding.ProviderSettings dictionary.
public static class ModelProviderSettingsInheritance
Section titled “Inheritance”object ← ModelProviderSettings
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()
Remarks
Section titled “Remarks”Each provider package knows its own key prefix (anthropic, google) and
carries the list of keys it supports. This type applies that list, so the validation
logic is not written again in every new provider package.
An unknown key is not ignored silently. A setting that is ignored makes the user miss the behaviour they expect without seeing why — the same decision as the one taken for ModelBinding.ReasoningEffort.
Keys are compared case insensitively. When the dictionary is read back from a
jsonb column it arrives with the default (ordinal) comparer; the lookup is
therefore not left to the comparer of the dictionary itself.
Methods
Section titled “Methods”ReadBoolean(ModelBinding, string)
Section titled “ ReadBoolean(ModelBinding, string)”Reads a setting as a boolean value.
public static bool? ReadBoolean(ModelBinding binding, string key)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
key string
The full key, for example anthropic.promptCaching.
Returns
Section titled “Returns”bool?
null when the setting is not defined.
Exceptions
Section titled “Exceptions”binding is null.
The value is not a boolean value.
ReadInt32(ModelBinding, string)
Section titled “ ReadInt32(ModelBinding, string)”Reads a setting as an integer.
public static int? ReadInt32(ModelBinding binding, string key)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
key string
The full key, for example anthropic.thinking.budgetTokens.
Returns
Section titled “Returns”int?
null when the setting is not defined.
Exceptions
Section titled “Exceptions”binding is null.
The value is not an integer.
ReadString(ModelBinding, string)
Section titled “ ReadString(ModelBinding, string)”Reads a setting as text.
public static string? ReadString(ModelBinding binding, string key)Parameters
Section titled “Parameters”binding ModelBinding
The model binding.
key string
The full key, for example google.safety.harassment.
Returns
Section titled “Returns”null when the setting is not defined or is empty.
Exceptions
Section titled “Exceptions”binding is null.
The value is not text.
Validate(ModelBinding, string, IReadOnlyCollection<string>)
Section titled “ Validate(ModelBinding, string, IReadOnlyCollection<string>)”Validates that every provider setting in the binding belongs to the given prefix and is supported.
public static void Validate(ModelBinding binding, string providerPrefix, IReadOnlyCollection<string> supportedKeys)Parameters
Section titled “Parameters”binding ModelBinding
The model binding to check.
providerPrefix string
The key prefix of the provider, for example anthropic.
supportedKeys IReadOnlyCollection<string>
The full keys the provider supports, prefix included, for example
anthropic.promptCaching.
Exceptions
Section titled “Exceptions”One of the parameters is null.
providerPrefix is empty.
The dictionary holds a key that belongs to another provider or that is not recognized. The message lists the supported keys.