Skip to main content
AI Backend GlossaryGlossary

Embeddings

Numerical vector representations of text for semantic similarity search.

Definition

Embeddings are fixed-size numerical vectors (e.g., 1536 floats for OpenAI's `text-embedding-3-small`) that capture the semantic meaning of text. Two pieces of text with similar meaning have embeddings that are geometrically close. This enables semantic search: finding the most relevant document chunks based on meaning, not just keywords.

Why it matters for AI APIs

Keyword search fails for AI applications. 'How do I cancel?' and 'What's your cancellation policy?' mean the same thing but share no keywords. Embedding-based search handles paraphrasing, synonyms, and language variation — making it the right retrieval method for RAG systems.

In FastAPI AI Kit

The kit calls `openai.embeddings.create(input=text, model='text-embedding-3-small')` during document ingestion and query time. Embeddings are stored in a pgvector `vector(1536)` column. The kit caches embeddings in Redis to avoid redundant API calls during re-ingestion.

Related terms