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