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(langchain): use correct class names for pinecone vectorstore check #9875

Merged
merged 4 commits into from
Jul 25, 2024

Conversation

Yun-Kim
Copy link
Contributor

@Yun-Kim Yun-Kim commented Jul 19, 2024

Backports #9759 to 2.10.

This PR fixes the class names used to check for Pinecone vectorstore instances in the langchain integration. Previously the incorrect base class for all vectorstores was being used, which would mean all vectorstores would return true for this check.

Langchain has a tricky versioning system with tons of deprecations and removals (even between minor versions):

  • langchain<0.1: Uses the base langchain module to access langchain.vectorstores.Pinecone (note this indirectly imports from langchain_community.
  • langchain>=0.1: Uses the langchain_community module to access langchain_community.vectorstores.Pinecone
  • langchain>=0.1 but if users have langchain-pinecone installed: Uses langchain_pinecone module to access
    langchain_pinecone.vectorstores.Pinecone (deprecated, subclass of PineconeVectorStore) or
    langchain_pinecone.vectorstores.PineconeVectorStore.

We use the above information to use as the logic to check if an instance is a pinecone vectorstore.

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

#9759)

This PR fixes the class names used to check for `Pinecone` vectorstore
instances in the langchain integration. Previously the incorrect base
class for all vectorstores was being used, which would mean all
vectorstores would return true for this check.

Langchain has a tricky versioning system with tons of deprecations and
removals (even between minor versions):
- `langchain<0.1`: Uses the base `langchain` module to access
`langchain.vectorstores.Pinecone` (note this indirectly imports from
`langchain_community`.
- `langchain>=0.1`: Uses the `langchain_community` module to access
`langchain_community.vectorstores.Pinecone`
- `langchain>=0.1` but if users have `langchain-pinecone` installed:
Uses `langchain_pinecone` module to access
`langchain_pinecone.vectorstores.Pinecone` (deprecated, subclass of
`PineconeVectorStore`) or
`langchain_pinecone.vectorstores.PineconeVectorStore`.

We use the above information to use as the logic to check if an instance
is a pinecone vectorstore.

- [x] The PR description includes an overview of the change
- [x] The PR description articulates the motivation for the change
- [x] The change includes tests OR the PR description describes a
testing strategy
- [x] The PR description notes risks associated with the change, if any
- [x] Newly-added code is easy to change
- [x] The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- [x] The change includes or references documentation updates if
necessary
- [x] Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

- [x] Title is accurate
- [x] All changes are related to the pull request's stated goal
- [x] Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- [x] Testing strategy adequately addresses listed risks
- [x] Newly-added code is easy to change
- [x] Release note makes sense to a user of the library
- [x] If necessary, author has acknowledged and discussed the
performance implications of this PR as reported in the benchmarks PR
comment
- [x] Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
@Yun-Kim Yun-Kim requested review from a team as code owners July 19, 2024 11:14
@Yun-Kim Yun-Kim changed the title fix(langchain): use correct class names for pinecone vectorstore chec… fix(langchain): use correct class names for pinecone vectorstore check Jul 19, 2024
@datadog-dd-trace-py-rkomorn
Copy link

datadog-dd-trace-py-rkomorn bot commented Jul 19, 2024

Datadog Report

Branch report: yunkim/backport-9759-to-210
Commit report: ad8949c
Test service: dd-trace-py

✅ 0 Failed, 175422 Passed, 1904 Skipped, 12h 12m 16.76s Total duration (4m 54.61s time saved)

@pr-commenter
Copy link

pr-commenter bot commented Jul 19, 2024

Benchmarks

Benchmark execution time: 2024-07-25 18:12:59

Comparing candidate commit ad8949c in PR branch yunkim/backport-9759-to-210 with baseline commit 7e39ec5 in branch 2.10.

Found 0 performance improvements and 0 performance regressions! Performance is the same for 209 metrics, 9 unstable metrics.

@Yun-Kim Yun-Kim force-pushed the yunkim/backport-9759-to-210 branch from b060bb4 to 2372b8f Compare July 23, 2024 20:51
@Yun-Kim Yun-Kim enabled auto-merge (squash) July 25, 2024 14:33
@Yun-Kim Yun-Kim merged commit 8843cca into 2.10 Jul 25, 2024
159 of 169 checks passed
@Yun-Kim Yun-Kim deleted the yunkim/backport-9759-to-210 branch July 25, 2024 21:18
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.

3 participants