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.
Deze oefening maakt deel uit van de cursus
Introduction to Embeddings with the OpenAI API
Oefeninstructies
- Retrieve the
netflix_titlescollection, 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.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# 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)