Skip to content

ModelProviderSettings

Namespace AgentPrism · Assembly AgentPrism.Abstractions.dll

Helpers that read and validate the ModelBinding.ProviderSettings dictionary.

public static class ModelProviderSettings

objectModelProviderSettings

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

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.

Reads a setting as a boolean value.

public static bool? ReadBoolean(ModelBinding binding, string key)

binding ModelBinding

The model binding.

key string

The full key, for example anthropic.promptCaching.

bool?

null when the setting is not defined.

ArgumentNullException

binding is null.

AgentPrismException

The value is not a boolean value.

Reads a setting as an integer.

public static int? ReadInt32(ModelBinding binding, string key)

binding ModelBinding

The model binding.

key string

The full key, for example anthropic.thinking.budgetTokens.

int?

null when the setting is not defined.

ArgumentNullException

binding is null.

AgentPrismException

The value is not an integer.

Reads a setting as text.

public static string? ReadString(ModelBinding binding, string key)

binding ModelBinding

The model binding.

key string

The full key, for example google.safety.harassment.

string?

null when the setting is not defined or is empty.

ArgumentNullException

binding is null.

AgentPrismException

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)

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.

ArgumentNullException

One of the parameters is null.

ArgumentException

providerPrefix is empty.

AgentPrismException

The dictionary holds a key that belongs to another provider or that is not recognized. The message lists the supported keys.