I am getting this error PineconeApiException: (400) Reason: Bad Request while Query the index with the encoded query vector

Hey i am getting this whole error
PineconeApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({‘Date’: ‘Wed, 29 May 2024 07:08:17 GMT’, ‘Content-Type’: ‘application/json’, ‘Content-Length’: ‘90’, ‘Connection’: ‘keep-alive’, ‘x-pinecone-request-latency-ms’: ‘1’, ‘x-pinecone-request-id’: ‘6621208589884267945’, ‘x-envoy-upstream-service-time’: ‘2’, ‘server’: ‘envoy’})
HTTP response body: {“code”:3,“message”:“Cannot provide both ‘ID’ and ‘vector’ at the same time”,“details”:}
when i am trying to Query the index with the encoded query vector after storing the vectors . i am storing the vectors in this way

Batch size

batch_size = 1000
all_embedding_vectors =

Creating embeddings for Each of The Text Chunks & storing

for i in range(0, len(text_chunks), batch_size):
batch_text_chunks = text_chunks[i:i+batch_size]
batch_embedding_vectors =

# Creating embeddings and assigning unique IDs
for j, t in enumerate(batch_text_chunks):
    embedding = model.encode([t.page_content])[0]
    embedding_vector = {'id': str(i + j), 'values': embedding.tolist()}

    # Include text content as metadata
    embedding_vector['metadata'] = {'text': t.page_content}

    batch_embedding_vectors.append(embedding_vector)

all_embedding_vectors.extend(batch_embedding_vectors)

# Upsert the embedding vectors into the Pinecone index
try:
    index.upsert(batch_embedding_vectors,namespace='chat')
except Exception as e:
    # Log any errors that occur during upsert
    print(f"Error occurred during upsert: {e}")

can anyone help me? if you know solution then please contact me on my mail rajkr8369@gmail.com

Hi @rrgamers277, and welcome to the Pinecone community forums!

Thank you for your question.

Based on the error message you’re getting back, it appears you’re likely trying to supply BOTH the IDs and the vector values when you are querying your index.

If you could please share the code where you are executing your query, we’d be able to better confirm - but when you query, you should only be passing one or the other - NOT both.

Hope that helps!

Best,
Zack