1. Learn
  2. /
  3. Courses
  4. /
  5. Vector Databases for Embeddings with Pinecone

Connected

Exercise

Querying vectors for semantic search

In this exercise, you'll create a query vector from the question, 'What is in front of the Notre Dame Main Building?'. Using this embedded query, you'll query the 'squad_dataset' namespace from the 'pinecone-datacamp' index and return the top five most similar vectors.

Instructions

100 XP
  • Initialize the Pinecone client with your API key (the OpenAI client is available as client).
  • Create a query vector by embedding the query provided with the same OpenAI embedding model you used for embedding the other vectors.
  • Query the "squad_dataset" namespace using query_emb, returning the top five most similar results.