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
Class | Package | Local | PY support | Downloads | Version |
---|---|---|---|---|---|
InMemoryStore | @langchain/core | ✅ | ✅ |
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 themset
method:
mdelete
method:
Yielding values
If you want to get back all the keys you can call theyieldKeys
method. Optionally, you can pass a key prefix to only get back keys which match that prefix.