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:
The contents field accepts strings or bytes. All contents are encoded to bytes and encrypted before storage, and will be returned as bytes when retrieved with get().
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 is generated in-process from contents using the index’s built-in model — no sentence-transformers or torch install required. contents must be a str 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.
  • Throws if contents need embedding and the index’s built-in model cannot be downloaded or loaded (offline cache miss, network failure). Often transient.
  • Throws if the arguments do not match the expected types.

Example Usage

Index key

index_key is required on every call. Pass the same 32-byte index KEK you used with create_index() / load_index(). For an RBAC user, pass the user’s KEK as index_key= together with their user_id=:

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 a list of string IDs (or a NumPy array) and a NumPy array of vectors:
  • A list of strings or 1D array of identifiers for the unique IDs.
  • A 2D array of float32 values for the vector embeddings.
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.
  • Throws if the arguments do not match the expected types.

Example Usage