evadb.EvaDBCursor.create_vector_index#

EvaDBCursor.create_vector_index(index_name: str, table_name: str, expr: str, using: str) EvaDBCursor[source]#

Creates a vector index using the provided expr on the table. This feature directly works on IMAGE tables. For VIDEO tables, the feature should be extracted first and stored in an intermediate table, before creating the index.

Parameters:
  • index_name (str) – Name of the index.

  • table_name (str) – Name of the table.

  • expr (str) – Expression used to build the vector index.

  • using (str) – Method used for indexing, can be FAISS or QDRANT.

Returns:

The EvaDBCursor object.

Return type:

EvaDBCursor

Examples

Create a Vector Index using QDRANT

>>> cursor.create_vector_index(
        "faiss_index",
        table_name="meme_images",
        expr="SiftFeatureExtractor(data)",
        using="QDRANT"
    ).df()
            0
    0       Index faiss_index successfully added to the database
>>> relation = cursor.table("PDFs")
>>> relation.order("Similarity(ImageFeatureExtractor(Open('/images/my_meme')), ImageFeatureExtractor(data) ) DESC")
>>> relation.df()