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-coreindexingbaseRecordManager
    Class●Since v0.1

    RecordManager

    Abstract base class representing the interface for a record manager.

    The record manager abstraction is used by the langchain indexing API.

    The record manager keeps track of which documents have been written into a VectorStore and when they were written.

    The indexing API computes hashes for each document and stores the hash together with the write time and the source id in the record manager.

    On subsequent indexing runs, the indexing API can check the record manager to determine which documents have already been indexed and which have not.

    This allows the indexing API to avoid re-indexing documents that have already been indexed, and to only index new documents.

    The main benefit of this abstraction is that it works across many vectorstores. To be supported, a VectorStore needs to only support the ability to add and delete documents by ID. Using the record manager, the indexing API will be able to delete outdated documents and avoid redundant indexing of documents that have already been indexed.

    The main constraints of this abstraction are:

    1. It relies on the time-stamps to determine which documents have been indexed and which have not. This means that the time-stamps must be monotonically increasing. The timestamp should be the timestamp as measured by the server to minimize issues.
    2. The record manager is currently implemented separately from the vectorstore, which means that the overall system becomes distributed and may create issues with consistency. For example, writing to record manager succeeds, but corresponding writing to VectorStore fails.
    Copy
    RecordManager(
        self,
        namespace: str,
    )

    Bases

    ABC

    Parameters

    NameTypeDescription
    namespace*str

    The namespace for the record manager.

    Constructors

    constructor
    __init__
    NameType
    namespacestr

    Attributes

    attribute
    namespace: namespace

    Methods

    method
    create_schema

    Create the database schema for the record manager.

    method
    acreate_schema

    Asynchronously create the database schema for the record manager.

    method
    get_time

    Get the current server time as a high resolution timestamp!

    It's important to get this from the server to ensure a monotonic clock, otherwise there may be data loss when cleaning up old documents!

    method
    aget_time

    Asynchronously get the current server time as a high resolution timestamp.

    It's important to get this from the server to ensure a monotonic clock, otherwise there may be data loss when cleaning up old documents!

    method
    update

    Upsert records into the database.

    method
    aupdate

    Asynchronously upsert records into the database.

    method
    exists

    Check if the provided keys exist in the database.

    method
    aexists

    Asynchronously check if the provided keys exist in the database.

    method
    list_keys

    List records in the database based on the provided filters.

    method
    alist_keys

    Asynchronously list records in the database based on the provided filters.

    method
    delete_keys

    Delete specified records from the database.

    method
    adelete_keys

    Asynchronously delete specified records from the database.

    View source on GitHub