LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-corestores
    Module●Since v0.1

    stores

    Store implements the key-value stores and storage helpers.

    Module provides implementations of various key-value stores that conform to a simple key-value interface.

    The primary goal of these storages is to support implementation of caching.

    Attributes

    attribute
    K
    attribute
    V
    attribute
    ByteStore: BaseStore[str, bytes]

    Functions

    function
    run_in_executor

    Run a function in an executor.

    Classes

    class
    LangChainException

    General LangChain exception.

    class
    BaseStore

    Abstract interface for a key-value store.

    This is an interface that's meant to abstract away the details of different key-value stores. It provides a simple interface for getting, setting, and deleting key-value pairs.

    The basic methods are mget, mset, and mdelete for getting, setting, and deleting multiple key-value pairs at once. The yield_keys method is used to iterate over keys that match a given prefix.

    The async versions of these methods are also provided, which are meant to be used in async contexts. The async methods are named with an a prefix, e.g., amget, amset, amdelete, and ayield_keys.

    By default, the amget, amset, amdelete, and ayield_keys methods are implemented using the synchronous methods. If the store can natively support async operations, it should override these methods.

    By design the methods only accept batches of keys and values, and not single keys or values. This is done to force user code to work with batches which will usually be more efficient by saving on round trips to the store.

    class
    InMemoryBaseStore

    In-memory implementation of the BaseStore using a dictionary.

    class
    InMemoryStore

    In-memory store for any type of data.

    class
    InMemoryByteStore

    In-memory store for bytes.

    class
    InvalidKeyException

    Raised when a key is invalid; e.g., uses incorrect characters.

    View source on GitHub