embed generates a vector embedding for each row of a text or image column and returns a column of AI envelopes. An AI envelope is a STRUCT value with the vector embedding and associated metadata.
Chowder picks the embedding model from your input. See Models.
Signature
Input
Pass text, such as thecontent column from read_documents or a text column from read_parquet.
For images, pass the image column from read_images, read_videos, or read_mcap. It holds the encoded image bytes, which embed decodes for the embedding model.
AI envelope
Each row’s AI envelope has these fields:
Rows that fail or have null input stay in the result with a null
output. For failed rows, error explains why.
Text embeddings
Image and text embeddings
The default embedding model supports text and images in the same vector space.Behavior
embedruns only on the rows the query needs. For example, it runs on rows that satisfy theWHEREconditions.- Results are cached, so
embeddoesn’t recompute results for the same input. See Caching. - Vectors are L2-normalized by default, so their dot product equals their cosine similarity. To keep raw vectors, create the engine with
embed_config=chowder.EmbedConfig(normalize=False). See Configuration. - Vectors are comparable only when they come from the same model. Check
model_idbefore comparing stored vectors with new ones.