Skip to content

Latest commit

 

History

History
333 lines (210 loc) · 8.34 KB

modules.md

File metadata and controls

333 lines (210 loc) · 8.34 KB

chatgpt / Exports

chatgpt

Table of contents

Namespaces

Classes

Interfaces

Type Aliases

Type Aliases

ChatGPTAPIOptions

Ƭ ChatGPTAPIOptions: Object

Type declaration

Name Type Description
apiBaseUrl? string Default Value 'https://api.openai.com' *
apiKey string -
apiOrg? string -
completionParams? Partial<Omit<CreateChatCompletionRequest, "messages" | "n" | "stream">> -
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 -

Defined in

src/types.ts:7


ContentType

Ƭ ContentType: "text"

Defined in

src/types.ts:152


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:108


ConversationResponseEvent

Ƭ ConversationResponseEvent: Object

Type declaration

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

Defined in

src/types.ts:166


FetchFn

Ƭ FetchFn: typeof fetch

Defined in

src/types.ts:5


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:90


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:172


MessageActionType

Ƭ MessageActionType: "next" | "variant"

Defined in

src/types.ts:53


MessageContent

Ƭ MessageContent: Object

Type declaration

Name Type
content_type string
parts string[]

Defined in

src/types.ts:185


MessageMetadata

Ƭ MessageMetadata: any

Defined in

src/types.ts:190


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:135


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:154


Role

Ƭ Role: "user" | "assistant" | "system"

Defined in

src/types.ts:3


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:55


SendMessageOptions

Ƭ SendMessageOptions: Object

Type declaration

Name Type Description
abortSignal? AbortSignal -
completionParams? Partial<Omit<CreateChatCompletionRequest, "messages" | "n" | "stream">> -
conversationId? string -
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 -

Defined in

src/types.ts:37


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:93