chatgpt-api/docs/modules.md

8.1 KiB

chatgpt / Exports

chatgpt

Table of contents

Namespaces

Classes

Interfaces

Type Aliases

Type Aliases

ChatGPTErrorType

Ƭ ChatGPTErrorType: "unknown" | "chatgpt:pool:account-on-cooldown" | "chatgpt:pool:account-not-found" | "chatgpt:pool:no-accounts" | "chatgpt:pool:timeout" | "chatgpt:pool:rate-limit" | "chatgpt:pool:unavailable"

Defined in

src/types.ts:38


ContentType

Ƭ ContentType: "text"

Defined in

src/types.ts:223


ConversationJSONBody

Ƭ ConversationJSONBody: Object

https://chat.openapi.com/backend-api/conversation

Type declaration

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

Defined in

src/types.ts:179


ConversationResponseEvent

Ƭ ConversationResponseEvent: Object

Type declaration

Name Type
conversation_id? string
error? string | null
message? Message

Defined in

src/types.ts:237


FetchFn

Ƭ FetchFn: typeof fetch

Defined in

src/types.ts:3


GetAccessTokenFn

Ƭ GetAccessTokenFn: ({ email, password, sessionToken }: { email: string ; password: string ; sessionToken?: string }) => string | Promise<string>

Type declaration

▸ ({ email, password, sessionToken }): string | Promise<string>

Parameters
Name Type
`{
email,
password,
sessionToken
}` Object
`{
email,
password,
sessionToken
}.email` string
`{
email,
password,
sessionToken
}.password` string
`{
email,
password,
sessionToken
}.sessionToken?` string
Returns

string | Promise<string>

Defined in

src/types.ts:263


GetMessageByIdFunction

Ƭ GetMessageByIdFunction: (id: string) => Promise<ChatMessage>

Type declaration

▸ (id): Promise<ChatMessage>

Returns a chat message from a store by it's ID (or null if not found).

Parameters
Name Type
id string
Returns

Promise<ChatMessage>

Defined in

src/types.ts:56


Message

Ƭ Message: Object

Type declaration

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

Defined in

src/types.ts:243


MessageActionType

Ƭ MessageActionType: "next" | "variant"

Defined in

src/types.ts:17


MessageContent

Ƭ MessageContent: Object

Type declaration

Name Type
content_type string
parts string[]

Defined in

src/types.ts:256


MessageMetadata

Ƭ MessageMetadata: any

Defined in

src/types.ts:261


Prompt

Ƭ Prompt: Object

Type declaration

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

Defined in

src/types.ts:206


PromptContent

Ƭ PromptContent: Object

Type declaration

Name Type Description
content_type ContentType The content type of the prompt
parts string[] The parts to the prompt

Defined in

src/types.ts:225


Role

Ƭ Role: "user" | "assistant"

Defined in

src/types.ts:1


SendMessageBrowserOptions

Ƭ SendMessageBrowserOptions: Object

Type declaration

Name Type
abortSignal? AbortSignal
action? MessageActionType
conversationId? string
messageId? string
onProgress? (partialResponse: ChatMessage) => void
parentMessageId? string
timeoutMs? number

Defined in

src/types.ts:19


SendMessageOptions

Ƭ SendMessageOptions: Object

Type declaration

Name Type
abortSignal? AbortSignal
conversationId? string
messageId? string
onProgress? (partialResponse: ChatMessage) => void
parentMessageId? string
promptPrefix? string
promptSuffix? string
stream? boolean
timeoutMs? number

Defined in

src/types.ts:5


UpsertMessageFunction

Ƭ UpsertMessageFunction: (message: ChatMessage) => Promise<void>

Type declaration

▸ (message): Promise<void>

Upserts a chat message to a store.

Parameters
Name Type
message ChatMessage
Returns

Promise<void>

Defined in

src/types.ts:59