

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
Let's convert some text into embeddings.
Unlike keyword search, embedding models handle many preprocessing tasks automatically:
Add a function to the semantic search module that generates an embedding for a single text input, and verify that it works.
print(f"Text: {text}")
print(f"First 3 dimensions: {embedding[:3]}")
print(f"Dimensions: {embedding.shape[0]}")
Run and submit the CLI tests.
Each embedding model is trained with a specific tokenizer. You must tokenize text the same way the model was trained, so models come packaged with their tokenizers. In other words, the library does it for you!