Skip to content

Commit

Permalink
anthropic support
Browse files Browse the repository at this point in the history
  • Loading branch information
yisding committed Jul 30, 2023
1 parent bfab1d4 commit b501eb5
Show file tree
Hide file tree
Showing 23 changed files with 704 additions and 278 deletions.
5 changes: 5 additions & 0 deletions .changeset/mean-cherries-compare.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"llamaindex": patch
---

Added Anthropic Claude support
183 changes: 183 additions & 0 deletions apps/docs/docs/api/classes/Anthropic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
---
id: "Anthropic"
title: "Class: Anthropic"
sidebar_label: "Anthropic"
sidebar_position: 0
custom_edit_url: null
---

Anthropic LLM implementation

## Implements

- [`LLM`](../interfaces/LLM.md)

## Constructors

### constructor

**new Anthropic**(`init?`)

#### Parameters

| Name | Type |
| :------ | :------ |
| `init?` | `Partial`<[`Anthropic`](Anthropic.md)\> |

#### Defined in

[llm/LLM.ts:343](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L343)

## Properties

### apiKey

`Optional` **apiKey**: `string` = `undefined`

#### Defined in

[llm/LLM.ts:336](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L336)

___

### callbackManager

`Optional` **callbackManager**: [`CallbackManager`](CallbackManager.md)

#### Defined in

[llm/LLM.ts:341](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L341)

___

### maxRetries

**maxRetries**: `number`

#### Defined in

[llm/LLM.ts:337](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L337)

___

### maxTokens

`Optional` **maxTokens**: `number`

#### Defined in

[llm/LLM.ts:333](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L333)

___

### model

**model**: `string`

#### Defined in

[llm/LLM.ts:331](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L331)

___

### session

**session**: `AnthropicSession`

#### Defined in

[llm/LLM.ts:339](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L339)

___

### temperature

**temperature**: `number`

#### Defined in

[llm/LLM.ts:332](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L332)

___

### timeout

`Optional` **timeout**: `number`

#### Defined in

[llm/LLM.ts:338](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L338)

## Methods

### chat

