Fetching vectors
In this exercise, you've been provided with a list of ids containing IDs of different records in your 'datacamp-index' index. You'll use these IDs to retrieve the associated records and explore their metadata.
Este ejercicio forma parte del curso
Vector Databases for Embeddings with Pinecone
Instrucciones del ejercicio
- Initialize the Pinecone connection with your API key.
- Retrieve the vectors with IDs in the
idslist from the connected index. - Create a list of dictionaries containing the metadata from each record in
fetched_vectors.
Ejercicio interactivo práctico
Prueba este ejercicio y completa el código de muestra.
# Initialize the Pinecone client with your API key
pc = Pinecone(api_key="____")
index = pc.Index('datacamp-index')
ids = ['2', '5', '8']
# Fetch the vectors from the connected Pinecone index
fetched_vectors = ____
# Extract the metadata from each result in fetched_vectors
metadatas = [fetched_vectors['____'][____]['____'] for id in ids]
print(metadatas)