Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Problem
Using current code with large files will run into this error:
Error upserting chunk [PineconeBadRequestError: Request size 3MB exceeds the maximum supported size of 2MB] {
name: 'PineconeBadRequestError',
cause: undefined
Solution
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.
Type of Change