Class for storing and retrieving chat message history from a Cloudflare D1 database. Extends the BaseListChatMessageHistory class.
class CloudflareD1MessageHistoryconst 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,
});A path to the module that contains the class, eg. ["langchain", "llms"] Usually should be the same as the entrypoint the class is exported from.