chatgpt / Exports
- ChatGPTAPIOptions
- ContentType
- ConversationJSONBody
- ConversationResponseEvent
- FetchFn
- GetMessageByIdFunction
- Message
- MessageActionType
- MessageContent
- MessageMetadata
- Prompt
- PromptContent
- Role
- SendMessageBrowserOptions
- SendMessageOptions
- UpsertMessageFunction
Ƭ ChatGPTAPIOptions: Object
| Name | Type | Description |
|---|---|---|
apiBaseUrl? |
string |
Default Value 'https://api.openai.com' * |
apiKey |
string |
- |
completionParams? |
Partial<Omit<CreateChatCompletionRequest, "messages" | "n">> |
- |
debug? |
boolean |
Default Value false * |
fetch? |
FetchFn |
- |
getMessageById? |
GetMessageByIdFunction |
- |
maxModelTokens? |
number |
Default Value 4096 * |
maxResponseTokens? |
number |
Default Value 1000 * |
messageStore? |
Keyv |
- |
systemMessage? |
string |
- |
upsertMessage? |
UpsertMessageFunction |
- |
Ƭ ContentType: "text"
Ƭ ConversationJSONBody: Object
https://chat.openapi.com/backend-api/conversation
| Name | Type | Description |
|---|---|---|
action |
string |
The action to take |
conversation_id? |
string |
The ID of the conversation |
messages |
Prompt[] |
Prompts to provide |
model |
string |
The model to use |
parent_message_id |
string |
The parent message ID |
Ƭ ConversationResponseEvent: Object
| Name | Type |
|---|---|
conversation_id? |
string |
error? |
string | null |
message? |
Message |
Ƭ FetchFn: typeof fetch
Ƭ GetMessageByIdFunction: (id: string) => Promise<ChatMessage>
▸ (id): Promise<ChatMessage>
Returns a chat message from a store by it's ID (or null if not found).
| Name | Type |
|---|---|
id |
string |
Promise<ChatMessage>
Ƭ Message: Object
| Name | Type |
|---|---|
content |
MessageContent |
create_time |
string | null |
end_turn |
null |
id |
string |
metadata |
MessageMetadata |
recipient |
string |
role |
Role |
update_time |
string | null |
user |
string | null |
weight |
number |
Ƭ MessageActionType: "next" | "variant"
Ƭ MessageContent: Object
| Name | Type |
|---|---|
content_type |
string |
parts |
string[] |
Ƭ MessageMetadata: any
Ƭ Prompt: Object
| Name | Type | Description |
|---|---|---|
content |
PromptContent |
The content of the prompt |
id |
string |
The ID of the prompt |
role |
Role |
The role played in the prompt |
Ƭ PromptContent: Object
| Name | Type | Description |
|---|---|---|
content_type |
ContentType |
The content type of the prompt |
parts |
string[] |
The parts to the prompt |
Ƭ Role: "user" | "assistant" | "system"
Ƭ SendMessageBrowserOptions: Object
| Name | Type |
|---|---|
abortSignal? |
AbortSignal |
action? |
MessageActionType |
conversationId? |
string |
messageId? |
string |
onProgress? |
(partialResponse: ChatMessage) => void |
parentMessageId? |
string |
timeoutMs? |
number |
Ƭ SendMessageOptions: Object
| Name | Type | Description |
|---|---|---|
abortSignal? |
AbortSignal |
- |
messageId? |
string |
- |
name? |
string |
The name of a user in a multi-user chat. |
onProgress? |
(partialResponse: ChatMessage) => void |
- |
parentMessageId? |
string |
- |
stream? |
boolean |
- |
systemMessage? |
string |
- |
timeoutMs? |
number |
- |
Ƭ UpsertMessageFunction: (message: ChatMessage) => Promise<void>
▸ (message): Promise<void>
Upserts a chat message to a store.
| Name | Type |
|---|---|
message |
ChatMessage |
Promise<void>