Asyncio vector deletion error #577
Open
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.
Fixes
AttributeErrorwhen assigning_response_infoto primitive types in API responses, particularly for asyncio delete operations.GitHub Issue
Closes #564
Problem Description
When using the asyncio SDK to delete vectors, the following error occurs:
The error happens at:
pinecone/openapi_support/asyncio_api_client.py, line 182pinecone/openapi_support/api_client.py, line 217 (sync version has the same bug)Root Cause
The issue occurs in the code that attaches response metadata (
_response_info) to API responses. The code attempts to set_response_infoon the return data using one of two approaches:_response_infoas a dictionary key_response_infoas an attribute usingsetattr()However, the code doesn't handle primitive types (str, int, float, bool, bytes, None) which don't support attribute assignment. If the API returns or the deserializer produces a primitive type, the
setattr()call fails with anAttributeError.The
delete()operation uses_check_type=Falseby default, which may allow the deserializer to return unexpected types in certain edge cases or API response scenarios.Solution
Modified both
asyncio_api_client.pyandapi_client.pyto handle primitive types gracefully:Before:
After:
The fix:
setattr()_response_infoon primitive types (they can't have it anyway)Testing
New Tests Added
Created comprehensive unit tests in
tests/unit/test_response_info_assignment.py:_response_infoas a dictionary key_response_infoas an attributeExisting Tests
All 367 existing unit tests pass with the fix applied.
Files Changed
Impact
Linear Issue: PIN-12
Note
Fix response metadata attachment
api_client.pyandasyncio_api_client.py, skip_response_infoassignment for primitive types and wrapsetattrin try/except to avoidAttributeError; still add_response_infoto dict responsestests/unit/test_response_info_assignment.pycovering dict, string,None, and model responses (async variants included but skipped without extras)Written by Cursor Bugbot for commit c0209e2. This will update automatically on new commits. Configure here.