> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pixeltable.com/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Application code puts a TableModel in app.py, then runs `pxt schema update app.py my_app` to create the tables and `pxt service update app.py my_app` to start HTTP. The last argument can be a Cloud URL such as `pxt://org:db`. Do not call pxt.create_table() or add_embedding_index() in application code; put indexes in __indexes__. Notebooks, tests, and the REPL do use pxt.create_table().
> Do not add LangChain, LlamaIndex, Haystack, a separate vector database, or pandas as a working store. Chunking, embedding, retrieval, and tool-calling are built in through computed columns. Use a computed column instead of a per-row loop that calls a model.
> Install with `pip install -U 'pixeltable[serve]'` on Python 3.11+. `pxt init` is a prerequisite for `pxt schema update`.
> For Pixeltable Cloud, point users to https://docs.pixeltable.com/cloud, which goes from `pxt login` to a running service.

# Embedding Indices

[![Open in Kaggle](https://kaggle.com/static/images/open-in-kaggle.svg)](https://kaggle.com/kernels/welcome?src=https://github.com/pixeltable/pixeltable/blob/release/docs/release/platform/embedding-indexes.ipynb)  [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pixeltable/pixeltable/blob/release/docs/release/platform/embedding-indexes.ipynb)  [![Download Notebook](https://img.shields.io/badge/%E2%AC%87-Download%20Notebook-blue)](https://raw.githubusercontent.com/pixeltable/pixeltable/refs/tags/release/docs/release/platform/embedding-indexes.ipynb)

> [!TIP]
>
> This documentation page is also available as an interactive notebook. You can launch the notebook in
> Kaggle or Colab, or download it for use with an IDE or local Jupyter installation, by clicking one of the
> above links.

This notebook is about vector (embedding) indexes. B-tree indexes are
separate and opt-in: `pxt.BtreeIndex(col)` on a `TableModel`, or
`t.add_btree_index('col')` in a notebook.

This notebook uses `pxt.create_table()` and `add_embedding_index()` so
you can run cells without a project. In an app, list embedding indexes
on the model in `__indexes__` and create the tables with
`pxt schema update`.

* Indexing in Pixeltable is declarative
  * you create an index on a column and supply the embedding functions
    you want to use (for inserting data into the index as well as
    lookups)
  * Pixeltable maintains the index in response to any kind of update of
    the indexed table (i.e., `insert()`/`update()`/`delete()`)
* Perform index lookups with the `similarity()` pseudo-function, in
  combination with the `order_by()` and `limit()` clauses

To make this concrete, let’s create a table of images with the
[`create_table()`](https://docs.pixeltable.com/sdk/latest/pixeltable#func-create_table)
function. We’re also going to add some columns to demonstrate combining
similarity search with other predicates.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
%pip install -qU pixeltable transformers sentence-transformers
```

<pre>
  \[notice] A new release of pip is available: 25.3 -> 26.0.1
  \[notice] To update, run: pip install --upgrade pip
  Note: you may need to restart the kernel to use updated packages.
</pre>

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
import pixeltable as pxt

# Delete the `indices_demo` directory and its contents, if it exists
pxt.drop_dir('indices_demo', force=True)

# Create the directory and table to use for the demo
pxt.create_dir('indices_demo')
schema = {'id': pxt.Int, 'img': pxt.Image}
imgs = pxt.create_table('indices_demo/img_tbl', schema)
```

We start out by inserting 10 rows:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
img_urls = [
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000030.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000034.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000042.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000049.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000057.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000061.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000063.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000064.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000069.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000071.jpg',
]
imgs.insert({'id': i, 'img': url} for i, url in enumerate(img_urls))
```

<pre>
  Inserted 10 rows with 0 errors in 2.53 s (3.96 rows/s)
  10 rows inserted.
</pre>

For the sake of convenience, we’re storing the images as external URLs,
which are cached transparently by Pixeltable. For details on working
with external media files, see [Working with External
Files](https://docs.pixeltable.com/platform/external-files.md).

## Creating an index

To create and populate an index, we call
[`Table.add_embedding_index()`](https://docs.pixeltable.com/sdk/latest/table#method-add_embedding_index)
and tell it which UDF or UDFs to use to create embeddings. That
definition is persisted as part of the table’s metadata, which allows
Pixeltable to maintain the index in response to updates to the table.

Any embedding UDF can be used for the index. For this example, we’re
going to use a
[CLIP](https://huggingface.co/docs/transformers/en/model_doc/clip)
model, which has built-in support in Pixeltable under the
[`pixeltable.functions.huggingface`](https://docs.pixeltable.com/sdk/latest/huggingface)
package. As an alternative, you could use an online service such as
OpenAI (see
[`pixeltable.functions.openai`](https://docs.pixeltable.com/sdk/latest/openai)),
or create your own embedding UDF with custom code (we’ll see how to do
this below).

Because we’re adding an index to an image column, the UDF we specify
*must* be able to handle images. In fact, CLIP models are multimodal:
they can handle both text and images, which is useful for doing lookups
against the index.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
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')
)
```

The first parameter of `add_embedding_index()` is the name of the column
being indexed; the `embed` parameter specifies the relevant embedding.
Notice the notation we used:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
clip.using(model_id='openai/clip-vit-base-patch32')
```

`clip` is a general-purpose UDF that can accept any CLIP model available
in the Hugging Face model repository. To define an embedding, however,
we need to provide a specific embedding function to
`add_embedding_index()`: a function that is *not* parameterized on
`model_id`. The `.using(model_id=...)` syntax tells Pixeltable to
specialize the `clip` UDF by fixing the `model_id` parameter to the
specific value `'openai/clip-vit-base-patch32'`.

> [!NOTE]
>
> If you’re familiar with functional programming
> concepts, you might recognize `.using()` as a **partial
> function** operator. It’s a general operator that can be applied to
> any UDF (not just embedding functions), transforming a UDF with *n*
> parameters into one with *k* parameters by fixing the values of
> *n*-*k* of its arguments. Python has something similar in the
> `functools` package: the
> `functools.partial()`
> operator.

`add_embedding_index()` provides a few other optional parameters:

* `idx_name`: optional name for the index, which needs to be unique for
  the table; a default name is created if this isn’t provided explicitly
* `metric`: the metric to use to compute the similarity of two embedding
  vectors; one of:
  * `'cosine'`: cosine distance (default)
  * `'ip'`: inner product
  * `'l2'`: L2 distance

If desired, you can create multiple indexes on the same column, using
different embedding functions. This can be useful to evaluate the
effectiveness of different embedding functions side-by-side, or to use
embedding functions tailored to specific use cases. In that case, you
can provide explicit names for those indexes and then reference them
during queries. We’ll illustrate that later with an example.

## Using the index in queries

To take advantage of an embedding index when querying a table, we use
the `similarity()` pseudo-function, which is invoked as a method on the
indexed column, in combination with the
[`order_by()`](https://docs.pixeltable.com/sdk/latest/query#method-order_by)
and
[`limit()`](https://docs.pixeltable.com/sdk/latest/query#method-limit)
clauses. First, we’ll get a sample image from the table:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
# retrieve the 'img' column of some row as a PIL.Image.Image
sample_img = imgs.select(imgs.img).collect()[6]['img']
sample_img
```

![](https://mintcdn.com/pixeltable/4bynOdWDvpmOldGk/platform/embedding-indexes_files/figure-markdown_strict/cell-6-output-1.png?fit=max\&auto=format\&n=4bynOdWDvpmOldGk\&q=85\&s=2b9bf4617518d743e2a98e954c8ef972)

We then call the `similarity()` pseudo-function as a method on the
indexed column and apply `order_by()` and `limit()`. We used the default
cosine distance when we created the index, so we’re going to order by
descending similarity (`order_by(..., asc=False)`):

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
sim = imgs.img.similarity(image=sample_img)
res = (
    imgs.order_by(sim, asc=False)  # Order by descending similarity
    .limit(2)  # Limit number of results to 2
    .select(imgs.id, imgs.img, sim)
    .collect()  # Retrieve results now
)
res
```

We can combine nearest-neighbor/similarity search with standard
predicates. Here’s the same query, but filtering out the selected
`sample_img` (which we already know has perfect similarity with itself):

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
res = (
    imgs.order_by(sim, asc=False)
    .where(imgs.id != 6)  # Additional clause
    .limit(2)
    .select(imgs.id, imgs.img, sim)
    .collect()
)
res
```

## Index updates

In Pixeltable, each index is kept up-to-date automatically in response
to changes to the indexed table.

To illustrate this, let’s insert a few more rows:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
more_img_urls = [
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000080.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000090.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000106.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000108.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000139.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000285.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000632.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000724.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000776.jpg',
    'https://raw.githubusercontent.com/pixeltable/pixeltable/release/docs/resources/images/000000000785.jpg',
]
imgs.insert(
    {'id': 10 + i, 'img': url} for i, url in enumerate(more_img_urls)
)
```

<pre>
  Inserted 10 rows with 0 errors in 1.29 s (7.75 rows/s)
  10 rows inserted.
</pre>

When we now re-run the initial similarity query, we get a different
result:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
sim = imgs.img.similarity(image=sample_img)
res = (
    imgs.order_by(sim, asc=False)
    .limit(2)
    .select(imgs.id, imgs.img, sim)
    .collect()
)
res
```

## Similarity search on different types

Because CLIP models are multimodal, we can also do lookups by text.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
sim = imgs.img.similarity(string='train')  # String lookup
res = (
    imgs.order_by(sim, asc=False)
    .limit(2)
    .select(imgs.id, imgs.img, sim)
    .collect()
)
res
```

## Creating multiple indexes on a single column

We can create multiple embedding indexes on the same column, utilizing
different embedding models. In order to use a specific index in a query,
we need to assign it a name and then use that name in the query.

To illustrate this, let’s create a table with text (taken from the
Wikipedia article on [Pablo
Picasso](https://en.wikipedia.org/wiki/Pablo_Picasso)):

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
txts = pxt.create_table('indices_demo/text_tbl', {'text': pxt.String})
sentences = [
    'Pablo Ruiz Picasso (25 October 1881 – 8 April 1973) was a Spanish painter, sculptor, printmaker, ceramicist, and theatre designer who spent most of his adult life in France.',
    'One of the most influential artists of the 20th century, he is known for co-founding the Cubist movement, the invention of constructed sculpture,[8][9] the co-invention of collage, and for the wide variety of styles that he helped develop and explore.',
    "Among his most famous works are the proto-Cubist Les Demoiselles d'Avignon (1907) and the anti-war painting Guernica (1937), a dramatic portrayal of the bombing of Guernica by German and Italian air forces during the Spanish Civil War.",
    'Picasso demonstrated extraordinary artistic talent in his early years, painting in a naturalistic manner through his childhood and adolescence.',
    'During the first decade of the 20th century, his style changed as he experimented with different theories, techniques, and ideas.',
    'After 1906, the Fauvist work of the older artist Henri Matisse motivated Picasso to explore more radical styles, beginning a fruitful rivalry between the two artists, who subsequently were often paired by critics as the leaders of modern art.',
    "Picasso's output, especially in his early career, is often periodized.",
    'While the names of many of his later periods are debated, the most commonly accepted periods in his work are the Blue Period (1901–1904), the Rose Period (1904–1906), the African-influenced Period (1907–1909), Analytic Cubism (1909–1912), and Synthetic Cubism (1912–1919), also referred to as the Crystal period.',
    "Much of Picasso's work of the late 1910s and early 1920s is in a neoclassical style, and his work in the mid-1920s often has characteristics of Surrealism.",
    'His later work often combines elements of his earlier styles.',
]
txts.insert({'text': s} for s in sentences)
```

<pre>
  Inserted 10 rows with 0 errors in 0.03 s (301.25 rows/s)
  10 rows inserted.
</pre>

When calling
[`add_embedding_index()`](https://docs.pixeltable.com/sdk/latest/table#method-add_embedding_index),
we now specify the index name (`idx_name`) directly. If it is not
specified, Pixeltable will assign a name (such as `idx0`).

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
from pixeltable.functions.huggingface import sentence_transformer

txts.add_embedding_index(
    'text',
    idx_name='minilm_idx',
    embedding=sentence_transformer.using(
        model_id='sentence-transformers/all-MiniLM-L12-v2'
    ),
)
txts.add_embedding_index(
    'text',
    idx_name='e5_idx',
    embedding=sentence_transformer.using(model_id='intfloat/e5-large-v2'),
)
```

To do a similarity query, we now call `similarity()` with the `idx`
parameter:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
sim = txts.text.similarity('cubism', idx='minilm_idx')
res = (
    txts.order_by(sim, asc=False)
    .limit(2)
    .select(txts.text, sim)
    .collect()
)
res
```

## Using a UDF for a custom embedding

## Indexing precomputed embeddings (Array columns)

If your data already contains precomputed embedding vectors — for
example, embeddings exported from another system or generated by a
custom pipeline — you can index them directly without specifying an
embedding function.

`add_embedding_index` supports `Array` columns in addition to `String`,
`Image`, `Video`, and `Audio` columns. When the indexed column is an
`Array`, Pixeltable treats its values as precomputed embeddings and
builds the vector index directly from them.

An embedding function is **optional** for `Array` columns. If provided,
it will be used only to convert query values into embeddings during
similarity search.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
import numpy as np
import pixeltable as pxt

pxt.drop_table('indices_demo.precomputed', force=True)

# Table with a precomputed embedding column
precomputed = pxt.create_table(
    'indices_demo.precomputed',
    {'text': pxt.String, 'embedding': pxt.Array[(384,), np.float32]},
)

# Insert rows with precomputed vectors
rng = np.random.default_rng(42)
precomputed.insert(
    [
        {
            'text': 'sample sentence',
            'embedding': rng.random(384).tolist(),
        },
        {
            'text': 'another sentence',
            'embedding': rng.random(384).tolist(),
        },
    ]
)

# Index the Array column directly — no embedding function needed
precomputed.add_embedding_index('embedding', metric='cosine')
```

To run a similarity search, pass a raw vector to the `similarity`
method:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
query_vector = rng.random(384)
sim = precomputed.embedding.similarity(vector=query_vector)
precomputed.order_by(sim, asc=False).limit(2).select(
    precomputed.text, sim
).collect()
```

<pre>
  Error: similarity(vector=...): expected \`numpy.ndarray\`, or array \`Expr\`; got \`list\`
  \[0;31m---------------------------------------------------------------------------\[0m
  \[0;31mError\[0m                                     Traceback (most recent call last)
  Cell \[0;32mIn\[15], line 2\[0m
  \[1;32m      1\[0m query\_vector \[38;5;241m=\[39m rng\[38;5;241m.\[39mrandom(\[38;5;241m384\[39m)\[38;5;241m.\[39mtolist()
  \[0;32m----> 2\[0m sim \[38;5;241m=\[39m \[43mprecomputed\[49m\[38;5;241;43m.\[39;49m\[43membedding\[49m\[38;5;241;43m.\[39;49m\[43msimilarity\[49m\[43m(\[49m\[43mvector\[49m\[38;5;241;43m=\[39;49m\[43mquery\_vector\[49m\[43m)\[49m
  \[1;32m      3\[0m precomputed\[38;5;241m.\[39morder\_by(sim, asc\[38;5;241m=\[39m\[38;5;28;01mFalse\[39;00m)\[38;5;241m.\[39mlimit(\[38;5;241m2\[39m)\[38;5;241m.\[39mselect(precomputed\[38;5;241m.\[39mtext, sim)\[38;5;241m.\[39mcollect()

  File \[0;32m/Users/pierre/pixeltable/.venv/lib/python3.12/site-packages/pixeltable/exprs/column\_ref.py:313\[0m, in \[0;36mColumnRef.similarity\[0;34m(self, item, string, image, audio, video, document, vector, idx)\[0m
  \[1;32m    311\[0m \[38;5;28;01melse\[39;00m:
  \[1;32m    312\[0m     \[38;5;28;01mif\[39;00m \[38;5;129;01mnot\[39;00m \[38;5;28misinstance\[39m(vector, np\[38;5;241m.\[39mndarray):
  \[0;32m--> 313\[0m         \[38;5;28;01mraise\[39;00m excs\[38;5;241m.\[39mError(
  \[1;32m    314\[0m             \[38;5;124mf\[39m\[38;5;124m'\[39m\[38;5;124msimilarity(vector=...): expected \`numpy.ndarray\`, or array \`Expr\`; \[39m\[38;5;124m'\[39m
  \[1;32m    315\[0m             \[38;5;124mf\[39m\[38;5;124m'\[39m\[38;5;124mgot \`\[39m\[38;5;132;01m\{\[39;00m\[38;5;28mtype\[39m(vector)\[38;5;241m.\[39m\[38;5;18m\_\_name\_\_\[39m\[38;5;132;01m}\[39;00m\[38;5;124m\`\[39m\[38;5;124m'\[39m
  \[1;32m    316\[0m         )
  \[1;32m    317\[0m     \[38;5;28;01mif\[39;00m vector\[38;5;241m.\[39mndim \[38;5;241m!=\[39m \[38;5;241m1\[39m:
  \[1;32m    318\[0m         \[38;5;28;01mraise\[39;00m excs\[38;5;241m.\[39mError(\[38;5;124mf\[39m\[38;5;124m'\[39m\[38;5;124msimilarity(vector=...): expected 1-dimensional array; got shape \[39m\[38;5;132;01m\{\[39;00mvector\[38;5;241m.\[39mshape\[38;5;132;01m}\[39;00m\[38;5;124m'\[39m)

  \[0;31mError\[0m: similarity(vector=...): expected \`numpy.ndarray\`, or array \`Expr\`; got \`list\`
</pre>

If you want to search by **text** (or another modality) rather than a
raw vector, provide an embedding function that converts the query value
into the same vector space. The function is only used at query time — it
does not re-embed the stored vectors.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
precomputed.add_embedding_index(
    'embedding',
    string_embed=my_text_embedding_fn,  # converts query strings → vectors
    metric='cosine',
)
sim = precomputed.embedding.similarity(string='search query')
```

The above examples show how to use any model in the Hugging Face `CLIP`
or `sentence_transformer` model families, and essentially the same
pattern can be used for any other embedding with built-in Pixeltable
support, such as OpenAI embeddings. But what if you want to adapt a new
model family that doesn’t have built-in support in Pixeltable? This can
be done by writing a custom Pixeltable UDF.

In the following example, we’ll write a simple UDF to use the
[BERT](https://www.kaggle.com/models/tensorflow/bert/tensorFlow2/en-uncased-preprocess/3)
model built on TensorFlow. First we install the necessary dependencies.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
%pip install -qU tensorflow tensorflow-hub tensorflow-text 'setuptools<82'
```

Text embedding UDFs must always take a string as input, and return a
1-dimensional numpy array of fixed dimension (512 in the case of
`small_bert`, the variant we’ll be using). If we were writing an image
embedding UDF, the `input` would have type `PIL.Image.Image` rather than
`str`. The UDF is straightforward, loading the model and evaluating it
against the input, with a minor data conversion on either side of the
model invocation.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
import pixeltable as pxt
import tensorflow as tf
import tensorflow_hub as hub
import tensorflow_text  # Necessary to ensure BERT dependencies are loaded


@pxt.udf
def bert(input: str) -> pxt.Array[(512,), np.float32]:
    """Computes text embeddings using the small_bert model."""
    preprocessor = hub.load(
        'https://tfhub.dev/tensorflow/bert_en_uncased_preprocess/3'
    )
    bert_model = hub.load(
        'https://tfhub.dev/tensorflow/small_bert/bert_en_uncased_L-4_H-512_A-8/2'
    )
    tensor = tf.constant([input])  # Convert the string to a tensor
    result = bert_model(preprocessor(tensor))['pooled_output']
    return result.numpy()[0, :]
```

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
txts.add_embedding_index('text', idx_name='bert_idx', embedding=bert)
```

Here’s the output of our sample query run against `bert_idx`.

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
sim = txts.text.similarity('cubism', idx='bert_idx')
res = (
    txts.order_by(sim, asc=False)
    .limit(2)
    .select(txts.text, sim)
    .collect()
)
res
```

Our example UDF is very simple, but it would perform poorly in a
production setting. To make our UDF production-ready, we’d want to do
two things:

* Cache the model: the current version calls `hub.load()` on every UDF
  invocation. In a real application, we’d want to instantiate the model
  just once, then reuse it on subsequent UDF calls.
* Batch our inputs: we’d use Pixeltable’s batching capability to ensure
  we’re making efficient use of the model. Batched UDFs are described in
  depth in the [User-Defined
  Functions](https://docs.pixeltable.com/platform/udfs-in-pixeltable.md)
  how-to guide.

You might have noticed that the updates to `bert_idx` seem sluggish;
that’s why!

## Deleting an index

To delete an index, call
[`Table.drop_embedding_index()`](https://docs.pixeltable.com/sdk/latest/table#method-drop_embedding_index):

* specify the `idx_name` parameter if you have multiple indices
* otherwise the `column_name` parameter is sufficient

Given that we have several embedding indices, we’ll specify which index
to drop:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
txts.drop_embedding_index(idx_name='e5_idx')
```

## Ship it as an app

This notebook used `add_embedding_index`. On a `TableModel`, indexes
live in `__indexes__`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
import pixeltable as pxt
from pixeltable.functions.huggingface import clip

TableModel = pxt.model_base()


class ImgTbl(TableModel, name='img_tbl'):
    img: pxt.Image
    __indexes__ = [
        pxt.EmbeddingIndex(img, embedding=clip.using(model_id='openai/clip-vit-base-patch32'), name='img_idx'),
    ]
```

```bash theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
pxt schema update app.py indices_demo
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.