Upsert takes either VectorItems (sent as JSON) or BinaryUpsertParams (sent as binary); UpsertVectors is a shortcut for the binary form.
Parameters
VectorItems
VectorItems is a []VectorItem:
BinaryUpsertParams
Vectors are sent as base64-encoded little-endianfloat32, which is faster for large batches.
UpsertVectors(ctx, ids, vectors, metadata) is the same as Upsert with a BinaryUpsertParams that has no contents.
Returns
error only; nil on success.
Errors
*ValidationError
*ValidationError
- Wraps a sentinel. A
BinaryUpsertParamsfield is empty, slices differ in length (ErrIDsVectorsLengthMismatch,ErrMetadataLengthMismatch,ErrContentsLengthMismatch), or vectors differ in length (ErrInconsistentDimension). Returned before any request is sent.VectorItemsaren’t checked in the SDK. - The service rejects the items (HTTP
400), for example a vector with the wrong dimension.
*AuthenticationError
*AuthenticationError
The
apiKey is invalid, or a read-only user key is used (HTTP 401/403).*ServiceError / *TransportError
*ServiceError / *TransportError
The service returns
5xx or can’t be reached.Example Usage
VectorItems
BinaryUpsertParams with metadata and contents
Set contents on a VectorItem
Vector empty and the service embeds the contents.