Lesson Complete!

Store and Search Vectors

What you did in this lesson

  • Learned that cosine similarity measures directional closeness between vectors
  • Wrote cosine_similarity() — scores two vectors with numpy
  • Wrote search() — embeds a question and returns the top matching chunks
  • Wrote test_search() — verified the pipeline end-to-end up to retrieval

What comes next

You can now retrieve the most relevant passages from any PDF. In Lesson 5, you will hand those passages to Gemini and ask it to generate an answer.