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.
Questo esercizio fa parte del corso
Introduction to Embeddings with the OpenAI API
Istruzioni dell'esercizio
- 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.
Esercizio pratico interattivo
Prova a risolvere questo esercizio completando il codice di esempio.
# 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)