Skip to content

AnthropicProviderExtensions

Namespace AgentPrism · Assembly AgentPrism.Anthropic.dll

Extensions that add the Anthropic (Claude) provider to the AgentPrism chain.

public static class AnthropicProviderExtensions

objectAnthropicProviderExtensions

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

UseAnthropic(IAgentPrismBuilder, string, Action<AnthropicProviderOptions>?)

Section titled “ UseAnthropic(IAgentPrismBuilder, string, Action<AnthropicProviderOptions>?)”

Adds the Anthropic provider using an API key.

public static IAgentPrismBuilder UseAnthropic(this IAgentPrismBuilder builder, string apiKey, Action<AnthropicProviderOptions>? configure = null)

builder IAgentPrismBuilder

The AgentPrism chain.

apiKey string

Anthropic API key.

configure Action<AnthropicProviderOptions>?

Additional settings modifier.

IAgentPrismBuilder

The continuation of the chain.

builder.AddAgentPrism()
.UseAnthropic(builder.Configuration["Anthropic:ApiKey"]!);

ArgumentNullException

builder is null.

ArgumentException

apiKey is empty.

UseAnthropic(IAgentPrismBuilder, IConfiguration)

Section titled “ UseAnthropic(IAgentPrismBuilder, IConfiguration)”

Adds the Anthropic provider, reading settings from the AgentPrism:Providers:Anthropic section.

public static IAgentPrismBuilder UseAnthropic(this IAgentPrismBuilder builder, IConfiguration configurationSection)

builder IAgentPrismBuilder

The AgentPrism chain.

configurationSection IConfiguration

The section settings are read from. Typically configuration.GetSection(AnthropicProviderOptions.SectionName).

IAgentPrismBuilder

The continuation of the chain.

ArgumentNullException

One of the parameters is null.

UseAnthropic(IAgentPrismBuilder, Action<AnthropicProviderOptions>)

Section titled “ UseAnthropic(IAgentPrismBuilder, Action<AnthropicProviderOptions>)”

Adds the Anthropic provider using settings given in code.

public static IAgentPrismBuilder UseAnthropic(this IAgentPrismBuilder builder, Action<AnthropicProviderOptions> configure)

builder IAgentPrismBuilder

The AgentPrism chain.

configure Action<AnthropicProviderOptions>

Settings modifier.

IAgentPrismBuilder

The continuation of the chain.

This call registers a single provider: AnthropicProviderNames.Anthropic.

Registration uses AddModelProvider(...); no existing service is replaced. Calling this more than once merges the settings; the provider is registered only once.

ArgumentNullException

One of the parameters is null.