langchain.js
    Preparing search index...

    Class that manages and manipulates previous chat messages. It extends from the BaseChatMemory class and implements the CombinedMemoryInput interface.

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    aiPrefix: string = "AI"
    chatHistory: BaseChatMessageHistory
    humanPrefix: string = "Human"
    inputKey?: string
    memories: BaseMemory[] = []
    memoryKey: string = "history"
    outputKey?: string
    returnMessages: boolean = false

    Accessors

    • get memoryKeys(): string[]

      Returns string[]

    Methods

    • Checks if input keys are set for all memory objects. Logs a warning if any are missing.

      Returns void

    • Checks for repeated memory variables across all memory objects. Throws an error if any are found.

      Returns void

    • Clears all memory objects.

      Returns Promise<void>

      Promise that resolves when all memory objects have been cleared.

    • Loads memory variables from all memory objects.

      Parameters

      • inputValues: InputValues

        Input values to load memory variables from.

      Returns Promise<MemoryVariables>

      Promise that resolves with an object containing the loaded memory variables.

    • Saves the context to all memory objects.

      Parameters

      • inputValues: InputValues

        Input values to save.

      • outputValues: OutputValues

        Output values to save.

      Returns Promise<void>

      Promise that resolves when the context has been saved to all memory objects.