Class ConversationSummaryMemory

Class that provides a concrete implementation of the conversation memory. It includes methods for loading memory variables, saving context, and clearing the memory.

Hierarchy

Constructors

Properties

aiPrefix: string = "AI"
buffer: string = ""
humanPrefix: string = "Human"
memoryKey: string = "history"
prompt: BasePromptTemplate<any, BasePromptValue, any> = SUMMARY_PROMPT
returnMessages: boolean = false
summaryChatMessageClass: (new (content) => BaseMessage) = SystemMessage

Type declaration

inputKey?: string
outputKey?: string

Accessors

  • get memoryKeys(): string[]
  • Returns string[]

Methods

  • Clears the conversation memory.

    Returns Promise<void>

    A promise that resolves when the memory has been cleared.

  • Predicts a new summary for the conversation given the existing messages and summary.

    Parameters

    • messages: BaseMessage[]

      Existing messages in the conversation.

    • existingSummary: string

      Current summary of the conversation.

    Returns Promise<string>

    A promise that resolves to a new summary string.

  • Saves the context of the conversation memory.

    Parameters

    • inputValues: InputValues

      Input values for the conversation.

    • outputValues: OutputValues

      Output values from the conversation.

    Returns Promise<void>

    A promise that resolves when the context has been saved.

Generated using TypeDoc