Embeddings
Turn texts into numbers that stand for their meaning, to search by meaning or find similar things.
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.
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 request | up to 256 texts, each within the model’s limit |
| Options | dimensions where the model supports it; encoding_format: float or base64 |
| Price | per token read; nothing is written |