Build and query a vector store with Vicinity
Vicinity.from_vectors_and_items
method. This method allows you to create a vector store from a set of vectors and their corresponding items.
For this example, we will use some dummy data, but you can replace it with your own vectors and items.
Parameters
backend_type
: This specifies the type of backend to use. You can choose from various backends like Backend.BASIC
(default), Backend.FAISS
, etc. Each backend has its own strengths and weaknesses.
View the full list of backends in the supported backends documentation.metric
: This specifies the distance metric to use for querying. You can choose from various metrics like Metric.COSINE
(default), Metric.EUCLIDEAN
, etc.
Which metrics are supported depends on the backend you choose.query
and query_threshold
methods. This allows you to find the nearest neighbors of a given query vector or a list of query vectors.
Both methods support both single and batch queries.
Parameters
Parameters
save
and load
methods. This allows you to persist your vector store to disk and load it later.
push_to_hub
and from_pretrained
methods. This allows you to easily share your vector store with others.
push_to_hub parameters
Dataset.push_to_hub()
.load_from_hub parameters
evaluate
method. This method computes the recall and queries per second of the vector store based on a set of queries and their expected results.