From 61a2eba081da8c82296b6c16d1f16ade8caa2ca4 Mon Sep 17 00:00:00 2001 From: Max Jakob Date: Fri, 8 Mar 2024 04:38:31 +0100 Subject: [PATCH] elasticsearch[patch]: add top-level import, remove obsolete dependency (#18644) Make `ElasticsearchRetriever` available as top-level import. The `langchain` package depends on `langchain-community` so we do not need to depend on it explicitly. --- .../langchain_elasticsearch/__init__.py | 2 ++ libs/partners/elasticsearch/poetry.lock | 27 +++++++++---------- libs/partners/elasticsearch/pyproject.toml | 1 - .../tests/unit_tests/test_imports.py | 1 + 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/libs/partners/elasticsearch/langchain_elasticsearch/__init__.py b/libs/partners/elasticsearch/langchain_elasticsearch/__init__.py index bba1f3f6260..d98781bc9a0 100644 --- a/libs/partners/elasticsearch/langchain_elasticsearch/__init__.py +++ b/libs/partners/elasticsearch/langchain_elasticsearch/__init__.py @@ -1,5 +1,6 @@ from langchain_elasticsearch.chat_history import ElasticsearchChatMessageHistory from langchain_elasticsearch.embeddings import ElasticsearchEmbeddings +from langchain_elasticsearch.retrievers import ElasticsearchRetriever from langchain_elasticsearch.vectorstores import ( ApproxRetrievalStrategy, ElasticsearchStore, @@ -11,6 +12,7 @@ __all__ = [ "ApproxRetrievalStrategy", "ElasticsearchChatMessageHistory", "ElasticsearchEmbeddings", + "ElasticsearchRetriever", "ElasticsearchStore", "ExactRetrievalStrategy", "SparseRetrievalStrategy", diff --git a/libs/partners/elasticsearch/poetry.lock b/libs/partners/elasticsearch/poetry.lock index de9f74eca1f..5ad6c8e6dab 100644 --- a/libs/partners/elasticsearch/poetry.lock +++ b/libs/partners/elasticsearch/poetry.lock @@ -647,28 +647,26 @@ version = "0.0.25" description = "Community contributed LangChain integrations." optional = false python-versions = ">=3.8.1,<4.0" -files = [] -develop = true +files = [ + {file = "langchain_community-0.0.25-py3-none-any.whl", hash = "sha256:09b931ba710b1a10e449396d59f38575e0554acd527287937c33a2c4abdc6d83"}, + {file = "langchain_community-0.0.25.tar.gz", hash = "sha256:b6c8c14cd6ec2635e51e3974bf78a8de3b959bbedb4af55aad164f8cf392f0c5"}, +] [package.dependencies] -aiohttp = "^3.8.3" -dataclasses-json = ">= 0.5.7, < 0.7" -langchain-core = "^0.1.28" -langsmith = "^0.1.0" -numpy = "^1" +aiohttp = ">=3.8.3,<4.0.0" +dataclasses-json = ">=0.5.7,<0.7" +langchain-core = ">=0.1.28,<0.2.0" +langsmith = ">=0.1.0,<0.2.0" +numpy = ">=1,<2" PyYAML = ">=5.3" -requests = "^2" +requests = ">=2,<3" SQLAlchemy = ">=1.4,<3" -tenacity = "^8.1.0" +tenacity = ">=8.1.0,<9.0.0" [package.extras] cli = ["typer (>=0.9.0,<0.10.0)"] extended-testing = ["aiosqlite (>=0.19.0,<0.20.0)", "aleph-alpha-client (>=2.15.0,<3.0.0)", "anthropic (>=0.3.11,<0.4.0)", "arxiv (>=1.4,<2.0)", "assemblyai (>=0.17.0,<0.18.0)", "atlassian-python-api (>=3.36.0,<4.0.0)", "azure-ai-documentintelligence (>=1.0.0b1,<2.0.0)", "beautifulsoup4 (>=4,<5)", "bibtexparser (>=1.4.0,<2.0.0)", "cassio (>=0.1.0,<0.2.0)", "chardet (>=5.1.0,<6.0.0)", "cohere (>=4,<5)", "databricks-vectorsearch (>=0.21,<0.22)", "datasets (>=2.15.0,<3.0.0)", "dgml-utils (>=0.3.0,<0.4.0)", "elasticsearch (>=8.12.0,<9.0.0)", "esprima (>=4.0.1,<5.0.0)", "faiss-cpu (>=1,<2)", "feedparser (>=6.0.10,<7.0.0)", "fireworks-ai (>=0.9.0,<0.10.0)", "geopandas (>=0.13.1,<0.14.0)", "gitpython (>=3.1.32,<4.0.0)", "google-cloud-documentai (>=2.20.1,<3.0.0)", "gql (>=3.4.1,<4.0.0)", "gradientai (>=1.4.0,<2.0.0)", "hdbcli (>=2.19.21,<3.0.0)", "hologres-vector (>=0.0.6,<0.0.7)", "html2text (>=2020.1.16,<2021.0.0)", "httpx (>=0.24.1,<0.25.0)", "javelin-sdk (>=0.1.8,<0.2.0)", "jinja2 (>=3,<4)", "jq (>=1.4.1,<2.0.0)", "jsonschema (>1)", "lxml (>=4.9.2,<5.0.0)", "markdownify (>=0.11.6,<0.12.0)", "motor (>=3.3.1,<4.0.0)", "msal (>=1.25.0,<2.0.0)", "mwparserfromhell (>=0.6.4,<0.7.0)", "mwxml (>=0.3.3,<0.4.0)", "newspaper3k (>=0.2.8,<0.3.0)", "numexpr (>=2.8.6,<3.0.0)", "nvidia-riva-client (>=2.14.0,<3.0.0)", "oci (>=2.119.1,<3.0.0)", "openai (<2)", "openapi-pydantic (>=0.3.2,<0.4.0)", "oracle-ads (>=2.9.1,<3.0.0)", "pandas (>=2.0.1,<3.0.0)", "pdfminer-six (>=20221105,<20221106)", "pgvector (>=0.1.6,<0.2.0)", "praw (>=7.7.1,<8.0.0)", "psychicapi (>=0.8.0,<0.9.0)", "py-trello (>=0.19.0,<0.20.0)", "pymupdf (>=1.22.3,<2.0.0)", "pypdf (>=3.4.0,<4.0.0)", "pypdfium2 (>=4.10.0,<5.0.0)", "pyspark (>=3.4.0,<4.0.0)", "rank-bm25 (>=0.2.2,<0.3.0)", "rapidfuzz (>=3.1.1,<4.0.0)", "rapidocr-onnxruntime (>=1.3.2,<2.0.0)", "rdflib (==7.0.0)", "requests-toolbelt (>=1.0.0,<2.0.0)", "rspace_client (>=2.5.0,<3.0.0)", "scikit-learn (>=1.2.2,<2.0.0)", "sqlite-vss (>=0.1.2,<0.2.0)", "streamlit (>=1.18.0,<2.0.0)", "sympy (>=1.12,<2.0)", "telethon (>=1.28.5,<2.0.0)", "timescale-vector (>=0.0.1,<0.0.2)", "tqdm (>=4.48.0)", "tree-sitter (>=0.20.2,<0.21.0)", "tree-sitter-languages (>=1.8.0,<2.0.0)", "upstash-redis (>=0.15.0,<0.16.0)", "xata (>=1.0.0a7,<2.0.0)", "xmltodict (>=0.13.0,<0.14.0)", "zhipuai (>=1.0.7,<2.0.0)"] -[package.source] -type = "directory" -url = "../../community" - [[package]] name = "langchain-core" version = "0.1.29" @@ -1252,7 +1250,6 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, - {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -1672,4 +1669,4 @@ multidict = ">=4.0" [metadata] lock-version = "2.0" python-versions = ">=3.8.1,<4.0" -content-hash = "7521bf553cf55c1883bcf93e79103bc6136ccba901bb8277af24f1539d8c8bce" +content-hash = "5475c831b3bcde3a804f1528e2ad2028e7cfb7981dc8790081d66aa8a3769460" diff --git a/libs/partners/elasticsearch/pyproject.toml b/libs/partners/elasticsearch/pyproject.toml index 0fbbc9d6ec0..84e79ba6dc0 100644 --- a/libs/partners/elasticsearch/pyproject.toml +++ b/libs/partners/elasticsearch/pyproject.toml @@ -27,7 +27,6 @@ syrupy = "^4.0.2" pytest-watcher = "^0.3.4" pytest-asyncio = "^0.21.1" langchain = { path = "../../langchain", develop = true } -langchain-community = { path = "../../community", develop = true } langchain-core = { path = "../../core", develop = true } langchain-text-splitters = {path = "../../text-splitters", develop = true} diff --git a/libs/partners/elasticsearch/tests/unit_tests/test_imports.py b/libs/partners/elasticsearch/tests/unit_tests/test_imports.py index 915ba491788..2346ab99ad5 100644 --- a/libs/partners/elasticsearch/tests/unit_tests/test_imports.py +++ b/libs/partners/elasticsearch/tests/unit_tests/test_imports.py @@ -4,6 +4,7 @@ EXPECTED_ALL = [ "ApproxRetrievalStrategy", "ElasticsearchChatMessageHistory", "ElasticsearchEmbeddings", + "ElasticsearchRetriever", "ElasticsearchStore", "ExactRetrievalStrategy", "SparseRetrievalStrategy",