Skip to content

Conversation

shinobi-josh
Copy link
Member

@shinobi-josh shinobi-josh commented Aug 4, 2025

PR Type

Enhancement


Description

  • Upgrade Pinecone SDK dependency to v7

  • Adapt client init to Pinecone v7 API

  • Update installation error message text

  • Adjust version spec in pyproject.toml


File Walkthrough

Relevant files
Enhancement
pinecone.py
Adapt Pinecone client to v7 API                                                   

semantic_router/index/pinecone.py

  • Import Pinecone and ServerlessSpec for v7 API
  • Update ImportError message to reference v7+
  • Remove extra blank line
+2/-5     
Dependencies
pyproject.toml
Bump Pinecone dependency to v7                                                     

pyproject.toml

  • Bump pinecone dependency to >=7.0.0,<8.0.0
+1/-1     

@shinobi-josh shinobi-josh requested a review from jamescalam August 4, 2025 11:47
@shinobi-josh shinobi-josh self-assigned this Aug 4, 2025
@shinobi-josh shinobi-josh added the enhancement Enhancement to existing features label Aug 4, 2025
Copy link

github-actions bot commented Aug 4, 2025

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Import Validation

Verify that from pinecone import Pinecone, ServerlessSpec and the instantiation via Pinecone(**pinecone_args) align with Pinecone SDK v7+, as class names or initialization APIs may have changed.

    from pinecone import Pinecone, ServerlessSpec
    self.ServerlessSpec = ServerlessSpec
except ImportError:
Error Message Consistency

Ensure the ImportError installation instructions match the updated dependency version constraints and correctly reference the new Pinecone SDK v7 package.

    "Please install the Pinecone SDK v7+ to use PineconeIndex. "
    "You can install it with: `pip install 'semantic-router[pinecone]'`"
)

Copy link

github-actions bot commented Aug 4, 2025

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
Possible issue
Conditionally include host parameter

Only include the host key when self.base_url is set to avoid passing None to the
Pinecone client, which could lead to connection errors. Move the host assignment
into a conditional block.

semantic_router/index/pinecone.py [252-256]

 pinecone_args = {
     "api_key": api_key,
     "source_tag": "semanticrouter",
-    "host": self.base_url,
 }
+if self.base_url:
+    pinecone_args["host"] = self.base_url
Suggestion importance[1-10]: 7

__

Why: Moving "host" into a conditional prevents passing None to Pinecone, avoiding potential connection errors when self.base_url isn’t set.

Medium
Add Pinecone version check

After importing, verify that the installed Pinecone SDK version is at least v7.0.0
and raise an informative error if not. This prevents silent failures when an
incompatible version is installed.

semantic_router/index/pinecone.py [245-246]

+import pinecone as _pinecone
 from pinecone import Pinecone, ServerlessSpec
 self.ServerlessSpec = ServerlessSpec
+version_tuple = tuple(map(int, _pinecone.__version__.split(".")))
+if version_tuple < (7, 0, 0):
+    raise ImportError(f"Pinecone SDK v7+ required, found v{_pinecone.__version__}")
Suggestion importance[1-10]: 5

__

Why: Adding a runtime check for pinecone.__version__ ensures SDK v7+ compatibility, though the pyproject already enforces this requirement.

Low

@shinobi-josh
Copy link
Member Author

note: we no longer use pinecone-client and instead is just pinecone

@shinobi-josh
Copy link
Member Author

All references to PINECONE_API_BASE_URL for Pinecone Local now use http://localhost:5080 (not http://pinecone:5080).

Comment on lines -52 to -56
POSTGRES_HOST: postgres
POSTGRES_PORT: 5432
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
Copy link
Member

@jamescalam jamescalam Aug 11, 2025

Choose a reason for hiding this comment

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

these are not needed by postgres in the tests?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes — not needed. In tests:
The Dagger job binds the Postgres service as postgres:5432.
.dagger/src/semantic_router_ci/main.py sets these envs inside the test container with sensible defaults:
POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=postgres
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres
Since we set them in the container with defaults, the workflow doesn’t need to pass them.
Kept the defaults in main.py and removed the redundant workflow-level Postgres envs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to existing features Review effort 1/5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants