Class: SummaryChatHistory
A ChatHistory is used to keep the state of back and forth chat messages
Extends
Constructors
new SummaryChatHistory()
new SummaryChatHistory(
init
?):SummaryChatHistory
Parameters
• init?: Partial
<SummaryChatHistory
>
Returns
Overrides
Defined in
packages/llamaindex/src/ChatHistory.ts:82
Properties
llm
llm:
LLM
<object
,object
>
Defined in
packages/llamaindex/src/ChatHistory.ts:79
messages
messages:
ChatMessage
[]
Overrides
Defined in
packages/llamaindex/src/ChatHistory.ts:77
summaryPrompt
summaryPrompt:
SummaryPrompt
Defined in
packages/llamaindex/src/ChatHistory.ts:78
tokenizer
tokenizer:
Tokenizer
Tokenizer function that converts text to tokens, this is used to calculate the number of tokens in a message.
Defined in
packages/llamaindex/src/ChatHistory.ts:75
tokensToSummarize
tokensToSummarize:
number
Defined in
packages/llamaindex/src/ChatHistory.ts:76
Methods
addMessage()
addMessage(
message
):void
Adds a message to the chat history.
Parameters
• message: ChatMessage
Returns
void
Overrides
Defined in
packages/llamaindex/src/ChatHistory.ts:131
getLastSummary()
getLastSummary():
null
|ChatMessage
Returns
null
| ChatMessage
Defined in
packages/llamaindex/src/ChatHistory.ts:147
newMessages()
newMessages():
ChatMessage
[]
Returns the new messages since the last call to this function (or since calling the constructor)
Returns
Overrides
Defined in
packages/llamaindex/src/ChatHistory.ts:229
requestMessages()
requestMessages(
transientMessages
?):Promise
<ChatMessage
[]>
Returns the messages that should be used as input to the LLM.
Parameters
• transientMessages?: ChatMessage
[]
Returns
Promise
<ChatMessage
[]>
Overrides
Defined in
packages/llamaindex/src/ChatHistory.ts:195
reset()
reset():
void
Resets the chat history so that it's empty.
Returns
void