langchain.js
    Preparing search index...

    Class BaseConversationSummaryMemoryAbstract

    Abstract class that provides a structure for storing and managing the memory of a conversation. It includes methods for predicting a new summary for the conversation given the existing messages and summary.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    aiPrefix: string = "AI"
    chatHistory: BaseChatMessageHistory
    humanPrefix: string = "Human"
    inputKey?: string
    llm: BaseLanguageModelInterface
    memoryKey: string = "history"
    outputKey?: string
    prompt: BasePromptTemplate = SUMMARY_PROMPT
    returnMessages: boolean = false
    summaryChatMessageClass: new (content: string) => BaseMessage = SystemMessage

    Methods

    • Method to clear the chat history.

      Returns Promise<void>

      Promise that resolves when the chat history 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.

    • Method to add user and AI messages to the chat history in sequence.

      Parameters

      • inputValues: InputValues

        The input values from the user.

      • outputValues: OutputValues

        The output values from the AI.

      Returns Promise<void>

      Promise that resolves when the context has been saved.