Aan de slagGa gratis aan de slag

Filtering queries

In this exercise, you'll practice querying the 'datacamp-index' Pinecone index. You'll connect to the index and query it using the vector provided to retrieve similar vectors. You'll also use metadata filtering to optimize your querying and return the most relevant search results.

Deze oefening maakt deel uit van de cursus

Vector Databases for Embeddings with Pinecone

Cursus bekijken

Oefeninstructies

  • Initialize the Pinecone connection with your API key.
  • Retrieve the MOST similar vector to the vector provided, only searching through vectors where the metadata 'year' equals 2024.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Initialize the Pinecone client with your API key
pc = Pinecone(api_key="____")

index = pc.Index('datacamp-index')

# Retrieve the MOST similar vector with the year 2024
query_result = ____
print(query_result)
Code bewerken en uitvoeren