Class: SimpleChatHistory
A ChatHistory is used to keep the state of back and forth chat messages
Hierarchy
-
↳
SimpleChatHistory
Constructors
constructor
• new SimpleChatHistory(init?
): SimpleChatHistory
Parameters
Name | Type |
---|---|
init? | Partial <SimpleChatHistory > |
Returns
Overrides
Defined in
packages/core/src/ChatHistory.ts:41
Properties
messages
• messages: { content
: MessageContent
; options?
: Record
<string
, unknown
> ; role
: MessageType
}[]
Overrides
Defined in
packages/core/src/ChatHistory.ts:38
messagesBefore
• Private
messagesBefore: number
Defined in
packages/core/src/ChatHistory.ts:39
Methods
addMessage
▸ addMessage(message
): void
Adds a message to the chat history.
Parameters
Name | Type |
---|---|
message | Object |
message.content | MessageContent |
message.options? | Record <string , unknown > |
message.role | MessageType |
Returns
void
Overrides
Defined in
packages/core/src/ChatHistory.ts:47
newMessages
▸ newMessages(): { content
: MessageContent
; options?
: Record
<string
, unknown
> ; role
: MessageType
}[]
Returns the new messages since the last call to this function (or since calling the constructor)
Returns
{ content
: MessageContent
; options?
: Record
<string
, unknown
> ; role
: MessageType
}[]
Overrides
Defined in
packages/core/src/ChatHistory.ts:59