langchain.js
    Preparing search index...

    Class for managing chat message history using Google's Firestore as a storage backend. Extends the BaseListChatMessageHistory class.

    const chatHistory = new FirestoreChatMessageHistory({
    collectionName: "langchain",
    sessionId: "lc-example",
    userId: "a@example.com",
    config: { projectId: "your-project-id" },
    });

    const chain = new ConversationChain({
    llm: new ChatOpenAI({ model: "gpt-4o-mini" }),
    memory: new BufferMemory({ chatHistory }),
    });

    const response = await chain.invoke({
    input: "What did I just say my name was?",
    });
    console.log({ response });

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    lc_namespace: string[] = ...

    Methods

    • Method to add a new message to the Firestore collection. The message is passed as a BaseMessage object.

      Parameters

      • message: BaseMessage

        The message to be added as a BaseMessage object.

      Returns Promise<void>

    • Method to delete all messages from the Firestore collection associated with the current session.

      Returns Promise<void>

    • Method to retrieve all messages from the Firestore collection associated with the current session. Returns an array of BaseMessage objects.

      Returns Promise<BaseMessage[]>

      Array of stored messages