Class: ChatHistory
A ChatHistory is used to keep the state of back and forth chat messages
Hierarchy
-
ChatHistory
Constructors
constructor
• new ChatHistory(): ChatHistory
Returns
Accessors
messages
• get
messages(): ChatMessage
[]
Returns
Defined in
packages/core/src/ChatHistory.ts:12
Methods
addMessage
▸ addMessage(message
): void
Adds a message to the chat history.
Parameters
Name | Type |
---|---|
message | ChatMessage |
Returns
void
Defined in
packages/core/src/ChatHistory.ts:17
newMessages
▸ newMessages(): ChatMessage
[]
Returns the new messages since the last call to this function (or since calling the constructor)
Returns
Defined in
packages/core/src/ChatHistory.ts:34
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
[]>
Defined in
packages/core/src/ChatHistory.ts:22