Class: Anthropic
Unified language model interface
Extends
ToolCallLLM
<AnthropicAdditionalChatOptions
,AnthropicToolCallLLMMessageOptions
>
Constructors
new Anthropic()
new Anthropic(
init
?):Anthropic
Parameters
• init?: Partial
<Anthropic
>
Returns
Overrides
Defined in
packages/providers/anthropic/dist/index.d.ts:136
Properties
apiKey?
optional
apiKey:string
Defined in
packages/providers/anthropic/dist/index.d.ts:132
getModelName()
getModelName: (
model
) =>string
Parameters
• model: string
Returns
string
Defined in
packages/providers/anthropic/dist/index.d.ts:146
maxRetries
maxRetries:
number
Defined in
packages/providers/anthropic/dist/index.d.ts:133
maxTokens?
optional
maxTokens:number
Defined in
packages/providers/anthropic/dist/index.d.ts:131
model
model:
"claude-3-5-haiku-latest"
|"claude-3-5-haiku-20241022"
|"claude-3-5-sonnet-latest"
|"claude-3-5-sonnet-20241022"
|"claude-3-5-sonnet-20240620"
|"claude-3-opus-latest"
|"claude-3-opus-20240229"
|"claude-3-sonnet-20240229"
|"claude-3-haiku-20240307"
|"claude-2.1"
|"claude-2.0"
|"claude-instant-1.2"
|"claude-3-5-sonnet"
|"claude-3-5-haiku"
|"claude-3-opus"
|"claude-3-sonnet"
|"claude-3-haiku"
|object
&string
Defined in
packages/providers/anthropic/dist/index.d.ts:128
session
session:
AnthropicSession
Defined in
packages/providers/anthropic/dist/index.d.ts:135
temperature
temperature:
number
Defined in
packages/providers/anthropic/dist/index.d.ts:129
timeout?
optional
timeout:number
Defined in
packages/providers/anthropic/dist/index.d.ts:134
topP
topP:
number
Defined in
packages/providers/anthropic/dist/index.d.ts:130
Accessors
metadata
Get Signature
get metadata():
object
Returns
object
contextWindow
contextWindow:
number
maxTokens
maxTokens:
undefined
|number
model
model:
"claude-3-5-haiku-latest"
|"claude-3-5-haiku-20241022"
|"claude-3-5-sonnet-latest"
|"claude-3-5-sonnet-20241022"
|"claude-3-5-sonnet-20240620"
|"claude-3-opus-latest"
|"claude-3-opus-20240229"
|"claude-3-sonnet-20240229"
|"claude-3-haiku-20240307"
|"claude-2.1"
|"claude-2.0"
|"claude-instant-1.2"
|"claude-3-5-sonnet"
|"claude-3-5-haiku"
|"claude-3-opus"
|"claude-3-sonnet"
|"claude-3-haiku"
|object
&string
temperature
temperature:
number
tokenizer
tokenizer:
undefined
topP
topP:
number
Overrides
Defined in
packages/providers/anthropic/dist/index.d.ts:138
supportToolCall
Get Signature
get supportToolCall():
boolean
Returns
boolean
Overrides
Defined in
packages/providers/anthropic/dist/index.d.ts:137
Methods
chat()
chat(params)
chat(
params
):Promise
<AsyncIterable
<ChatResponseChunk
<AnthropicToolCallLLMMessageOptions
>,any
,any
>>
Get a chat response from the LLM
Parameters
• params: LLMChatParamsStreaming
<object
, AnthropicToolCallLLMMessageOptions
>
Returns
Promise
<AsyncIterable
<ChatResponseChunk
<AnthropicToolCallLLMMessageOptions
>, any
, any
>>
Overrides
Defined in
packages/providers/anthropic/dist/index.d.ts:150
chat(params)
chat(
params
):Promise
<ChatResponse
<AnthropicToolCallLLMMessageOptions
>>
Parameters
• params: LLMChatParamsNonStreaming
<object
, AnthropicToolCallLLMMessageOptions
>
Returns
Promise
<ChatResponse
<AnthropicToolCallLLMMessageOptions
>>
Overrides
Defined in
packages/providers/anthropic/dist/index.d.ts:151
complete()
complete(params)
complete(
params
):Promise
<AsyncIterable
<CompletionResponse
,any
,any
>>
Get a prompt completion from the LLM
Parameters
• params: LLMCompletionParamsStreaming
Returns
Promise
<AsyncIterable
<CompletionResponse
, any
, any
>>
Inherited from
Defined in
packages/core/llms/dist/index.d.ts:163
complete(params)
complete(
params
):Promise
<CompletionResponse
>
Parameters
• params: LLMCompletionParamsNonStreaming
Returns
Promise
<CompletionResponse
>
Inherited from
Defined in
packages/core/llms/dist/index.d.ts:164
formatMessages()
formatMessages(
messages
):MessageParam
[]
Parameters
• messages: ChatMessage
<ToolCallLLMMessageOptions
>[]
Returns
MessageParam
[]
Defined in
packages/providers/anthropic/dist/index.d.ts:147
streamChat()
protected
streamChat(messages
,systemPrompt
,anthropic
):AsyncIterable
<ChatResponseChunk
<AnthropicToolCallLLMMessageOptions
>,any
,any
>
Parameters
• messages: ChatMessage
<AnthropicToolCallLLMMessageOptions
>[]
• systemPrompt: null
| string
| BetaTextBlockParam
[]
• anthropic: Anthropic
Returns
AsyncIterable
<ChatResponseChunk
<AnthropicToolCallLLMMessageOptions
>, any
, any
>
Defined in
packages/providers/anthropic/dist/index.d.ts:152
toTool()
static
toTool(tool
):Tool
Parameters
• tool: BaseTool
<any
>
Returns
Tool
Defined in
packages/providers/anthropic/dist/index.d.ts:153