Class: Anthropic
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/anthropic.ts:97
Properties
apiKey
• Optional
apiKey: string
= undefined
Defined in
packages/core/src/llm/anthropic.ts:92
maxRetries
• maxRetries: number
Defined in
packages/core/src/llm/anthropic.ts:93
maxTokens
• Optional
maxTokens: number
Defined in
packages/core/src/llm/anthropic.ts:89
model
• model: "claude-3-opus"
| "claude-3-sonnet"
| "claude-3-haiku"
| "claude-2.1"
| "claude-instant-1.2"
Defined in
packages/core/src/llm/anthropic.ts:86
session
• session: AnthropicSession
Defined in
packages/core/src/llm/anthropic.ts:95
temperature
• temperature: number
Defined in
packages/core/src/llm/anthropic.ts:87
timeout
• Optional
timeout: number
Defined in
packages/core/src/llm/anthropic.ts:94
topP
• topP: number
Defined in
packages/core/src/llm/anthropic.ts:88
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/anthropic.ts:116
Methods
chat
▸ chat(params
): Promise
<AsyncIterable
<{ delta
: string
; options?
: Record
<string
, unknown
> }>>
Parameters
Name | Type |
---|---|
params | LLMChatParamsStreaming <Record <string , unknown >> |
Returns
Promise
<AsyncIterable
<{ delta
: string
; options?
: Record
<string
, unknown
> }>>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/anthropic.ts:147
▸ chat(params
): Promise
<ChatResponse
<Record
<string
, unknown
>>>
Parameters
Name | Type |
---|---|
params | LLMChatParamsNonStreaming <Record <string , unknown >> |
Returns
Promise
<ChatResponse
<Record
<string
, unknown
>>>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/anthropic.ts:150
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:27
▸ complete(params
): Promise
<CompletionResponse
>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsNonStreaming |
Returns
Promise
<CompletionResponse
>
Inherited from
BaseLLM.complete
Defined in
packages/core/src/llm/base.ts:30
formatMessages
▸ formatMessages(messages
): { content
: string
; role
: "user"
| "assistant"
= message.role }[]
Parameters
Name | Type |
---|---|
messages | { content : MessageContent ; options? : Record <string , unknown > ; role : MessageType }[] |
Returns
{ content
: string
; role
: "user"
| "assistant"
= message.role }[]
Defined in
packages/core/src/llm/anthropic.ts:134
getModelName
▸ getModelName(model
): string
Parameters
Name | Type |
---|---|
model | string |
Returns
string
Defined in
packages/core/src/llm/anthropic.ts:127
streamChat
▸ streamChat(messages
, systemPrompt?
): AsyncIterable
<{ delta
: string
; options?
: Record
<string
, unknown
> }>
Parameters
Name | Type |
---|---|
messages | { content : MessageContent ; options? : Record <string , unknown > ; role : MessageType }[] |
systemPrompt? | null | string |
Returns
AsyncIterable
<{ delta
: string
; options?
: Record
<string
, unknown
> }>