2022-12-03 00:04:53 +00:00
|
|
|
[chatgpt](readme.md) / Exports
|
|
|
|
|
|
|
|
# chatgpt
|
|
|
|
|
|
|
|
## Table of contents
|
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
### Namespaces
|
|
|
|
|
|
|
|
- [openai](modules/openai.md)
|
|
|
|
|
2022-12-03 00:04:53 +00:00
|
|
|
### Classes
|
|
|
|
|
|
|
|
- [ChatGPTAPI](classes/ChatGPTAPI.md)
|
2022-12-12 00:04:20 +00:00
|
|
|
- [ChatGPTError](classes/ChatGPTError.md)
|
2022-12-05 05:13:36 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
### Interfaces
|
|
|
|
|
|
|
|
- [ChatMessage](interfaces/ChatMessage.md)
|
|
|
|
|
2022-12-05 05:13:36 +00:00
|
|
|
### Type Aliases
|
|
|
|
|
2023-02-14 06:31:49 +00:00
|
|
|
- [FetchFn](modules.md#fetchfn)
|
2023-02-01 10:58:25 +00:00
|
|
|
- [GetMessageByIdFunction](modules.md#getmessagebyidfunction)
|
2022-12-05 05:13:36 +00:00
|
|
|
- [Role](modules.md#role)
|
2022-12-07 00:19:50 +00:00
|
|
|
- [SendMessageOptions](modules.md#sendmessageoptions)
|
2023-02-01 10:58:25 +00:00
|
|
|
- [UpsertMessageFunction](modules.md#upsertmessagefunction)
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
## Type Aliases
|
|
|
|
|
2023-02-14 06:31:49 +00:00
|
|
|
### FetchFn
|
|
|
|
|
|
|
|
Ƭ **FetchFn**: typeof `fetch`
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
|
|
|
[src/types.ts:3](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L3)
|
|
|
|
|
|
|
|
___
|
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
### GetMessageByIdFunction
|
2022-12-05 05:13:36 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
Ƭ **GetMessageByIdFunction**: (`id`: `string`) => `Promise`<[`ChatMessage`](interfaces/ChatMessage.md)\>
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
#### Type declaration
|
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
▸ (`id`): `Promise`<[`ChatMessage`](interfaces/ChatMessage.md)\>
|
2022-12-05 05:13:36 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
Returns a chat message from a store by it's ID (or null if not found).
|
2022-12-05 05:13:36 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
##### Parameters
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `id` | `string` |
|
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
##### Returns
|
2022-12-05 05:13:36 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
`Promise`<[`ChatMessage`](interfaces/ChatMessage.md)\>
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-02-14 06:31:49 +00:00
|
|
|
[src/types.ts:32](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L32)
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### Role
|
|
|
|
|
|
|
|
Ƭ **Role**: ``"user"`` \| ``"assistant"``
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-02-14 06:31:49 +00:00
|
|
|
[src/types.ts:1](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L1)
|
2022-12-07 00:19:50 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
### SendMessageOptions
|
|
|
|
|
|
|
|
Ƭ **SendMessageOptions**: `Object`
|
|
|
|
|
|
|
|
#### Type declaration
|
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
|
|
|
| `abortSignal?` | `AbortSignal` |
|
|
|
|
| `conversationId?` | `string` |
|
2022-12-12 17:23:19 +00:00
|
|
|
| `messageId?` | `string` |
|
2023-02-01 10:58:25 +00:00
|
|
|
| `onProgress?` | (`partialResponse`: [`ChatMessage`](interfaces/ChatMessage.md)) => `void` |
|
2022-12-07 00:19:50 +00:00
|
|
|
| `parentMessageId?` | `string` |
|
2023-02-01 10:58:25 +00:00
|
|
|
| `promptPrefix?` | `string` |
|
|
|
|
| `promptSuffix?` | `string` |
|
|
|
|
| `stream?` | `boolean` |
|
2022-12-07 04:37:56 +00:00
|
|
|
| `timeoutMs?` | `number` |
|
2022-12-07 00:19:50 +00:00
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-02-14 06:31:49 +00:00
|
|
|
[src/types.ts:5](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L5)
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
___
|
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
### UpsertMessageFunction
|
2022-12-05 05:13:36 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
Ƭ **UpsertMessageFunction**: (`message`: [`ChatMessage`](interfaces/ChatMessage.md)) => `Promise`<`void`\>
|
2022-12-05 05:13:36 +00:00
|
|
|
|
|
|
|
#### Type declaration
|
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
▸ (`message`): `Promise`<`void`\>
|
2022-12-15 23:15:38 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
Upserts a chat message to a store.
|
2022-12-15 23:15:38 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
##### Parameters
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
| Name | Type |
|
|
|
|
| :------ | :------ |
|
2023-02-01 10:58:25 +00:00
|
|
|
| `message` | [`ChatMessage`](interfaces/ChatMessage.md) |
|
2022-12-15 23:15:38 +00:00
|
|
|
|
2023-02-01 10:58:25 +00:00
|
|
|
##### Returns
|
2022-12-15 23:15:38 +00:00
|
|
|
|
|
|
|
`Promise`<`void`\>
|
|
|
|
|
|
|
|
#### Defined in
|
|
|
|
|
2023-02-14 06:31:49 +00:00
|
|
|
[src/types.ts:35](https://github.com/transitive-bullshit/chatgpt-api/blob/4379d52/src/types.ts#L35)
|