Tutorials · Chapter D (4/4) · ~10 min
Embedding API lab
Try it → see it → read → next
Call an **embeddings endpoint**, compare vectors, and see why RAG retrieval picks certain chunks.
Try yourself
Playground
Embedding similarity lab
Same meaning → vectors close together. Pick the highest cosine match to the query.
Query embedding compared to candidate chunks (scores simulated):
Recap
What you just did
You matched a refund question to the highest cosine similarity chunk — that's retrieval in one step.
Teach
How it works
- Embed query and all chunks with the same model
- Cosine similarity (or dot product on normalized vectors)
- Take top-k → pack into prompt
Read
Try it
Run the embeddings API on three policy sentences + one off-topic line. Print similarity scores.