

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Semantic Search
incomplete
2: Embeddings
incomplete
3: Embedding Models
incomplete
4: Model Selection
incomplete
5: Vector Operations
incomplete
6: Dimensions
incomplete
7: Dot Product Similarity
incomplete
8: Cosine Similarity
incomplete
9: Why Cosine Similarity?
incomplete
10: Generating Text Embeddings
incomplete
11: Document Embeddings
incomplete
12: Query Embeddings
incomplete
13: Same Model
incomplete
14: Implementing Semantic Search
incomplete
15: Locality-Sensitive Hashing
incomplete
16: Vector Databases
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
Now that we've created an embedding for a single string, let's create embeddings for our entire movie dataset. This will turn our movies into a searchable vector store.
We'll save the embeddings in a .npy file using numpy.save. The .npy file will be our vector store.
Add logic to generate embeddings for the full movie dataset, save them to disk, load them if they already exist, and verify that they seem correct. This way, the slow embedding generation step only needs to happen once.
uv add numpy==2.3.3
import numpy as np
print(f"Number of docs: {len(documents)}")
print(
f"Embeddings shape: {embeddings.shape[0]} vectors in {embeddings.shape[1]} dimensions"
)
Run and submit the CLI tests.