Skip to content
Effect 4.0 is here. One ecosystem. Zero dependencies.

AnthropicLanguageModel

12 exports Since v1.0.0 Source

Ai Models

Since v1.0.0

Signature

declare function model(model: unknown, config?: Omit<Service, "model">): Model<"anthropic", LanguageModel, AnthropicClient>

Signature

declare function modelWithTokenizer(model: unknown, config?: Omit<Service, "model">): Model<"anthropic", any, AnthropicClient>

Configuration

Signature

declare const withConfigOverride: {
(config: Service): <A, E, R>(self: Effect<A, E, R>) => Effect<A, E, R>;
<A, E, R>(self: Effect<A, E, R>, config: Service): Effect<A, E, R>;
}

Constructors

Since v1.0.0

Signature

declare const make: (...args: [options: {
readonly config?: Omit<Service, "model">;
readonly model: unknown;
}]) => Effect<any, unknown, unknown>

Context

Since v1.0.0

Signature

declare class Config extends any {
constructor();
static readonly getOrUndefined: Effect<any>;
}

Layers

Since v1.0.0

Signature

declare function layer(options: {
readonly config?: Omit<Service, "model">;
readonly model: unknown;
}): Layer<LanguageModel, never, AnthropicClient>

Signature

declare function layerWithTokenizer(options: {
readonly config?: Omit<Service, "model">;
readonly model: unknown;
}): Layer<any, never, AnthropicClient>

Models

Since v1.0.0

Represents all possible Anthropic provider-defined tools.

Signature

type AnthropicTools = typeof Generated.BetaTool.Encoded | typeof Generated.BetaBashTool20241022.Encoded | typeof Generated.BetaBashTool20250124.Encoded | typeof Generated.BetaComputerUseTool20241022.Encoded | typeof Generated.BetaComputerUseTool20250124.Encoded | typeof Generated.BetaTextEditor20241022.Encoded | typeof Generated.BetaTextEditor20250124.Encoded | typeof Generated.BetaTextEditor20250429.Encoded | typeof Generated.BetaTextEditor20250728.Encoded

Model

type
Since v1.0.0

Signature

type Model = typeof Generated.Model.Encoded

Other

Since v1.0.0

Provider Metadata

Signature

type AnthropicReasoningInfo = {
readonly signature: typeof Generated.ResponseThinkingBlock.fields.thinking.Encoded;
readonly type: "thinking";
} | {
readonly redactedData: typeof Generated.RequestRedactedThinkingBlock.fields.data.Encoded;
readonly type: "redacted_thinking";
}

Tool Calling

A helper method which takes in large language model provider options from the base Effect AI SDK as well as Anthropic request configuration options and returns the prepared tools, tool choice, and Anthropic betas to include in a request.

This method is primarily exposed for use by other Effect provider integrations which can utilize Anthropic models (i.e. Amazon Bedrock).

Signature

declare const prepareTools: (options: LanguageModel.ProviderOptions, config: Config.Service) => Effect.Effect<{
readonly betas: ReadonlySet<string>;
readonly toolChoice: typeof Generated.BetaToolChoice.Encoded | undefined;
readonly tools: ReadonlyArray<AnthropicTools> | undefined;
}, AiError.AiError>