Skip to main content
This will help you get started with InMemoryStore. For detailed documentation of all InMemoryStore features and configurations head to the API reference. The InMemoryStore allows for a generic type to be assigned to the values in the store. We’ll assign type BaseMessage as the type of our values, keeping with the theme of a chat history store.

Overview

Integration details

Setup

Installation

The LangChain InMemoryStore integration lives in the @langchain/core package:

Instantiation

Now we can instantiate our byte store:

Usage

You can set data under keys like this using the mset method:
And you can delete data using the mdelete method:

Yielding values

If you want to get back all the keys you can call the yieldKeys method. Optionally, you can pass a key prefix to only get back keys which match that prefix.

API reference

For detailed documentation of all InMemoryStore features and configurations, head to the API reference