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-coreindexingbaseDocumentIndexupsert
    Method●Since v0.2

    upsert

    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.

    Copy
    upsert(
      self,
      items: Sequence[Document],
      ,
      **kwargs: Any = {}
    ) -> UpsertResponse

    Parameters

    NameTypeDescription
    items*Sequence[Document]

    Sequence of documents to add to the VectorStore.

    **kwargsAny
    Default:{}

    Additional keyword arguments.

    View source on GitHub