Class: SummaryChatHistory
A ChatHistory is used to keep the state of back and forth chat messages
Hierarchy
-
↳
SummaryChatHistory
Constructors
constructor
• new SummaryChatHistory(init?
): SummaryChatHistory
Parameters
Name | Type |
---|---|
init? | Partial <SummaryChatHistory > |
Returns
Overrides
Defined in
packages/core/src/ChatHistory.ts:71
Properties
llm
• llm: LLM
Defined in
packages/core/src/ChatHistory.ts:68
messages
• messages: ChatMessage
[]
Overrides
Defined in
packages/core/src/ChatHistory.ts:66
messagesBefore
• Private
messagesBefore: number
Defined in
packages/core/src/ChatHistory.ts:69
summaryPrompt
• summaryPrompt: (__namedParameters
: { context
: undefined
| string
= "" }) => string
Type declaration
▸ («destructured»
): string
Parameters
Name | Type | Default value |
---|---|---|
«destructured» | Object | undefined |
› context | undefined | string | "" |
Returns
string
Defined in
packages/core/src/ChatHistory.ts:67
tokensToSummarize
• tokensToSummarize: number
Defined in
packages/core/src/ChatHistory.ts:65
Accessors
nonSystemMessages
• get
nonSystemMessages(): ChatMessage
[]
Returns
Defined in
packages/core/src/ChatHistory.ts:139
systemMessages
• get
systemMessages(): ChatMessage
[]
Returns
Defined in
packages/core/src/ChatHistory.ts:134
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:113
calcConversationMessages
▸ calcConversationMessages(transformSummary?
): ChatMessage
[]
Calculates the messages that describe the conversation so far. If there's no memory, all non-system messages are used. If there's a memory, uses all messages after the last summary message.
Parameters
Name | Type |
---|---|
transformSummary? | boolean |
Returns
Defined in
packages/core/src/ChatHistory.ts:149
calcCurrentRequestMessages
▸ calcCurrentRequestMessages(transientMessages?
): ChatMessage
[]
Parameters
Name | Type |
---|---|
transientMessages? | ChatMessage [] |
Returns
Defined in
packages/core/src/ChatHistory.ts:167
getLastSummary
▸ getLastSummary(): null
| ChatMessage