Ingesting vectors with metadata
It's ingesting time! You'll be ingesting vectors
, which is a list of dictionaries containing the vector values, IDs, and associated metadata. They're already been provided in a format that can be directly inserted into the index without further manipulation.
Here's another reminder about the structure of vectors
.
vectors = [
{
"id": "0",
"values": [0.025525547564029694, ..., 0.0188823901116848]
"metadata": {"genre": "action", "year": 2024}
},
...,
]
This exercise is part of the course
Vector Databases for Embeddings with Pinecone
Exercise instructions
- Initialize the Pinecone connection with your API key.
- Connect to your index called
"datacamp-index"
. - Upsert
vectors
to the index. - Print the index's descriptive statistics.
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Initialize the Pinecone client with your API key
pc = Pinecone(api_key="____")
# Connect to your index
index = pc.____("datacamp-index")
# Ingest the vectors and metadata
____
# Print the index statistics
print(____)