Dot product measures both alignment and magnitude. For pre-normalized embeddings, it produces the same results as cosine similarity with better computational performance. Check your embedding model’s documentation to confirm whether its output vectors are normalized before choosing this metric.
Before you begin, make sure you have a running VectorAI DB instance.
The following example creates a collection named normalized_embeddings configured to use dot product as its distance metric.
from actian_vectorai import VectorAIClient, VectorParams, Distance
# Connect to VectorAI DB server
with VectorAIClient("localhost:50051") as client:
# Create collection with dot product
client.collections.create(
"normalized_embeddings", # Collection name
vectors_config=VectorParams(size=128, distance=Distance.Dot) # Dot product metric
)
To confirm the collection was created successfully, call client.collections.get_info("normalized_embeddings") and check that the status field returns Ready.