Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: PineconeIndex upsert request size limit #165

Merged
merged 3 commits into from
Feb 26, 2024
Merged

fix: PineconeIndex upsert request size limit #165

merged 3 commits into from
Feb 26, 2024

Conversation

siddicky
Copy link
Contributor

@siddicky siddicky commented Feb 22, 2024

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 a PineconeApiException due to surpassing Pinecone's maximum request size limit.

Changes

  • Added a _batch_upsert method to PineconeIndex for handling individual batches of upsert operations.
  • Modified the 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

  • Ensured that existing unit tests pass.
  • Added new tests to cover the batch upsert functionality.
  • Manually tested with datasets exceeding the previous 3MB limit to confirm successful upsert without exceptions.

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.

@siddicky siddicky marked this pull request as ready for review February 22, 2024 03:43
@siddicky siddicky changed the title feat: Implement Batch Upsert in PineconeIndex to Handle Large Data Payloads fix: PineconeIndex upsert request size limit Feb 23, 2024
@jamescalam jamescalam self-requested a review February 26, 2024 09:35
@jamescalam jamescalam self-assigned this Feb 26, 2024
@jamescalam jamescalam added bug Something isn't working enhancement Enhancement to existing features feature New feature request labels Feb 26, 2024
Copy link

codecov bot commented Feb 26, 2024

Codecov Report

Attention: Patch coverage is 12.50000% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 78.34%. Comparing base (01eb8d7) to head (cfa13de).
Report is 4 commits behind head on main.

Files Patch % Lines
semantic_router/index/pinecone.py 12.50% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #165      +/-   ##
==========================================
+ Coverage   78.33%   78.34%   +0.01%     
==========================================
  Files          41       41              
  Lines        1943     1944       +1     
==========================================
+ Hits         1522     1523       +1     
  Misses        421      421              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@jamescalam jamescalam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks!

@jamescalam jamescalam merged commit 2f7d92c into aurelio-labs:main Feb 26, 2024
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement Enhancement to existing features feature New feature request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handling Large Data Payloads Exceeds Pinecone's Maximum Request Size
2 participants