Complete the code to initialize the Pinecone client with your API key.
import pinecone pinecone.init(api_key=[1])
You must pass your Pinecone API key as a string to pinecone.init() to authenticate.
Complete the code to create a Pinecone index named 'example-index' with dimension 128.
pinecone.create_index(name=[1], dimension=128)
The index name must be a string matching the desired name, here "example-index".
Fix the error in the code to connect to an existing Pinecone index named 'example-index'.
index = pinecone.Index([1])The index name must be passed as a string with quotes to pinecone.Index().
Fill both blanks to upsert vectors into the Pinecone index.
vectors = [("id1", [0.1, 0.2, 0.3], [1])] index.upsert(vectors=[2])
The tuple for vectors can include metadata as the third element, and the upsert method takes the list named vectors.
Fill all three blanks to query the Pinecone index for top 3 matches with a vector.
query_response = index.query( vector=[1], top_k=[2], include_metadata=[3] )
To query, pass the query vector as a list, set top_k to 3 for top 3 results, and include_metadata to True to get metadata in results.