Index query for multiple vector

Assuming I have already created and configured your Pinecone index - text ada-002- 1536 dimension

Generate query vectors for each query

query1 = [0.5, 0.2, 0.8]
query2 = [0.1, 0.9, 0.4]
query3 = [0.7, 0.3, 0.6]

Pass the list of query vectors to index.query

results = index.query([query1, query2, query3], top_k=5)

Any one tried this code .

PineconeApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({‘content-type’: ‘application/json’, ‘date’: ‘Wed, 07 Feb 2024 21:02:10 GMT’, ‘x-envoy-upstream-service-time’: ‘2’, ‘content-length’: ‘110’, ‘server’: ‘envoy’})
HTTP response body: {“code”:3,“message”:“Query vector dimension 3072 does not match the dimension of the index 1536”,“details”:}

Hi @avidey, thanks for your post. The Query operation takes in a single vector, not a list of vectors. Since a vector is itself a list, by passing a list of vectors, you’re essentially concatenating them into one extra-long vector. That’s why you’re getting an error about your query vector having a dimension of 3072 (2 vectors each with dimension 1536).
You can find more examples in our documentation.