Get startedGet started for free

Querying the Netflix collection

Now that you've created and populated the netflix_titles collection, it's time to query it!

As a first trial, you'll use it to provide recommendations for films and TV shows about dogs to one of your colleagues who loves dogs!

The netflix_titles collection is still available to use, and OpenAIEmbeddingFunction() has been imported.

This exercise is part of the course

Introduction to Embeddings with the OpenAI API

View Course

Exercise instructions

  • Retrieve the netflix_titles collection, specifying the OpenAI embedding function so the query is embedded using the same function as the documents.
  • Query the collection for "films about dogs" and return three results.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# Retrieve the netflix_titles collection
collection = ____(
  name="____",
  embedding_function=____(model_name="text-embedding-3-small", api_key="")
)

# Query the collection for "films about dogs"
result = ____

print(result)
Edit and Run Code