Skip to content

Embedding Indices

Create an embedding index, query it with similarity search and keep it current as data changes. Covers several indexes on one column, custom embedding UDFs and precomputed embeddings.

Tutorials · Notebook · Updated

Colab runs it in your browser. If it calls a model provider, it asks for that provider's API key in a cell.

What it covers

  • Creating an index
  • Using the index in queries
  • Index updates
  • Similarity search on different types
  • Creating multiple indexes on a single column
  • Using a UDF for a custom embedding
  • Indexing precomputed embeddings (Array columns)
  • Deleting an index

What it uses

Install
terminal
pip install pixeltable transformers sentence-transformers tensorflow tensorflow-hub tensorflow-text 'setuptools<82'
Pixeltable calls
pxt.create_table()@pxt.udfinsert()add_embedding_index()similarity()

A look at the code

embedding-indexes.ipynb
import PIL.Image
from pixeltable.functions.huggingface import clip
# create embedding index on the 'img' column
imgs.add_embedding_index(
'img', embedding=clip.using(model_id='openai/clip-vit-base-patch32')
)

One cell of the notebook, copied as it is. Open it in Colab for the rest.

Browse all 103
  • External Files

    In Pixeltable, all media data (videos, images, audio) resides in external files, and Pixeltable stores references to those.

    Updated Open in Colab
  • 10-Minute Tour

    Welcome to Pixeltable! In this tutorial, we'll survey how to create tables, populate them with data, and enhance them with built-in and user-defined transformations and AI operations.

    Updated Open in Colab
  • Computed Columns

    This guide introduces one of Pixeltable's most essential and powerful concepts: computed columns.

    Updated Open in Colab