Quantcast
Channel: Pinecone Community - Latest topics
Viewing all articles
Browse latest Browse all 834

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

$
0
0

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

2 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 834

Trending Articles