Skip to main content
Adds new vectors to the index or updates existing ones. The Python SDK exposes a single positional API with two calling shapes:
For batches large enough that JSON encoding becomes a bottleneck, call upsert_binary directly — it sends vectors as base64-encoded binary and also accepts parallel metadata / contents lists. Shape 2 above is a thin wrapper that already forwards to upsert_binary under the hood, but only with ids + vectors (no metadata/contents).

Parameters

Shape 1: List of item dicts

Where each dictionary can contain:
The contents field accepts both strings and bytes. Bytes are automatically base64-encoded before encryption; strings are passed as-is. Contents are returned in their original format (string or bytes) when retrieved with get().

Shape 2: Parallel arrays

The two-arg form of upsert() does not accept metadata or contents keyword arguments. To attach metadata or contents alongside parallel arrays, call upsert_binary(ids, vectors, metadata=..., contents=...) directly.

Returns

None

Example Usage

Dictionary format

Parallel arrays (binary fast path)

Parallel arrays with metadata / contents

When you need metadata or contents alongside parallel arrays, call upsert_binary directly: