Skip to content

The agent engineering platform.

community[patch]: Test InMemoryVectorStore with RWAPI test suite (#23603)

Eugene Yurtsev68f348357e0c
diff --git a/libs/community/poetry.lock b/libs/community/poetry.lock
index 416797799f..0ddc9e96b4 100644
--- a/libs/community/poetry.lock
+++ b/libs/community/poetry.lock
@@ -1,4 +1,4 @@
-# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand.
+# This file is automatically @generated by Poetry 1.6.1 and should not be changed by hand.
[[package]]
name = "aiohttp"
@@ -2168,9 +2168,27 @@ tenacity = "^8.1.0,!=8.4.0"
type = "directory"
url = "../core"
+[[package]]
+name = "langchain-standard-tests"
+version = "0.1.1"
+description = "Standard tests for LangChain implementations"
+optional = false
+python-versions = ">=3.8.1,<4.0"
+files = []
+develop = true
+
+[package.dependencies]
+httpx = "^0.27.0"
+langchain-core = ">=0.1.40,<0.3"
+pytest = ">=7,<9"
+
+[package.source]
+type = "directory"
+url = "../standard-tests"
+
[[package]]
name = "langchain-text-splitters"
-version = "0.2.1"
+version = "0.2.2"
description = "LangChain text splitting utilities"
optional = false
python-versions = ">=3.8.1,<4.0"
@@ -2178,7 +2196,7 @@ files = []
develop = true
[package.dependencies]
-langchain-core = "^0.2.0"
+langchain-core = "^0.2.10"
[package.source]
type = "directory"
@@ -2923,6 +2941,7 @@ description = "Nvidia JIT LTO Library"
optional = false
python-versions = ">=3"
files = [
+ {file = "nvidia_nvjitlink_cu12-12.5.40-py3-none-manylinux2014_aarch64.whl", hash = "sha256:004186d5ea6a57758fd6d57052a123c73a4815adf365eb8dd6a85c9eaa7535ff"},
{file = "nvidia_nvjitlink_cu12-12.5.40-py3-none-manylinux2014_x86_64.whl", hash = "sha256:d9714f27c1d0f0895cd8915c07a87a1d0029a0aa36acaf9156952ec2a8a12189"},
{file = "nvidia_nvjitlink_cu12-12.5.40-py3-none-win_amd64.whl", hash = "sha256:c3401dc8543b52d3a8158007a0c1ab4e9c768fcbd24153a48c86972102197ddd"},
]
@@ -3768,7 +3787,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"},
@@ -5704,4 +5722,4 @@ test = ["big-O", "importlib-resources", "jaraco.functools", "jaraco.itertools",
[metadata]
lock-version = "2.0"
python-versions = ">=3.8.1,<4.0"
-content-hash = "94839ba308dafe3701a4a25425769a517dceaeb1b17ed6cbf9cf4fb7e73f727e"
+content-hash = "f1b57de3edad8c6d2c8be64ba76a4da4a7b14d6b5195aa9399ba00d917dbd5c9"
diff --git a/libs/community/pyproject.toml b/libs/community/pyproject.toml
index b25b7b1f87..7331a8b247 100644
--- a/libs/community/pyproject.toml
+++ b/libs/community/pyproject.toml
@@ -48,6 +48,7 @@ syrupy = "^4.0.2"
requests-mock = "^1.11.0"
langchain-core = { path = "../core", develop = true }
langchain = { path = "../langchain", develop = true }
+langchain-standard-tests = { path = "../standard-tests", develop = true }
[tool.poetry.group.codespell]
optional = true
diff --git a/libs/community/tests/unit_tests/test_dependencies.py b/libs/community/tests/unit_tests/test_dependencies.py
index c7af125ac1..e68f5e4fa6 100644
--- a/libs/community/tests/unit_tests/test_dependencies.py
+++ b/libs/community/tests/unit_tests/test_dependencies.py
@@ -78,6 +78,7 @@ def test_test_group_dependencies(poetry_conf: Mapping[str, Any]) -> None:
"duckdb-engine",
"freezegun",
"langchain-core",
+ "langchain-standard-tests",
"langchain",
"lark",
"pandas",
diff --git a/libs/community/tests/unit_tests/vectorstores/test_inmemory.py b/libs/community/tests/unit_tests/vectorstores/test_inmemory.py
index 72743b562f..10abe633f0 100644
--- a/libs/community/tests/unit_tests/vectorstores/test_inmemory.py
+++ b/libs/community/tests/unit_tests/vectorstores/test_inmemory.py
@@ -1,6 +1,11 @@
from pathlib import Path
+import pytest
from langchain_core.documents import Document
+from langchain_standard_tests.integration_tests.vectorstores import (
+ AsyncReadWriteTestSuite,
+ ReadWriteTestSuite,
+)
from langchain_community.vectorstores.inmemory import InMemoryVectorStore
from tests.integration_tests.vectorstores.fake_embeddings import (
@@ -8,6 +13,18 @@ from tests.integration_tests.vectorstores.fake_embeddings import (
)
+class TestInMemoryReadWriteTestSuite(ReadWriteTestSuite):
+ @pytest.fixture
+ def vectorstore(self) -> InMemoryVectorStore:
+ return InMemoryVectorStore(embedding=self.get_embeddings())
+
+
+class TestAsyncInMemoryReadWriteTestSuite(AsyncReadWriteTestSuite):
+ @pytest.fixture
+ async def vectorstore(self) -> InMemoryVectorStore:
+ return InMemoryVectorStore(embedding=self.get_embeddings())
+
+
async def test_inmemory() -> None:
"""Test end to end construction and search."""
store = await InMemoryVectorStore.afrom_texts(