Lesson 1 of 10% complete
Lesson 1
+100 XPVector Embeddings and Semantic Search
Vector Embeddings and Semantic Search
Embeddings are dense vector representations that capture semantic meaning. Similar concepts map to nearby points in high-dimensional space.
Embedding Models
- OpenAI text-embedding-3-small: 1536d, cost-effective
- text-embedding-3-large: 3072d, higher accuracy
- Sentence Transformers (all-MiniLM-L6-v2): Open source, 384d, fast
Similarity Metrics
- Cosine Similarity: Measures angle between vectors (most common for text)
- Dot Product: Faster, works when vectors are normalized
- Euclidean Distance: L2 norm, less common for text
Vector Databases
| Database | Type | Best For |
|---|---|---|
| Pinecone | Managed | Production, scale |
| Chroma | Open Source | Local dev, prototyping |
| Weaviate | Open Source | Complex queries |
| pgvector | PostgreSQL extension | Existing Postgres infra |
Code Sandbox
Python 3.11
Simulated Runtime
sandbox.py
python