Quickstart - Sync Client
Generic usage of sync Python client.
After installing and importing client in the code. You can create sync client with:
For different host and port:
Creating Collection
Since we will insert some vectors into our storage. We will build VectorParams
which are indicating our
vector configuration for our collection.
For possible index types please head to Index Types.
Please try out ANODE
index, our new invention.
In the above example, size
indicates the vector size, and index_type
is
one of the possible indexes that we have documented at Index Types.
Let’s start with HNSW
for now.
As a next step let’s create a collection. Collections are like tables for us. They allow us to organize vectors and their indexes into same location for data locality. You can learn more with storage system doc.
List Collections
Now we can take a look to existing collections in this list:
Filter indicates what to filter from the collection. This will give us a list of collections.
Fetch example data
Now it is time to download SIFT1M
dataset to our system as an example:
After all now we have xq
and xb
both query and base vectors.
Now let’s prepare our vector data for insertion
These will generate embeds for insertion. More information about how embeds are organized can be found in Embeds Design.
Inserting Vectors
Now we are good to go with insertion. Let’s insert these vectors:
First parameter is collection name and the second parameter is embeds we have just prepared for insertion now. This call will synchronously insert embeds one by one into vector store and won’t wait for index generation and training execution.
Searching Vectors
Now let’s get into the search, after a short period, indexes should be started to be populated. Let’s use our search vector to get some similarity matches.
You can search multiple vectors at the same time with client.search_multi
method too.
In the above limit
will give most similar top-K (in our case top 100) vectors for us.
Let’s take a look at the result:
It will give you probably this output:
At this point you have all the tooling to integrate Pulsejet into your projects.
Bigger datasets and performance
If you are thinking about loading millions or billions of vectors to Pulsejet, then it is better for you to use AsyncPulsejetClient
. You can head to Quickstart - Async Client to reduce your time to insert vectors.
Was this page helpful?