Technology•March 11, 2024
How Artera Built its Art Discovery Platform with DataStax Astra DB, Vector Search, and Astra Streaming
CREATE TABLE artera.clip_vector_by_artwork ( artwork_id uuid PRIMARY KEY, clip_vector vector<float, 512>); CREATE CUSTOM INDEX ann_index_clip ON artera.clip_vector_by_artwork (clip_vector) USING 'org.apache.cassandra.index.sai.StorageAttachedIndex' WITH OPTIONS = {'similarity_function': 'DOT_PRODUCT’};
session.execute("SELECT artwork_id FROM clip_vector_by_artwork ORDER BY clip_vector ANN OF %s LIMIT %s", (vec, 20), timeout=30)
query = SimpleStatement( f""" SELECT artwork_id FROM clip_vector_by_artwork ORDER BY clip_vector ANN OF {embedding} LIMIT 20""" )