Skip to content

Embeddings

Turn texts into numbers that stand for their meaning, to search by meaning or find similar things.

Applies to EngineCloud
View as Markdown

An embedding is a list of numbers that stands for the meaning of a text. Texts that mean similar things get similar numbers, so you can search by meaning: a customer types «something without gluten» and finds the gluten-free loaf, even though the words differ.

TypeScript
const { vectors } = await ai.embed({
  task: 'embed',
  case: 'find-products',
  input: products.map((p) => `${p.name}. ${p.description}`),
});

Keep the vectors next to your data. In Sypnia Data, a vector column (Postgres with pgvector) holds them, and one query finds the nearest products to the customer’s words.

Inputs per requestup to 256 texts, each within the model’s limit
Optionsdimensions where the model supports it; encoding_format: float or base64
Priceper token read; nothing is written

    Search pages, sections and terms