fix: PineconeIndex upsert request size limit #165
Merged
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.
Resolves #166
Overview
This pull request introduces a batch upsert functionality to the
PineconeIndex
class within the semantic-router project. Previously, attempting to upsert a large volume of data exceeding 3MB resulted in aPineconeApiException
due to surpassing Pinecone's maximum request size limit.Changes
_batch_upsert
method toPineconeIndex
for handling individual batches of upsert operations.add
method to break down the data into manageable batches (default size of 100 records per batch) before upserting to avoid exceeding the 2MB request size limit.Testing
Usage
Users can now add large datasets without manual batching. The
add
method automatically handles data in batches, ensuring compatibility with Pinecone's size constraints.Impact
This enhancement prevents
PineconeApiException
errors during large data upserts, improving the reliability and usability of the semantic-router's Pinecone integration for users dealing with substantial datasets.