Class: Anthropic
Anthropic LLM implementation
Hierarchy
-
BaseLLM
↳
Anthropic
Constructors
constructor
• new Anthropic(init?
): Anthropic
Parameters
Name | Type |
---|---|
init? | Partial <Anthropic > |
Returns
Overrides
BaseLLM.constructor
Defined in
packages/core/src/llm/LLM.ts:621
Properties
apiKey
• Optional
apiKey: string
= undefined
Defined in
packages/core/src/llm/LLM.ts:616
maxRetries
• maxRetries: number
Defined in
packages/core/src/llm/LLM.ts:617
maxTokens
• Optional
maxTokens: number
Defined in
packages/core/src/llm/LLM.ts:613
model
• model: "claude-3-opus"
| "claude-3-sonnet"
| "claude-3-haiku"
| "claude-2.1"
| "claude-instant-1.2"
Defined in
packages/core/src/llm/LLM.ts:610
session
• session: AnthropicSession
Defined in
packages/core/src/llm/LLM.ts:619
temperature
• temperature: number
Defined in
packages/core/src/llm/LLM.ts:611
timeout
• Optional
timeout: number
Defined in
packages/core/src/llm/LLM.ts:618
topP
• topP: number
Defined in
packages/core/src/llm/LLM.ts:612
Accessors
metadata
• get
metadata(): Object
Returns
Object
Name | Type |
---|---|
contextWindow | number |
maxTokens | undefined | number |
model | "claude-3-opus" | "claude-3-sonnet" | "claude-3-haiku" | "claude-2.1" | "claude-instant-1.2" |
temperature | number |
tokenizer | undefined |
topP | number |
Overrides
BaseLLM.metadata
Defined in
packages/core/src/llm/LLM.ts:640
Methods
chat
▸ chat(params
): Promise
<AsyncIterable
<ChatResponseChunk
>>
Parameters
Name | Type |
---|---|
params | LLMChatParamsStreaming |
Returns
Promise
<AsyncIterable
<ChatResponseChunk
>>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/LLM.ts:671
▸ chat(params
): Promise
<ChatResponse
>
Parameters
Name | Type |
---|---|
params | LLMChatParamsNonStreaming |
Returns
Promise
<ChatResponse
>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/LLM.ts:674
complete
▸ complete(params
): Promise
<AsyncIterable
<CompletionResponse
>>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsStreaming |
Returns
Promise
<AsyncIterable
<CompletionResponse
>>
Inherited from
BaseLLM.complete
Defined in
packages/core/src/llm/base.ts:17
▸ complete(params
): Promise
<CompletionResponse
>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsNonStreaming |
Returns
Promise
<CompletionResponse
>
Inherited from
BaseLLM.complete
Defined in
packages/core/src/llm/base.ts:20
formatMessages
▸ formatMessages(messages
): { content
: any
= message.content; role
: "user"
| "assistant"
= message.role }[]
Parameters
Name | Type |
---|---|
messages | ChatMessage [] |
Returns
{ content
: any
= message.content; role
: "user"
| "assistant"
= message.role }[]
Defined in
packages/core/src/llm/LLM.ts:658
getModelName
▸ getModelName(model
): string
Parameters
Name | Type |
---|---|
model | string |
Returns
string
Defined in
packages/core/src/llm/LLM.ts:651