Skip to content

TASTI Usage

ttt-77 edited this page Oct 16, 2023 · 15 revisions

To use TASTI to generate proxy score, you need to have a vector database which store embeddings for each blob and a blob mapping table, which map blob keys to vector id.

Initialize TASTI Index

from aidb.vector_database.tasti import Tasti 
tasti_index = Tasti(index_name, blob_ids, self.user_database, nb_buckets, percent_fpf, seed)
*  param index_name: vector database index name
*  param blob_ids: blob index in blob table, it should be unique for each data record
*  param vector_database: initialized vector database, currently support FAISS, Chroma or Weaviate
*  param nb_buckets: number of buckets for FPF, it should be same as the number of buckets for oracle
*  param percent_fpf: percent of randomly selected buckets in FPF
*  param seed: random seed
*  param reps: representative ids

Create an engine

from aidb.engine import Engine
engine = Engine(db_url, debug=False, blob_mapping_table_name=blob_mapping_table_name, tasti_index=tasti_index)
*  param db_url: the url of normal database
*  param blob_mapping_table_name: the blob mapping table
*  param tasti_index: initialized tasti index