Skip to content

Conversation

@jhamon
Copy link
Collaborator

@jhamon jhamon commented Feb 2, 2026

Summary

  • Introduces a centralized pinecone/adapters/ module for OpenAPI response transformations
  • Consolidates duplicated parse_query_response functions from 4+ files into single adapt_query_response()
  • Adds adapt_upsert_response() and adapt_fetch_response() adapters
  • Preserves backward compatibility via thin wrappers

Test plan

  • All 15 adapter unit tests pass
  • All existing unit tests pass (429 passed, 4 skipped due to asyncio deps)
  • Ruff linting passes
  • No new mypy errors introduced

Resolves: SDK-274

Made with Cursor


Note

Medium Risk
Touches core data-plane response transformation for query, fetch, and async upsert results; behavior should be unchanged but any mismatch in adapter logic could affect returned dataclasses or response metadata across clients.

Overview
Consolidates OpenAPI→SDK response parsing into a new pinecone/adapters layer. Adds adapt_query_response, adapt_fetch_response, and adapt_upsert_response, plus an UpsertResponseTransformer wrapper for async ApplyResult.

Updates sync/async index and vector resources to use these shared adapters and replaces duplicated parsing code, while keeping existing parse_query_response as deprecated pass-through wrappers for backward compatibility.

Adds unit test coverage and new OpenAPI response fixtures to validate adapter behavior (namespace handling, usage, deprecated field cleanup, and response metadata extraction).

Written by Cursor Bugbot for commit 716b744. This will update automatically on new commits. Configure here.

Consolidate duplicated parse_query_response and response transformation
logic into a centralized pinecone/adapters module. This introduces:

- adapt_query_response() - Convert OpenAPI QueryResponse to SDK type
- adapt_upsert_response() - Convert OpenAPI UpsertResponse to SDK type
- adapt_fetch_response() - Convert OpenAPI FetchResponse to SDK type

The adapter functions replace 4+ copies of identical transformation
logic that was scattered across index.py, index_asyncio.py, and
resource modules. Original parse_query_response functions are preserved
as thin wrappers for backward compatibility.

Also adds:
- Unit tests for all adapter functions (15 tests)
- Test fixtures for OpenAPI response models

Co-authored-by: Cursor <cursoragent@cursor.com>
Move UpsertResponseTransformer class from db_data/index.py and
db_data/resources/sync/vector.py to the adapters module. This addresses
the code review feedback about duplicated class definitions.

Both files now import UpsertResponseTransformer from the centralized
adapters module instead of defining their own copies.

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

The extract_response_metadata utility function is only used internally
within response_adapters.py and should not be part of the public API
surface. Removed it from __all__ exports in pinecone/adapters/__init__.py.

Co-authored-by: Cursor <cursoragent@cursor.com>
@jhamon jhamon merged commit 8069bf8 into main Feb 3, 2026
43 checks passed
@jhamon jhamon deleted the jhamon/sdk-274-phase-2a-response-adapter-consolidation branch February 3, 2026 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants