upsert() — langchain Function Reference
Architecture documentation for the upsert() function in base.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 53eef716_972f_c061_0097_b257672abb6c["upsert()"] dee85009_1bbd_59e1_bb92_3ca6bbef9a2b["DocumentIndex"] 53eef716_972f_c061_0097_b257672abb6c -->|defined in| dee85009_1bbd_59e1_bb92_3ca6bbef9a2b style 53eef716_972f_c061_0097_b257672abb6c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/indexing/base.py lines 514–533
def upsert(self, items: Sequence[Document], /, **kwargs: Any) -> UpsertResponse:
"""Upsert documents into the index.
The upsert functionality should utilize the ID field of the content object
if it is provided. If the ID is not provided, the upsert method is free
to generate an ID for the content.
When an ID is specified and the content already exists in the `VectorStore`,
the upsert method should update the content with the new data. If the content
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.
"""
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does upsert() do?
upsert() is a function in the langchain codebase, defined in libs/core/langchain_core/indexing/base.py.
Where is upsert() defined?
upsert() is defined in libs/core/langchain_core/indexing/base.py at line 514.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free