Method that loads the chat messages from the memory and returns them as a string or as a list of messages, depending on the returnMessages property.
Optional
_: anyInputValues object, not used in this method.
Promise that resolves with MemoryVariables object containing the loaded chat messages.
Predicts a new summary for the conversation given the existing messages and summary.
Existing messages in the conversation.
Current summary of the conversation.
A promise that resolves to a new summary string.
Method that prunes the memory if the total number of tokens in the buffer exceeds the maxTokenLimit. It removes messages from the beginning of the buffer until the total number of tokens is within the limit.
Promise that resolves when the memory is pruned.
Method that saves the context of the conversation, including the input and output values, and prunes the memory if it exceeds the maximum token limit.
InputValues object containing the input values of the conversation.
OutputValues object containing the output values of the conversation.
Promise that resolves when the context is saved and the memory is pruned.
Generated using TypeDoc
Class that extends BaseConversationSummaryMemory and implements ConversationSummaryBufferMemoryInput. It manages the conversation history in a LangChain application by maintaining a buffer of chat messages and providing methods to load, save, prune, and clear the memory.
Example