Skip to main content
upsert_binary() sends vectors as base64-encoded little-endian float32 instead of JSON arrays, which is faster for large batches. Unlike the two-argument form of upsert(), it also takes parallel metadata and contents.

Parameters

Don’t upsert vectors containing NaN or infinite values. The service stores them, and later get or query calls on that index that return vectors or distances fail with a 5xx error. The SDK doesn’t check for them.

Returns

None

Exceptions

  • Also a TypeError. vectors is not a NumPy array.
  • vectors is not 2-D, or ids, metadata, or contents differ in length from vectors. Raised before any request is sent.
  • The service rejects the batch (HTTP 400), for example a vector with the wrong dimension.
The service returns 5xx or can’t be reached.
See Errors for the full hierarchy.

Example Usage

For small batches, the item-dict form of upsert() is easier to read. Use upsert_binary() when the vectors are already a NumPy array and JSON encoding time matters.