From 99f6af581cdb1c8c5f8f52163f65245c92f22b06 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Mon, 9 Dec 2024 22:44:43 +0000 Subject: [PATCH 1/2] chore(deps): update python-nonmajor --- pyproject.toml | 6 +++--- requirements.txt | 8 ++++---- samples/index_tuning_sample/requirements.txt | 6 +++--- samples/langchain_on_vertexai/requirements.txt | 8 ++++---- samples/requirements.txt | 8 ++++---- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index ce86aa38..67cea051 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,11 +39,11 @@ Changelog = "https://github.com/googleapis/langchain-google-cloud-sql-pg-python/ [project.optional-dependencies] test = [ - "black[jupyter]==24.8.0", + "black[jupyter]==24.10.0", "isort==5.13.2", - "mypy==1.11.2", + "mypy==1.13.0", "pytest-asyncio==0.24.0", - "pytest==8.3.3", + "pytest==8.3.4", "pytest-cov==6.0.0" ] diff --git a/requirements.txt b/requirements.txt index 2433a992..79e8db67 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ -cloud-sql-python-connector[asyncpg]==1.12.1 -langchain-core==0.3.8 +cloud-sql-python-connector[asyncpg]==1.14.0 +langchain-core==0.3.22 numpy==1.26.4 -pgvector==0.3.4 -SQLAlchemy[asyncio]==2.0.35 +pgvector==0.3.6 +SQLAlchemy[asyncio]==2.0.36 diff --git a/samples/index_tuning_sample/requirements.txt b/samples/index_tuning_sample/requirements.txt index 0f055624..1cf8776d 100644 --- a/samples/index_tuning_sample/requirements.txt +++ b/samples/index_tuning_sample/requirements.txt @@ -1,3 +1,3 @@ -langchain-community==0.2.19 -langchain-google-cloud-sql-pg==0.10.0 -langchain-google-vertexai==2.0.0 +langchain-community==0.3.10 +langchain-google-cloud-sql-pg==0.11.1 +langchain-google-vertexai==2.0.8 diff --git a/samples/langchain_on_vertexai/requirements.txt b/samples/langchain_on_vertexai/requirements.txt index 001d3bbe..9d0a69a7 100644 --- a/samples/langchain_on_vertexai/requirements.txt +++ b/samples/langchain_on_vertexai/requirements.txt @@ -1,5 +1,5 @@ -google-cloud-aiplatform[reasoningengine,langchain]==1.69.0 -google-cloud-resource-manager==1.12.5 -langchain-community==0.2.19 -langchain-google-cloud-sql-pg==0.10.0 +google-cloud-aiplatform[reasoningengine,langchain]==1.74.0 +google-cloud-resource-manager==1.13.1 +langchain-community==0.3.10 +langchain-google-cloud-sql-pg==0.11.1 langchain-google-vertexai==1.0.10 diff --git a/samples/requirements.txt b/samples/requirements.txt index 001d3bbe..9d0a69a7 100644 --- a/samples/requirements.txt +++ b/samples/requirements.txt @@ -1,5 +1,5 @@ -google-cloud-aiplatform[reasoningengine,langchain]==1.69.0 -google-cloud-resource-manager==1.12.5 -langchain-community==0.2.19 -langchain-google-cloud-sql-pg==0.10.0 +google-cloud-aiplatform[reasoningengine,langchain]==1.74.0 +google-cloud-resource-manager==1.13.1 +langchain-community==0.3.10 +langchain-google-cloud-sql-pg==0.11.1 langchain-google-vertexai==1.0.10 From 7a49d1435821defcdbfc720730b6a213399b32ef Mon Sep 17 00:00:00 2001 From: Averi Kitsch Date: Thu, 23 Jan 2025 08:39:14 -0800 Subject: [PATCH 2/2] fix tests --- tests/test_async_vectorstore_search.py | 4 +++- tests/test_vectorstore_search.py | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/test_async_vectorstore_search.py b/tests/test_async_vectorstore_search.py index d918415a..2d808dad 100644 --- a/tests/test_async_vectorstore_search.py +++ b/tests/test_async_vectorstore_search.py @@ -156,7 +156,9 @@ async def test_similarity_search_with_relevance_scores_threshold_cosine(self, vs results = await vs.asimilarity_search_with_relevance_scores( "foo", **score_threshold ) - assert len(results) == 4 + # Note: Since tests use FakeEmbeddings which are non-normalized vectors, results might have scores beyond the range [0,1]. + # For a normalized embedding service, a threshold of zero will yield all matched documents. + assert len(results) == 2 score_threshold = {"score_threshold": 0.02} results = await vs.asimilarity_search_with_relevance_scores( diff --git a/tests/test_vectorstore_search.py b/tests/test_vectorstore_search.py index f2c1cb17..3a0ca81a 100644 --- a/tests/test_vectorstore_search.py +++ b/tests/test_vectorstore_search.py @@ -170,7 +170,9 @@ async def test_similarity_search_with_relevance_scores_threshold_cosine(self, vs results = await vs.asimilarity_search_with_relevance_scores( "foo", **score_threshold ) - assert len(results) == 4 + # Note: Since tests use FakeEmbeddings which are non-normalized vectors, results might have scores beyond the range [0,1]. + # For a normalized embedding service, a threshold of zero will yield all matched documents. + assert len(results) == 2 score_threshold = {"score_threshold": 0.02} results = await vs.asimilarity_search_with_relevance_scores(