From 37714fced88fef8eaf6c3a61fc980dde56f6d933 Mon Sep 17 00:00:00 2001 From: Yackadaisical <134191941+Yackadaisical@users.noreply.github.com> Date: Sun, 3 Dec 2023 23:08:08 +0800 Subject: [PATCH] Update chunkedUpsert.ts The chunkedUpsert function is designed to split an array of PineconeRecord vectors into smaller chunks and upsert (insert or update) each chunk into a Pinecone index. It uses the sliceIntoChunks helper function to create the chunks based on the specified chunkSize. However, there is a bug in the chunkedUpsert function. Inside the map callback, it should be upserting the chunk rather than the entire vectors array. This is likely the reason why the request size is exceeding the limit, as it's attempting to upsert the entire array of vectors in each iteration instead of just the chunk. --- src/app/utils/chunkedUpsert.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/utils/chunkedUpsert.ts b/src/app/utils/chunkedUpsert.ts index 060185f..f3293ce 100644 --- a/src/app/utils/chunkedUpsert.ts +++ b/src/app/utils/chunkedUpsert.ts @@ -20,7 +20,7 @@ export const chunkedUpsert = async ( await Promise.allSettled( chunks.map(async (chunk) => { try { - await index.namespace(namespace).upsert(vectors); + await index.namespace(namespace).upsert(chunk); } catch (e) { console.log('Error upserting chunk', e); }