Retrieval

What is an embedding index?

An embedding index ranks nearest neighbors for a query and stays attached to the table that owns those rows.

Updated · Part of What is an embedding?

How it works

  • You name the column and the embedding function.
  • New and changed rows are embedded. Unchanged rows stay as they are.
  • A similarity query orders rows by distance to the question.

What it is not

It is not a standalone vector database you load and sync yourself.

embedding index: this, and the thing it is confused with

embedding index: this, and the thing it is confused with
ThisNot this
Lives onThe table that holds the piecesA second database you copy into
When rows changeThose rows are re-embeddedA sync job you operate
QueryNearest rows of that tableNearest vectors with no source row

Where Pixeltable fits

Pixeltable declares it as __indexes__ = [pxt.EmbeddingIndex(...)] on the class. Insert updates the index for that row.

import pixeltable as pxt
from pixeltable.functions.huggingface import sentence_transformer
TableModel = pxt.model_base()
text_embed = sentence_transformer.using(model_id='all-MiniLM-L6-v2')
class Passages(TableModel, name='passages'):
text: pxt.String
__indexes__ = [
pxt.EmbeddingIndex(text, string_embed=text_embed),
]

Questions

How does embedding index work?
You name the column and the embedding function. New and changed rows are embedded. Unchanged rows stay as they are. A similarity query orders rows by distance to the question.
What is embedding index often confused with?
It is not a standalone vector database you load and sync yourself.