**chat**(`messages`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>

Get a chat response from the LLM

#### Parameters

| Name | Type |
| :------ | :------ |
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |
| `parentEvent?` | [`Event`](../interfaces/Event.md) |

#### Returns

`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>

#### Implementation of

[LLM](../interfaces/LLM.md).[chat](../interfaces/LLM.md#chat)

#### Defined in

[llm/LLM.ts:377](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L377)

___

### complete

**complete**(`prompt`, `parentEvent?`): `Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>

Get a prompt completion from the LLM

#### Parameters

| Name | Type | Description |
| :------ | :------ | :------ |
| `prompt` | `string` | the prompt to complete |
| `parentEvent?` | [`Event`](../interfaces/Event.md) | - |

#### Returns

`Promise`<[`ChatResponse`](../interfaces/ChatResponse.md)\>

#### Implementation of

[LLM](../interfaces/LLM.md).[complete](../interfaces/LLM.md#complete)

#### Defined in

[llm/LLM.ts:394](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L394)

___

### mapMessagesToPrompt

**mapMessagesToPrompt**(`messages`): `string`

#### Parameters

| Name | Type |
| :------ | :------ |
| `messages` | [`ChatMessage`](../interfaces/ChatMessage.md)[] |

#### Returns

`string`

#### Defined in

[llm/LLM.ts:362](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L362)
24 changes: 12 additions & 12 deletions apps/docs/docs/api/classes/LlamaDeuce.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Llama2 LLM implementation

#### Defined in

[llm/LLM.ts:198](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L198)
[llm/LLM.ts:204](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L204)

## Properties

Expand All @@ -36,7 +36,7 @@ Llama2 LLM implementation

#### Defined in

[llm/LLM.ts:193](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L193)
[llm/LLM.ts:199](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L199)

___

Expand All @@ -46,7 +46,7 @@ ___

#### Defined in

[llm/LLM.ts:195](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L195)
[llm/LLM.ts:201](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L201)

___

Expand All @@ -56,7 +56,7 @@ ___

#### Defined in

[llm/LLM.ts:192](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L192)
[llm/LLM.ts:198](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L198)

___

Expand All @@ -66,7 +66,7 @@ ___

#### Defined in

[llm/LLM.ts:196](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L196)
[llm/LLM.ts:202](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L202)

___

Expand All @@ -76,7 +76,7 @@ ___

#### Defined in

[llm/LLM.ts:194](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L194)
[llm/LLM.ts:200](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L200)

## Methods

Expand All @@ -103,7 +103,7 @@ Get a chat response from the LLM

#### Defined in

[llm/LLM.ts:288](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L288)
[llm/LLM.ts:294](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L294)

___

Expand All @@ -130,7 +130,7 @@ Get a prompt completion from the LLM

#### Defined in

[llm/LLM.ts:311](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L311)
[llm/LLM.ts:317](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L317)

___

Expand All @@ -150,7 +150,7 @@ ___

#### Defined in

[llm/LLM.ts:229](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L229)
[llm/LLM.ts:235](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L235)

___

Expand All @@ -170,7 +170,7 @@ ___

#### Defined in

[llm/LLM.ts:206](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L206)
[llm/LLM.ts:212](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L212)

___

Expand All @@ -190,7 +190,7 @@ ___

#### Defined in

[llm/LLM.ts:218](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L218)
[llm/LLM.ts:224](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L224)

___

Expand All @@ -211,4 +211,4 @@ ___

#### Defined in

[llm/LLM.ts:242](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L242)
[llm/LLM.ts:248](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L248)
24 changes: 12 additions & 12 deletions apps/docs/docs/api/classes/OpenAI.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ OpenAI LLM implementation

#### Defined in

[llm/LLM.ts:80](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L80)
[llm/LLM.ts:86](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L86)

## Properties

Expand All @@ -36,7 +36,7 @@ OpenAI LLM implementation

#### Defined in

[llm/LLM.ts:73](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L73)
[llm/LLM.ts:79](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L79)

___

Expand All @@ -46,7 +46,7 @@ ___

#### Defined in

[llm/LLM.ts:78](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L78)
[llm/LLM.ts:84](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L84)

___

Expand All @@ -56,7 +56,7 @@ ___

#### Defined in

[llm/LLM.ts:74](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L74)
[llm/LLM.ts:80](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L80)

___

Expand All @@ -66,7 +66,7 @@ ___

#### Defined in

[llm/LLM.ts:70](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L70)
[llm/LLM.ts:76](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L76)

___

Expand All @@ -76,7 +76,7 @@ ___

#### Defined in

[llm/LLM.ts:68](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L68)
[llm/LLM.ts:74](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L74)

___

Expand All @@ -86,7 +86,7 @@ ___

#### Defined in

[llm/LLM.ts:76](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L76)
[llm/LLM.ts:82](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L82)

___

Expand All @@ -96,7 +96,7 @@ ___

#### Defined in

[llm/LLM.ts:69](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L69)
[llm/LLM.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L75)

___

Expand All @@ -106,7 +106,7 @@ ___

#### Defined in

[llm/LLM.ts:75](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L75)
[llm/LLM.ts:81](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L81)

## Methods

Expand All @@ -133,7 +133,7 @@ Get a chat response from the LLM

#### Defined in

[llm/LLM.ts:116](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L116)
[llm/LLM.ts:122](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L122)

___

Expand All @@ -160,7 +160,7 @@ Get a prompt completion from the LLM

#### Defined in

[llm/LLM.ts:154](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L154)
[llm/LLM.ts:160](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L160)

___

Expand All @@ -180,4 +180,4 @@ ___

#### Defined in

[llm/LLM.ts:99](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L99)
[llm/LLM.ts:105](https://github.com/run-llama/LlamaIndexTS/blob/main/packages/core/src/llm/LLM.ts#L105)
Loading

0 comments on commit b501eb5

Please sign in to comment.