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: Fixed namespace missing in _async_fetch_metadata inside Pinecone #490

Merged
merged 2 commits into from
Dec 17, 2024

Conversation

Vits-99
Copy link
Collaborator

@Vits-99 Vits-99 commented Dec 17, 2024

User description

Fixed missing namespace param inside the request for getting all routes asynchronously with PineconeIndex


PR Type

Bug fix


Description

  • Fixed an issue where the namespace parameter was missing in the _async_fetch_metadata method of the Pinecone integration.
  • Added logic to include the namespace parameter in the request if it is defined.

Changes walkthrough 📝

Relevant files
Bug fix
pinecone.py
Fix missing `namespace` parameter in `_async_fetch_metadata` method

semantic_router/index/pinecone.py

  • Added a check for self.namespace in the _async_fetch_metadata method.
  • Included the namespace parameter in the request if it exists.
  • +3/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @Vits-99 Vits-99 added the bug Something isn't working label Dec 17, 2024
    @Vits-99 Vits-99 requested a review from jamescalam December 17, 2024 14:30
    @Vits-99 Vits-99 self-assigned this Dec 17, 2024
    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

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

    Possible Bug
    Ensure that the namespace parameter is correctly handled and passed in all relevant scenarios. Verify that the logic for checking self.namespace is robust and does not introduce unintended behavior.

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Validate the existence of self.namespace before using it to prevent runtime errors

    Ensure that self.namespace is properly initialized or validated before being used in
    the condition to avoid potential runtime errors if it is undefined or has an
    unexpected value.

    semantic_router/index/pinecone.py [656-657]

    -if self.namespace:
    +if hasattr(self, 'namespace') and self.namespace:
         params["namespace"] = self.namespace
    Suggestion importance[1-10]: 8

    Why: The suggestion ensures that self.namespace is checked for existence using hasattr before being accessed, which can prevent potential runtime errors if self.namespace is not defined. This is a significant improvement in terms of robustness and error handling.

    8

    Copy link

    codecov bot commented Dec 17, 2024

    Codecov Report

    Attention: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.

    Project coverage is 73.77%. Comparing base (28d6931) to head (6320f6d).
    Report is 4 commits behind head on main.

    Files with missing lines Patch % Lines
    semantic_router/index/pinecone.py 0.00% 2 Missing ⚠️
    Additional details and impacted files
    @@            Coverage Diff             @@
    ##             main     #490      +/-   ##
    ==========================================
    - Coverage   73.78%   73.77%   -0.02%     
    ==========================================
      Files          43       43              
      Lines        3594     3596       +2     
    ==========================================
    + Hits         2652     2653       +1     
    - Misses        942      943       +1     

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

    @Vits-99 Vits-99 changed the title Fixed namespace missing in _async_fetch_metadata inside Pinecone fix: Fixed namespace missing in _async_fetch_metadata inside Pinecone Dec 17, 2024
    @Vits-99 Vits-99 merged commit 26cb074 into main Dec 17, 2024
    6 of 9 checks passed
    @Vits-99 Vits-99 deleted the vittorio/fix-namespace-aget-routes branch December 17, 2024 16:13
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    bug Something isn't working Review effort [1-5]: 2
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants