Skip to content

Latest commit

 

History

History
107 lines (62 loc) · 2.81 KB

ChatGPTConversation.md

File metadata and controls

107 lines (62 loc) · 2.81 KB

chatgpt / Exports / ChatGPTConversation

Class: ChatGPTConversation

A conversation wrapper around the ChatGPTAPI. This allows you to send multiple messages to ChatGPT and receive responses, without having to manually pass the conversation ID and parent message ID for each message.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new ChatGPTConversation(api, opts?)

Creates a new conversation wrapper around the ChatGPT API.

Parameters

Name Type Description
api ChatGPTAPI The ChatGPT API instance to use
opts Object -
opts.conversationId? string Optional ID of a conversation to continue
opts.parentMessageId? string Optional ID of the previous message in the conversation

Defined in

src/chatgpt-conversation.ts:21

Properties

api

api: ChatGPTAPI

Defined in

src/chatgpt-conversation.ts:10


conversationId

conversationId: string = undefined

Defined in

src/chatgpt-conversation.ts:11


parentMessageId

parentMessageId: string = undefined

Defined in

src/chatgpt-conversation.ts:12

Methods

sendMessage

sendMessage(message, opts?): Promise<string>

Sends a message to ChatGPT, waits for the response to resolve, and returns the response.

If this is the first message in the conversation, the conversation ID and parent message ID will be automatically set.

This allows you to send multiple messages to ChatGPT and receive responses, without having to manually pass the conversation ID and parent message ID for each message.

Parameters

Name Type Description
message string The prompt message to send
opts SendConversationMessageOptions -

Returns

Promise<string>

The response from ChatGPT

Defined in

src/chatgpt-conversation.ts:48