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:42
Properties
messages
• messages: ChatMessage
[]
Overrides
Defined in
packages/core/src/ChatHistory.ts:39
messagesBefore
• Private
messagesBefore: number
Defined in
packages/core/src/ChatHistory.ts:40
Methods
addMessage
▸ addMessage(message
): void
Adds a message to the chat history.
Parameters
Name | Type |
---|---|
message | ChatMessage |
Returns
void
Overrides
Defined in
packages/core/src/ChatHistory.ts:48
newMessages
▸ newMessages(): ChatMessage
[]
Returns the new messages since the last call to this function (or since calling the constructor)
Returns
Overrides
Defined in
packages/core/src/ChatHistory.ts:60
requestMessages
▸ requestMessages(transientMessages?
): Promise
<ChatMessage
[]>
Returns the messages that should be used as input to the LLM.
Parameters
Name | Type |
---|---|
transientMessages? | ChatMessage [] |
Returns
Promise
<ChatMessage
[]>
Overrides
Defined in
packages/core/src/ChatHistory.ts:52
reset
▸ reset(): void
Resets the chat history so that it's empty.