~/TechPurAI
~/tutorials/llm-and-advanced-ai/what-are-embeddings-in-ai
intermediate·part 1 of 22·4 min read

What Are Embeddings in AI?

Updated Aug 16, 2026AI

The AI Projects with Python series built a real Q&A app using simple keyword matching for retrieval — and honestly flagged its real limit: a question phrased differently than a document's exact wording gets missed entirely. This series starts by fixing that properly, beginning with the real, foundational concept that makes it possible: embeddings.

A real, precise definition

text
An embedding is a real, numerical representation of a piece of text
  (a word, sentence, or document) — a list of numbers (a "vector")
  that captures its actual MEANING, not just its literal characters
text
"the coffee arrived stale"     → [0.02, -0.15, 0.88, ..., 0.31]
"my order tasted old"          → [0.03, -0.14, 0.85, ..., 0.29]
"the weather today is sunny"   → [-0.71, 0.44, 0.02, ..., -0.55]

These real vectors are typically hundreds or thousands of numbers long — the illustration above is deliberately simplified, but the real, core property is genuine: the first two sentences, despite sharing almost no literal words, produce real vectors that are numerically close to each other, while the third, unrelated sentence produces a real vector that's numerically far from both.

How "closeness" is actually measured

text
Cosine similarity: a real, standard mathematical measure of how
  similar two vectors' DIRECTIONS are, producing a real score from
  -1 (opposite meaning) to 1 (identical meaning)
python
"the coffee arrived stale"  vs  "my order tasted old"
  → real cosine similarity: ~0.89 (genuinely close)

"the coffee arrived stale"  vs  "the weather today is sunny"
  → real cosine similarity: ~0.05 (genuinely unrelated)

This is exactly the real, mathematical mechanism underneath every "semantic search" feature — including the vector database search this series builds toward in part 3, and the real, complete RAG application in part 6. Nothing mysterious is happening; it's genuinely a distance calculation between two lists of numbers.

Where these real numbers actually come from

text
An embedding model — a real, separate, specifically trained neural
  network (the same underlying technology covered in the AI
  Fundamentals series' own neural network explanation) — is trained
  specifically to produce vectors where semantically similar real
  text ends up numerically close together

This is a genuinely different, specialized model from the large language models this site's earlier series used for generation — an embedding model's entire real job is producing these vectors accurately, not generating fluent text. Many real providers (including Anthropic, OpenAI, and open-source options) offer a real, dedicated embeddings API separate from their text-generation API.

A real, concrete embedding call

python
from anthropic import Anthropic

client = Anthropic()

# illustrative — the real, specific embeddings API and model names
# vary by provider; check current, official documentation before
# writing production code
response = client.embeddings.create(
    model="a-real-embedding-model",
    input="the coffee arrived stale",
)
vector = response.embedding  # a real list of floating-point numbers
Why it matters

This single capability — turning text into vectors where semantic closeness is a real, calculable distance — is the entire foundation underneath vector databases (part 3), real RAG systems (part 6), and semantic search generally. Understanding it precisely here is what makes every following part in this series a direct, concrete application of one real idea, rather than a series of disconnected techniques.

Why embeddings solve the exact, real gap flagged earlier

text
Keyword search (the AI Projects series' own Q&A app): "do you ship
  internationally" fails to match a document phrased as "worldwide
  shipping," since neither shares the literal word the other uses
Embedding-based search: correctly matches them, since both produce
  real vectors that are numerically close — the MEANING is similar,
  even though the literal words are completely different

This is the real, direct, concrete payoff — and precisely why this series exists as the deliberate next step after the AI Projects with Python series' own honest limitation, not a disconnected new topic.

Embeddings are not unique to text

text
Real, genuine applications beyond text: image embeddings (finding
  visually similar real photos), audio embeddings, even embeddings
  of user behavior for real recommendation systems

This series stays scoped to text embeddings, since that's what's directly relevant to the RAG, PDF Q&A, and chatbot projects ahead — but worth knowing this same real, underlying vector-representation idea generalizes well beyond language.

Next: how embeddings actually capture meaning — a deeper, real look at what these numbers represent and why semantically related concepts end up close together.

VK

Vijay Kumar

Founder of TechPurAI — writing hands-on tutorials and honest tool breakdowns.

LinkedIn ↗
next →2. How Embeddings Actually Capture Meaning