We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Document Embeddings

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.

Assignment

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.

  1. uv add numpy==2.3.3
    
  2. import numpy as np
    
    1. 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.