langchain.js
    Preparing search index...

    Class for managing chat message memory using the Motorhead service. It extends BaseChatMemory and includes methods for initializing the memory, loading memory variables, and saving the context.

    Hierarchy

    • BaseChatMemory
      • MotorheadMemory
    Index

    Constructors

    • Parameters

      • fields: any

      Returns MotorheadMemory

    Properties

    apiKey?: string
    caller: AsyncCaller
    clientId?: string
    context?: string
    memoryKey: string = "history"
    sessionId: string
    timeout: number = 3000
    url: string = MANAGED_URL

    Accessors

    • get memoryKeys(): string[]

      Returns string[]

    Methods

    • Returns HeadersInit

    • Method that initializes the memory by fetching the session memory from the Motorhead service. It adds the messages to the chat history and sets the context if it is not 'NONE'.

      Returns Promise<void>

    • Method that loads the memory variables. It gets the chat messages and returns them as a string or an array based on the returnMessages flag.

      Parameters

      • _values: InputValues

        The input values.

      Returns Promise<MemoryVariables>

      A promise that resolves with the memory variables.

    • Method that saves the context to the Motorhead service and the base chat memory. It sends a POST request to the Motorhead service with the input and output messages, and calls the saveContext method of the base chat memory.

      Parameters

      • inputValues: InputValues

        The input values.

      • outputValues: OutputValues

        The output values.

      Returns Promise<void>

      A promise that resolves when the context is saved.