Skip to main content

IPFS Datastore Chat Memory

For a storage backend you can use the IPFS Datastore Chat Memory to wrap an IPFS Datastore allowing you to use any IPFS compatible datastore.

Setup​

First, install the integration dependencies:

npm install cborg interface-datastore it-all @langchain/community

Now you can install and use an IPFS Datastore of your choice. Here are some options:

Usage​

// Replace FsDatastore with the IPFS Datastore of your choice.
import { FsDatastore } from "datastore-fs";
import { IPFSDatastoreChatMessageHistory } from "@langchain/community/stores/message/ipfs_datastore";

const datastore = new FsDatastore("path/to/store");
const sessionId = "my-session";

const history = new IPFSDatastoreChatMessageHistory({ datastore, sessionId });

Help us out by providing feedback on this documentation page: