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:638
Properties
apiKey
• Optional
apiKey: string
= undefined
Defined in
packages/core/src/llm/LLM.ts:631
callbackManager
• Optional
callbackManager: CallbackManager
Defined in
packages/core/src/llm/LLM.ts:636
maxRetries
• maxRetries: number
Defined in
packages/core/src/llm/LLM.ts:632
maxTokens
• Optional
maxTokens: number
Defined in
packages/core/src/llm/LLM.ts:628
model
• model: "claude-2"
| "claude-instant-1"
Defined in
packages/core/src/llm/LLM.ts:625
session
• session: AnthropicSession
Defined in
packages/core/src/llm/LLM.ts:634
temperature
• temperature: number
Defined in
packages/core/src/llm/LLM.ts:626
timeout
• Optional
timeout: number
Defined in
packages/core/src/llm/LLM.ts:633
topP
• topP: number
Defined in
packages/core/src/llm/LLM.ts:627
Accessors
metadata
• get
metadata(): Object
Returns
Object
Name | Type |
---|---|
contextWindow | number |
maxTokens | undefined | number |
model | "claude-2" | "claude-instant-1" |
temperature | number |
tokenizer | undefined |
topP | number |
Overrides
BaseLLM.metadata
Defined in
packages/core/src/llm/LLM.ts:663
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:691
▸ chat(params
): Promise
<ChatResponse
>
Parameters
Name | Type |
---|---|
params | LLMChatParamsNonStreaming |
Returns
Promise
<ChatResponse
>
Overrides
BaseLLM.chat
Defined in
packages/core/src/llm/LLM.ts:694
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:18
▸ complete(params
): Promise
<CompletionResponse
>
Parameters
Name | Type |
---|---|
params | LLMCompletionParamsNonStreaming |
Returns
Promise
<CompletionResponse
>
Inherited from
BaseLLM.complete
Defined in
packages/core/src/llm/base.ts:21
mapMessagesToPrompt
▸ mapMessagesToPrompt(messages
): string
Parameters
Name | Type |
---|---|
messages | ChatMessage [] |
Returns
string
Defined in
packages/core/src/llm/LLM.ts:674
streamChat
▸ streamChat(messages
, parentEvent?
): AsyncIterable
<ChatResponseChunk
>
Parameters
Name | Type |
---|---|
messages | ChatMessage [] |
parentEvent? | Event |
Returns
AsyncIterable
<ChatResponseChunk
>
Defined in
packages/core/src/llm/LLM.ts:720
tokens
▸ tokens(messages
): number
Parameters
Name | Type |
---|---|
messages | ChatMessage [] |
Returns
number
Overrides
BaseLLM.tokens