Skip to main content
query_binary() sends query vectors as base64-encoded little-endian float32 instead of JSON arrays, which is faster for large batches. It accepts the same search and hybrid parameters as query(), except query_contents.

Parameters

Returns

  • 1-D query_vectors: List[Dict], one dict per neighbor.
  • 2-D query_vectors with two or more rows: List[List[Dict]], one inner list per query vector. A 2-D array with one row returns a flat List[Dict].
Each dict has id, plus distance (vector query) or score (hybrid query), and metadata when requested. As with query(), vector and contents are not returned.

Exceptions

  • Also a TypeError. query_vectors is not a NumPy array.
  • query_vectors is not 1-D or 2-D.
  • The service rejects the query (HTTP 400/422), for example a wrong vector dimension.
The index_key or api_key is invalid (HTTP 401).
The service returns 5xx or can’t be reached.
See Errors for the full hierarchy.

Example Usage

Single query

Batch query

query() already uses this binary path when query_vectors is a NumPy array. Call query_binary() directly to make the choice explicit.