Class: ChatHistory<AdditionalMessageOptions>
A ChatHistory is used to keep the state of back and forth chat messages
Type parameters
Name | Type |
---|---|
AdditionalMessageOptions | extends object = object |
Hierarchy
-
ChatHistory
Constructors
constructor
• new ChatHistory<AdditionalMessageOptions
>(): ChatHistory
<AdditionalMessageOptions
>
Type parameters
Name | Type |
---|---|
AdditionalMessageOptions | extends object = object |
Returns
ChatHistory
<AdditionalMessageOptions
>
Accessors
messages
• get
messages(): ChatMessage
<AdditionalMessageOptions
>[]
Returns
ChatMessage
<AdditionalMessageOptions
>[]
Defined in
packages/core/src/ChatHistory.ts:14
Methods
addMessage
▸ addMessage(message
): void
Adds a message to the chat history.
Parameters
Name | Type |
---|---|
message | ChatMessage <AdditionalMessageOptions > |
Returns
void
Defined in
packages/core/src/ChatHistory.ts:19
newMessages
▸ newMessages(): ChatMessage
<AdditionalMessageOptions
>[]
Returns the new messages since the last call to this function (or since calling the constructor)
Returns
ChatMessage
<AdditionalMessageOptions
>[]
Defined in
packages/core/src/ChatHistory.ts:36
requestMessages
▸ requestMessages(transientMessages?
): Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
Returns the messages that should be used as input to the LLM.
Parameters
Name | Type |
---|---|
transientMessages? | ChatMessage <AdditionalMessageOptions >[] |
Returns
Promise
<ChatMessage
<AdditionalMessageOptions
>[]>
Defined in
packages/core/src/ChatHistory.ts:24
reset
▸ reset(): void
Resets the chat history so that it's empty.
Returns
void