Overview
Pinecone supports vectors with sparse and dense values, which allows you to perform hybrid search, or semantic and keyword search over your data in one query and combine the results for more relevant results. This topic describes the sparse-dense vector format in Pinecone. To see sparse-dense embeddings in action, see the Ecommerce hybrid search example.This feature is in public preview. Test thoroughly before using it in production.
Sparse-dense vector format
Pinecone represents sparse values as a dictionary of two arrays:indices
and values
. The elements of indices
have type uint32
; the elements of values
have type float32
.
Example
The following example defines two records with sparse and dense values.
Python
s1
pod or 900k per p1
pod.
Upserting records with sparse-dense values
You can upsert these values inside a vector parameter to upsert a sparse-dense record. Examples The following example upserts two vectors with sparse and dense values.Python
p1
and s1
indexes.
Querying records with sparse-dense values
The following example queries an index using a sparse-dense vector.Python