Skip to content

AnthropicLanguageModel

12 exports Added in v1.0.0 Source

Ai Models

model

Added in v1.0.0 Source

Signature

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

Signature

declare function modelWithTokenizer(
  model: any,
  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

make

Added in v1.0.0 Source

Signature

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

Context

Config

Added in v1.0.0 Source

Signature

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

Layers

layer

Added in v1.0.0 Source

Signature

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

Signature

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

Models

AnthropicTools type

Added in v1.0.0 Source

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

Added in v1.0.0 Source

Signature

type Model = typeof Generated.Model.Encoded;

Other

Config

Added in v1.0.0 Source

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

prepareTools

Added in v1.0.0 Source

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
>;