Skip to main content
Adds or updates vector embeddings in the index. If an item already exists at id, then it will be overwritten.

Parameters

For more info on metadata, see Metadata Filtering.
contents and json_metadata_array are required positional arguments. Pass an empty initializer {} when an item has no contents or metadata. When provided, their length must match ids.

Exceptions

  • Throws if vector dimensions are incompatible with the index configuration.
  • Throws if index was not created or loaded yet.
  • Throws if there is a mismatch between the number of vectors, ids, contents or json_metadata_array.
  • Throws if the vectors could not be upserted.
  • Throws if the supplied key context lacks write permission.

Example Usage

index_key is the 32-byte std::array<uint8_t, 32> index KEK. It converts implicitly to a KeyContext. In a stateless service that reloads the index per request, pass the key on every operation.