MCPcopy
hub / github.com/langchain-ai/langchain / InMemoryStore

Class InMemoryStore

libs/core/langchain_core/stores.py:290–312  ·  view source on GitHub ↗

In-memory store for any type of data. Attributes: store (Dict[str, Any]): The underlying dictionary that stores the key-value pairs. Examples: .. code-block:: python from langchain.storage import InMemoryStore store = InMemoryStore()

Source from the content-addressed store, hash-verified

288
289
290class InMemoryStore(InMemoryBaseStore[Any]):
291 """In-memory store for any type of data.
292
293 Attributes:
294 store (Dict[str, Any]): The underlying dictionary that stores
295 the key-value pairs.
296
297 Examples:
298
299 .. code-block:: python
300
301 from langchain.storage import InMemoryStore
302
303 store = InMemoryStore()
304 store.mset([('key1', 'value1'), ('key2', 'value2')])
305 store.mget(['key1', 'key2'])
306 # ['value1', 'value2']
307 store.mdelete(['key1'])
308 list(store.yield_keys())
309 # ['key2']
310 list(store.yield_keys(prefix='k'))
311 # ['key2']
312 """
313
314
315class InMemoryByteStore(InMemoryBaseStore[bytes]):

Callers 15

test_mgetFunction · 0.90
test_amgetFunction · 0.90
test_msetFunction · 0.90
test_amsetFunction · 0.90
test_mdeleteFunction · 0.90
test_amdeleteFunction · 0.90
test_yield_keysFunction · 0.90
test_ayield_keysFunction · 0.90
kv_storeMethod · 0.90
kv_storeMethod · 0.90
chain.pyFile · 0.85
cache_embeddingsFunction · 0.85

Calls

no outgoing calls

Tested by 15

test_mgetFunction · 0.72
test_amgetFunction · 0.72
test_msetFunction · 0.72
test_amsetFunction · 0.72
test_mdeleteFunction · 0.72
test_amdeleteFunction · 0.72
test_yield_keysFunction · 0.72
test_ayield_keysFunction · 0.72
kv_storeMethod · 0.72
kv_storeMethod · 0.72
cache_embeddingsFunction · 0.68
cache_embeddings_batchFunction · 0.68