AnthropicLanguageModel.ts overview
Since v1.0.0
Exports Grouped by Category
Ai Models
model
Signature
declare const model: (
model: (string & {}) | Model,
config?: Omit<Config.Service, "model">
) => AiModel.Model<"anthropic", LanguageModel.LanguageModel, AnthropicClient>
Since v1.0.0
modelWithTokenizer
Signature
declare const modelWithTokenizer: (
model: (string & {}) | Model,
config?: Omit<Config.Service, "model">
) => AiModel.Model<"anthropic", LanguageModel.LanguageModel | Tokenizer.Tokenizer, AnthropicClient>
Since v1.0.0
Configuration
withConfigOverride
Signature
declare const withConfigOverride: {
(config: Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
<A, E, R>(self: Effect.Effect<A, E, R>, config: Config.Service): Effect.Effect<A, E, R>
}
Since v1.0.0
Constructors
make
Signature
declare const make: (options: {
readonly model: (string & {}) | Model
readonly config?: Omit<Config.Service, "model">
}) => Effect.Effect<LanguageModel.Service, never, AnthropicClient>
Since v1.0.0
Context
Config (class)
Signature
declare class Config
Since v1.0.0
Layers
layer
Signature
declare const layer: (options: {
readonly model: (string & {}) | Model
readonly config?: Omit<Config.Service, "model">
}) => Layer.Layer<LanguageModel.LanguageModel, never, AnthropicClient>
Since v1.0.0
layerWithTokenizer
Signature
declare const layerWithTokenizer: (options: {
readonly model: (string & {}) | Model
readonly config?: Omit<Config.Service, "model">
}) => Layer.Layer<LanguageModel.LanguageModel | Tokenizer.Tokenizer, never, AnthropicClient>
Since v1.0.0
Models
AnthropicTools (type alias)
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
Since v1.0.0
Model (type alias)
Signature
type Model = typeof Generated.Model.Encoded
Since v1.0.0
Provider Metadata
AnthropicReasoningInfo (type alias)
Signature
type AnthropicReasoningInfo =
| {
readonly type: "thinking"
/**
* Thinking content as an encrypted string, which is used to verify
* that thinking content was indeed generated by Anthropic's API.
*/
readonly signature: typeof Generated.ResponseThinkingBlock.fields.thinking.Encoded
}
| {
readonly type: "redacted_thinking"
/**
* Thinking content which was flagged by Anthropic's safety systems, and
* was therefore encrypted.
*/
readonly redactedData: typeof Generated.RequestRedactedThinkingBlock.fields.data.Encoded
}
Since v1.0.0
Tool Calling
prepareTools
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 tools: ReadonlyArray<AnthropicTools> | undefined
readonly toolChoice: typeof Generated.BetaToolChoice.Encoded | undefined
},
AiError.AiError
>
Since v1.0.0
utils
Config (namespace)
Since v1.0.0
Service (interface)
Signature
export interface Service
extends Simplify<
Partial<Omit<typeof Generated.CreateMessageParams.Encoded, "messages" | "tools" | "tool_choice" | "stream">>
> {
readonly disableParallelToolCalls?: boolean
}
Since v1.0.0