Home / Function/ aupsert() — langchain Function Reference

aupsert() — langchain Function Reference

Architecture documentation for the aupsert() function in base.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  1473791d_22fd_79c1_eef4_a73d56521081["aupsert()"]
  dee85009_1bbd_59e1_bb92_3ca6bbef9a2b["DocumentIndex"]
  1473791d_22fd_79c1_eef4_a73d56521081 -->|defined in| dee85009_1bbd_59e1_bb92_3ca6bbef9a2b
  style 1473791d_22fd_79c1_eef4_a73d56521081 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/indexing/base.py lines 535–562

    async def aupsert(
        self, items: Sequence[Document], /, **kwargs: Any
    ) -> UpsertResponse:
        """Add or update documents in the `VectorStore`. Async version of `upsert`.

        The upsert functionality should utilize the ID field of the item
        if it is provided. If the ID is not provided, the upsert method is free
        to generate an ID for the item.

        When an ID is specified and the item already exists in the `VectorStore`,
        the upsert method should update the item with the new data. If the item
        does not exist, the upsert method should add the item to the `VectorStore`.

        Args:
            items: Sequence of documents to add to the `VectorStore`.
            **kwargs: Additional keyword arguments.

        Returns:
            A response object that contains the list of IDs that were
            successfully added or updated in the `VectorStore` and the list of IDs that
            failed to be added or updated.
        """
        return await run_in_executor(
            None,
            self.upsert,
            items,
            **kwargs,
        )

Subdomains

Frequently Asked Questions

What does aupsert() do?
aupsert() is a function in the langchain codebase, defined in libs/core/langchain_core/indexing/base.py.
Where is aupsert() defined?
aupsert() is defined in libs/core/langchain_core/indexing/base.py at line 535.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free