RAG & Vector Databases · Урок 1
Embeddings and Similarity Metrics
What an embedding is, cosine vs dot product vs Euclidean, comparing text-embedding-3, gemini-embedding-2, Cohere embed-v5.0 and the open EmbeddingGemma 2 and all-MiniLM, multimodal embeddings, choosing dimensions.
ENМатеріали курсів поки англійською. Інтерфейс, ШІ-наставник і перевірка завдань — українською.
What an embedding is
An embedding is a fixed-length dense vector (e.g., 1536 or 3072 numbers) that encodes the meaning of text. Semantically similar fragments sit close together in this space even if they share no words. That is the basis of semantic search: instead of keyword matching we look for nearby vectors.
from openai import OpenAI
client = OpenAI()
resp = client.embeddings.create(
model="text-embedding-3-large",
input=["How do I reset my password?", "Recovering account access"],
dimensions=1536, # 3-large is natively 3072, can be truncated
)
v1 = resp.data[0].embedding
v2 = resp.data[1].embedding
print(len(v1)) # 1536
Далі урок відкривається після безкоштовної реєстрації
Реєстрація через email або Google відкриває перші два уроки кожного курсу назавжди і 7 днів повного доступу до всього каталогу. Картка не потрібна.


