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

    Chat LangChain

    What can I help with?

    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 v1.8

    upsert

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

    Parameters

    NameTypeDescription
    items*Sequence[Document]
    **kwargsAny
    Default:{}

    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.

    Sequence of documents to add to the VectorStore.

    Additional keyword arguments.