Skip to main content
Adds or updates vector embeddings in the index. Accepts a list of dictionaries, where each dictionary represents a vector with its ID.

Parameters

Where each item dictionary has the following fields:
If embedding auto-generation is enabled (by setting the embedding_model parameter in create_index()), then the vector parameter is optional. If vector provided, then it will be used (its dimensionality must match that of the embedding_model). If vector is not provided, a vector embedding will be auto-generated from contents using sentence-transformers. contents must be text in this case.
For more info on metadata, see Metadata Filtering.

Exceptions

  • Throws if the vector dimensions are incompatible with the index configuration.
  • Throws if the index was not created or loaded yet.
  • Throws if the vectors could not be upserted.

Example Usage

You can pass the id and vector fields as tuples, if you wish to skip the dictionary. On big datasets, this can make a signficant difference in memory usage.

Upsert Secondary Overload: NumPy Array Format

This format is optimal for large batches due to its memory efficiency and compatibility with batch processing optimizations. It is primarily intended for benchmarking purposes (hence the use of int for IDs).
Accepts two NumPy arrays:
  • A 2D array of floats for the vector embeddings.
  • A 1D array of integers for the unique IDs.
This structure is suited for efficient handling of large batches, with type safety for IDs and embeddings.

Parameters

Exceptions

  • Throws if the vector dimensions are incompatible with the index configuration.
  • Throws if the index was not created or loaded yet.
  • Throws if the vectors could not be upserted.

Example Usage