⚠️ Deprecated ⚠️

Install and import from "@langchain/cloudflare" instead.

This feature is deprecated and will be removed in the future.

It is not recommended for use.

Class for storing and retrieving chat message history from a Cloudflare D1 database. Extends the BaseListChatMessageHistory class.

Example

const memory = new BufferMemory({
returnMessages: true,
chatHistory: new CloudflareD1MessageHistory({
tableName: "stored_message",
sessionId: "example",
database: env.DB,
}),
});

const chainInput = { input };

const res = await memory.chatHistory.invoke(chainInput);
await memory.saveContext(chainInput, {
output: res,
});

Hierarchy

Constructors

Properties

database: D1Database

Methods

Generated using TypeDoc