Qdrant

FirstBatch integrates Qdrant through the Qdrant Class.

Example run:

embedding_size = int(os.environ["EMBEDDING_SIZE"])
cl = QdrantClient(os.environ["QDRANT_URL"])
client = Qdrant(client=cl, collection_name="default", embedding_size=embedding_size)
cfg = Config(batch_size=20, quantizer_train_size=100, quantizer_type="scalar",
    enable_history=True, verbose=True)
personalized = FirstBatch(api_key=os.environ["FIRSTBATCH_API_KEY"], config=cfg)
personalized.add_vdb(vdb_name, cl)

Distance metric can explicitly be provided. If not, default value is COSINE_SIM

class DistanceMetric(Enum):
    COSINE_SIM = "cosine_sim"
    EUCLIDEAN_DIST = "euclidean_dist"
    DOT_PRODUCT = "dot_product"
from firstbatch import DistanceMetric

Qdrant(client=cl, collection_name="default", embedding_size=embedding_size, distance_metric=DistanceMetric.EUCLIDEAN_DIST)

Last updated