Skip to content

Commit

Permalink
fix(langchain): use correct class names for pinecone vectorstore chec…
Browse files Browse the repository at this point in the history
…k [backport 2.9] (#9934)

Backport #9759 to 2.9.

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 d92891f commit bc36858
Show file tree
Hide file tree
Showing 19 changed files with 492 additions and 167 deletions.
38 changes: 19 additions & 19 deletions .riot/requirements/1084a71.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,66 +11,66 @@ 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.2
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.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
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
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/fa757b7.in
# pip-compile --no-annotate .riot/requirements/1108e76.in
#
ai21==2.9.2
ai21-tokenizer==0.11.2
Expand All @@ -11,15 +11,16 @@ aiosignal==1.3.1
annotated-types==0.7.0
anyio==4.4.0
attrs==23.2.0
boto3==1.34.145
botocore==1.34.145
boto3==1.34.148
botocore==1.34.148
certifi==2024.7.4
charset-normalizer==3.3.2
cohere==5.4.0
coverage[toml]==7.6.0
dataclasses-json==0.6.7
distro==1.9.0
exceptiongroup==1.2.2
faiss-cpu==1.8.0
fastavro==1.9.5
filelock==3.15.4
frozenlist==1.4.1
Expand All @@ -29,7 +30,7 @@ h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
httpx-sse==0.4.0
huggingface-hub==0.24.0
huggingface-hub==0.24.2
hypothesis==6.45.0
idna==3.7
iniconfig==2.0.0
Expand All @@ -44,7 +45,7 @@ langchain-core==0.1.52
langchain-openai==0.1.6
langchain-pinecone==0.1.0
langchain-text-splitters==0.0.2
langsmith==0.1.92
langsmith==0.1.93
marshmallow==3.21.3
mock==5.1.0
multidict==6.0.5
Expand All @@ -60,14 +61,14 @@ pluggy==1.5.0
psutil==6.0.0
pydantic==2.8.2
pydantic-core==2.20.1
pytest==8.2.2
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
68 changes: 35 additions & 33 deletions .riot/requirements/14d34ef.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,93 +4,95 @@
#
# pip-compile --no-annotate .riot/requirements/14d34ef.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.148
botocore==1.34.148
certifi==2024.7.4
charset-normalizer==3.3.2
cohere==5.5.6
coverage[toml]==7.5.3
cohere==5.6.2
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.2
hypothesis==6.45.0
idna==3.7
importlib-metadata==7.1.0
importlib-metadata==8.2.0
iniconfig==2.0.0
jiter==0.4.1
jiter==0.5.0
jmespath==1.0.1
jsonpatch==1.33
jsonpointer==2.4
jsonpointer==3.0.0
langchain==0.2.0
langchain-anthropic==0.1.13
langchain-aws==0.1.6
langchain-cohere==0.1.5
langchain-cohere==0.1.8
langchain-core==0.2.0
langchain-openai==0.1.7
langchain-pinecone==0.1.1
langchain-pinecone==0.1.3
langchain-text-splitters==0.2.1
langsmith==0.1.75
langsmith==0.1.93
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.37.0
opentracing==2.4.0
orjson==3.10.4
orjson==3.10.6
packaging==23.2
parameterized==0.9.0
pinecone-client==3.2.2
pinecone-client==5.0.0
pinecone-plugin-inference==1.0.2
pinecone-plugin-interface==0.0.7
pluggy==1.5.0
psutil==5.9.8
pydantic==2.7.3
pydantic-core==2.18.4
pytest==8.2.2
psutil==6.0.0
pydantic==2.8.2
pydantic-core==2.20.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.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
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.31.0.6
types-urllib3==1.26.25.14
typing-extensions==4.12.2
typing-inspect==0.9.0
urllib3==1.26.18
urllib3==1.26.19
vcrpy==6.0.1
wrapt==1.16.0
yarl==1.9.4
Expand Down
Loading

0 comments on commit bc36858

Please sign in to comment.