PineconeApiException: (400): HTTP response body: queries[728]: invalid value -0.0018521797610446811 for type type.googleapis.com/QueryVector

Here is my query code:

In[3]

Specify the number of similar vectors you want to retrieve

top_k = 5
query_text = “Example search text or concatenated fields”
response = openai.Embedding.create(input=query_text, model=“text-embedding-ada-002”)
#query_vector = response[‘data’][0][‘embedding’]
query_vector = embed_text_with_openai(query_text)

Execute the query

top_k = 5 # Number of top similar results to retrieve
query_results = index.query(queries=[query_vector], top_k=top_k, namespace=namespace)

Print the query results

for result in query_results[‘matches’]:
print(f"ID: {result[‘id’]}, Score: {result[‘score’]}“)
# If you have stored metadata with your vectors, you can access it like this:
if ‘metadata’ in result:
print(f"Metadata: {result[‘metadata’]}”)

Here is the errors and I’m sure the dimension is correct:
PineconeApiException Traceback (most recent call last) /Users/fuhaoruan/Documents/temp/los_finance.py in line 11 [81](file:///Users/fuhaoruan/Documents/temp/los_finance.py?line=80) # Execute the query [82](file:///Users/fuhaoruan/Documents/temp/los_finance.py?line=81) top_k = 5 # Number of top similar results to retrieve —> [83](file:///Users/fuhaoruan/Documents/temp/los_finance.py?line=82) query_results = index.query(queries=[query_vector], top_k=top_k, namespace=namespace) [85](file:///Users/fuhaoruan/Documents/temp/los_finance.py?line=84) # Print the query results [86](file:///Users/fuhaoruan/Documents/temp/los_finance.py?line=85) for result in query_results[‘matches’]:

PineconeApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Tue, 30 Jan 2024 22:28:11 GMT’, ‘Content-Type’: ‘text/plain’, ‘Content-Length’: ‘91’, ‘Connection’: ‘keep-alive’, ‘server’: ‘envoy’})
HTTP response body: queries[728]: invalid value -0.0018521797610446811 for type type.googleapis.com/QueryVector

1 Like

I too am receiving same error. Did you find any solution for this? If anyone knows the reason for this error, please let me know.

My code -

results = index.query(queries=[vector_embedding], top_k=3, filter={"file_name": {"$eq": "file1.txt"}})

And the error, I am facing is - HTTP response body: queries[175]: invalid value 0.0073849847540259361 for type type.googleapis.com/QueryVector

Change the index.query(queries= to index.query(vector=

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.