Skip to content

Commit

Permalink
fix(langchain): use correct class names for pinecone vectorstore check (
Browse files Browse the repository at this point in the history
#9875)

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
- [x] 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](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [x] 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](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
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](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
Yun-Kim authored Jul 25, 2024
1 parent 7e39ec5 commit 8843cca
Show file tree
Hide file tree
Showing 20 changed files with 622 additions and 279 deletions.
36 changes: 18 additions & 18 deletions .riot/requirements/1084a71.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,46 +11,46 @@ anyio==4.4.0
async-timeout==4.0.3
attrs==23.2.0
backoff==2.2.1
certifi==2024.2.2
certifi==2024.7.4
charset-normalizer==3.3.2
cohere==4.57
coverage[toml]==7.5.3
coverage[toml]==7.6.0
dataclasses-json==0.5.14
dnspython==2.6.1
exceptiongroup==1.2.1
fastavro==1.9.4
filelock==3.14.0
exceptiongroup==1.2.2
fastavro==1.9.5
filelock==3.15.4
frozenlist==1.4.1
fsspec==2024.5.0
fsspec==2024.6.1
greenlet==3.0.3
huggingface-hub==0.23.2
huggingface-hub==0.24.0
hypothesis==6.45.0
idna==3.7
importlib-metadata==6.11.0
iniconfig==2.0.0
jsonpatch==1.33
jsonpointer==2.4
jsonpointer==3.0.0
langchain==0.0.192
langchain-community==0.0.14
langchain-core==0.1.23
langchainplus-sdk==0.0.4
langsmith==0.0.87
loguru==0.7.2
marshmallow==3.21.2
marshmallow==3.21.3
mock==5.1.0
multidict==6.0.5
mypy-extensions==1.0.0
numexpr==2.10.0
numexpr==2.10.1
numpy==1.26.4
openai==0.27.8
openapi-schema-pydantic==1.2.4
opentracing==2.4.0
packaging==23.2
pinecone-client==2.2.4
pluggy==1.5.0
psutil==5.9.8
pydantic==1.10.15
pytest==8.2.1
psutil==6.0.0
pydantic==1.10.17
pytest==8.2.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
Expand All @@ -62,15 +62,15 @@ requests==2.32.3
six==1.16.0
sniffio==1.3.1
sortedcontainers==2.4.0
sqlalchemy==2.0.30
tenacity==8.3.0
sqlalchemy==2.0.31
tenacity==8.5.0
tiktoken==0.7.0
tomli==2.0.1
tqdm==4.66.4
typing-extensions==4.12.0
typing-extensions==4.12.2
typing-inspect==0.9.0
urllib3==2.2.1
urllib3==2.2.2
vcrpy==6.0.1
wrapt==1.16.0
yarl==1.9.4
zipp==3.19.0
zipp==3.19.2
85 changes: 46 additions & 39 deletions .riot/requirements/175c311.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,91 +4,98 @@
#
# pip-compile --no-annotate .riot/requirements/175c311.in
#
ai21==2.5.0
ai21-tokenizer==0.9.1
ai21==2.9.2
ai21-tokenizer==0.11.2
aiohttp==3.9.5
aiosignal==1.3.1
annotated-types==0.7.0
anthropic==0.28.0
anthropic==0.31.2
anyio==4.4.0
async-timeout==4.0.3
attrs==23.2.0
boto3==1.34.122
botocore==1.34.122
certifi==2024.6.2
boto3==1.34.145
botocore==1.34.145
certifi==2024.7.4
charset-normalizer==3.3.2
cohere==5.5.6
coverage[toml]==7.5.3
cohere==5.6.1
coverage[toml]==7.6.0
dataclasses-json==0.6.7
defusedxml==0.7.1
distro==1.9.0
exceptiongroup==1.2.1
fastavro==1.9.4
filelock==3.14.0
exceptiongroup==1.2.2
fastavro==1.9.5
filelock==3.15.4
frozenlist==1.4.1
fsspec==2024.6.0
fsspec==2024.6.1
greenlet==3.0.3
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.23.3
huggingface-hub==0.24.0
hypothesis==6.45.0
idna==3.7
iniconfig==2.0.0
jiter==0.4.1
jiter==0.5.0
jmespath==1.0.1
jsonpatch==1.33
jsonpointer==2.4
langchain==0.2.3
langchain-anthropic==0.1.15
langchain-aws==0.1.6
langchain-cohere==0.1.5
langchain-community==0.2.4
langchain-core==0.2.5
langchain-openai==0.1.8
langchain-pinecone==0.1.1
langchain-text-splitters==0.2.1
langsmith==0.1.75
jsonpointer==3.0.0
langchain==0.2.9
langchain-anthropic==0.1.20
langchain-aws==0.1.11
langchain-cohere==0.1.9
langchain-community==0.2.7
langchain-core==0.2.21
langchain-experimental==0.0.62
langchain-openai==0.1.17
langchain-pinecone==0.1.2
langchain-text-splitters==0.2.2
langsmith==0.1.92
marshmallow==3.21.3
mock==5.1.0
multidict==6.0.5
mypy-extensions==1.0.0
numexpr==2.10.0
numexpr==2.10.1
numpy==1.26.4
openai==1.33.0
openai==1.35.15
opentracing==2.4.0
orjson==3.10.4
packaging==23.2
orjson==3.10.6
packaging==24.1
pandas==2.2.2
parameterized==0.9.0
pinecone-client==3.2.2
pinecone-client==4.1.2
pinecone-plugin-interface==0.0.7
pluggy==1.5.0
psutil==5.9.8
pydantic==2.7.3
pydantic-core==2.18.4
psutil==6.0.0
pydantic==2.8.2
pydantic-core==2.20.1
pytest==8.2.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
python-dateutil==2.9.0.post0
pytz==2024.1
pyyaml==6.0.1
regex==2024.5.15
requests==2.32.3
s3transfer==0.10.1
s3transfer==0.10.2
sentencepiece==0.2.0
six==1.16.0
sniffio==1.3.1
sortedcontainers==2.4.0
sqlalchemy==2.0.30
tenacity==8.3.0
sqlalchemy==2.0.31
tabulate==0.9.0
tenacity==8.5.0
tiktoken==0.7.0
tokenizers==0.15.2
tokenizers==0.19.1
tomli==2.0.1
tqdm==4.66.4
types-requests==2.32.0.20240602
types-requests==2.32.0.20240712
typing-extensions==4.12.2
typing-inspect==0.9.0
urllib3==2.2.1
tzdata==2024.1
urllib3==2.2.2
vcrpy==6.0.1
wrapt==1.16.0
yarl==1.9.4
17 changes: 9 additions & 8 deletions .riot/requirements/1930a28.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with Python 3.11
# by the following command:
#
# pip-compile --no-annotate .riot/requirements/1930a28.in
# pip-compile --allow-unsafe --no-annotate .riot/requirements/1930a28.in
#
ai21==2.9.2
ai21-tokenizer==0.11.2
Expand All @@ -12,8 +12,8 @@ annotated-types==0.7.0
anthropic==0.31.2
anyio==4.4.0
attrs==23.2.0
boto3==1.34.147
botocore==1.34.147
boto3==1.34.148
botocore==1.34.148
certifi==2024.7.4
charset-normalizer==3.3.2
cohere==5.6.2
Expand All @@ -31,7 +31,7 @@ h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.24.1
huggingface-hub==0.24.2
hypothesis==6.45.0
idna==3.7
iniconfig==2.0.0
Expand All @@ -45,7 +45,7 @@ langchain-aws==0.1.6
langchain-cohere==0.1.8
langchain-core==0.2.0
langchain-openai==0.1.7
langchain-pinecone==0.1.2
langchain-pinecone==0.1.3
langchain-text-splitters==0.2.1
langsmith==0.1.93
marshmallow==3.21.3
Expand All @@ -59,20 +59,21 @@ opentracing==2.4.0
orjson==3.10.6
packaging==23.2
parameterized==0.9.0
pinecone-client==4.1.2
pinecone-client==5.0.0
pinecone-plugin-inference==1.0.2
pinecone-plugin-interface==0.0.7
pluggy==1.5.0
psutil==6.0.0
pydantic==2.8.2
pydantic-core==2.20.1
pytest==8.3.1
pytest==8.3.2
pytest-asyncio==0.21.1
pytest-cov==5.0.0
pytest-mock==3.14.0
pytest-randomly==3.15.0
python-dateutil==2.9.0.post0
pyyaml==6.0.1
regex==2024.5.15
regex==2024.7.24
requests==2.32.3
s3transfer==0.10.2
sentencepiece==0.2.0
Expand Down
Loading

0 comments on commit 8843cca

Please sign in to comment.