Internal
Optional
messages?: ({ role: "function" | "user" | "assistant" | "system"; content: string | null; id?: string | undefined; name?: string | undefined; function_call?: { name: string; arguments: Record<string, any>; } | undefined; model?: string | undefined; flags?: string[] | ... 1 more ... | undefined; })[]Private
addPrivate
Readonly
configPrivate
messagesPrivate
Readonly
pluginPrivate
removeAdds a message with the role of "assistant" to the conversation with the function call generated by the assistant.
The name and arguments of the function to call, generated by the assistant.
The Message object that was added to the conversation
Adds a message with the role of "function" to the conversation with the content being the return value of the function call, called by your own code.
The return value of the function call, stringified if needed.
The name of the function that was called.
The Message object that was added to the conversation
Adds a message to the conversation.
The message instance to add to the conversation.
The added message.
This method is mostly meant to be internal, but exposed for convenience.
You should use the addAssistantMessage
, addUserMessage
, addFunctionCallMessage
, or addFunctionMessage
methods when possible.
Private
addReturns the messages in a format OpenAI's Chat Completion API can understand.
Removes a listener function from the list of listeners that was previously added with onMessageAdded
.
The function to remove from the list of listeners.
Removes a listener function from the list of listeners that was previously added with onMessageRemoved
.
The function to remove from the list of listeners.
Adds a listener function that is called whenever a message is added to the conversation.
The function to call when a message is added to the conversation.
A function that removes the listener from the list of listeners.
Adds a listener function that is called whenever a message is removed to the conversation.
The function to call when a message is removed to the conversation.
A function that removes the listener from the list of listeners.
Adds a listener function that is called only once whenever a message is added to the conversation.
The function to call when a message is added to the conversation.
A function that removes the listener from the list of listeners.
Adds a listener function that is called only once whenever a message is removed to the conversation.
The function to call when a message is removed to the conversation.
A function that removes the listener from the list of listeners.
Removes a message from the conversation's history.
Either the ID of the message to remove, or the message object itself (where the ID will be extracted from).
Internal
Serializes the ConversationHistory
to JSON.
A JSON representation of the ConversationHistory
instance.
This method is used internally by the library and is not meant to be used by consumers of the library.
Optional
messages?: ({ role: "function" | "user" | "assistant" | "system"; content: string | null; id?: string | undefined; name?: string | undefined; function_call?: { name: string; arguments: Record<string, any>; } | undefined; model?: string | undefined; flags?: string[] | ... 1 more ... | undefined; })[]Generated using TypeDoc
The request options for a conversation.
This class is used internally by the library and is not meant to be instantiated by consumers of the library.