diff --git a/.coveragerc b/.coveragerc index 901d7921..81253e41 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,4 +5,4 @@ omit = [report] show_missing = true -fail_under = 84 \ No newline at end of file +fail_under = 82 diff --git a/CHANGELOG.md b/CHANGELOG.md index 527cd5f4..78c69f10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## [0.4.1](https://github.com/googleapis/langchain-google-alloydb-pg-python/compare/v0.4.0...v0.4.1) (2024-06-27) + + +### Bug Fixes + +* Change IVFFlat `list` default to 100 ([#165](https://github.com/googleapis/langchain-google-alloydb-pg-python/issues/165)) ([f4d9b42](https://github.com/googleapis/langchain-google-alloydb-pg-python/commit/f4d9b4204a465ef10d5cc23d1fd6ce349fb22a21)) +* Use lazy refresh for AlloyDB Connector ([#162](https://github.com/googleapis/langchain-google-alloydb-pg-python/issues/162)) ([3a9c6ac](https://github.com/googleapis/langchain-google-alloydb-pg-python/commit/3a9c6acb2e368a099267c9e45acb86ef38195f7a)) + ## [0.4.0](https://github.com/googleapis/langchain-google-alloydb-pg-python/compare/v0.3.0...v0.4.0) (2024-06-18) diff --git a/pyproject.toml b/pyproject.toml index e5bc55d7..c3e00838 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ authors = [ {name = "Google LLC", email = "googleapis-packages@google.com"} ] dependencies = [ - "google-cloud-alloydb-connector[asyncpg]>=1.0.0, <2.0.0", + "google-cloud-alloydb-connector[asyncpg]>=1.2.0, <2.0.0", "langchain-core>=0.1.1, <1.0.0", "langchain-community>=0.0.18, <1.0.0", "numpy>=1.24.4, <2.0.0", @@ -42,7 +42,7 @@ Changelog = "https://github.com/googleapis/langchain-google-alloydb-pg-python/bl test = [ "black[jupyter]==24.4.2", "isort==5.13.2", - "mypy==1.10.0", + "mypy==1.10.1", "pytest-asyncio==0.23.7", "pytest==8.2.2", "pytest-cov==5.0.0" diff --git a/requirements.txt b/requirements.txt index 94a76a45..535ce271 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ -google-cloud-alloydb-connector[asyncpg]==1.1.2 -langchain-core==0.2.8 -langchain-community==0.2.5 +google-cloud-alloydb-connector[asyncpg]==1.2.0 +langchain-core==0.2.10 +langchain-community==0.2.6 numpy===1.24.4; python_version <= "3.8" numpy==1.26.4; python_version > "3.8" -pgvector==0.2.5 -SQLAlchemy[asyncio]==2.0.30 +pgvector==0.3.0 +SQLAlchemy[asyncio]==2.0.31 diff --git a/src/langchain_google_alloydb_pg/alloydb_engine.py b/src/langchain_google_alloydb_pg/alloydb_engine.py index 9e0471fd..f0d4e272 100644 --- a/src/langchain_google_alloydb_pg/alloydb_engine.py +++ b/src/langchain_google_alloydb_pg/alloydb_engine.py @@ -32,7 +32,7 @@ import aiohttp import google.auth # type: ignore import google.auth.transport.requests # type: ignore -from google.cloud.alloydb.connector import AsyncConnector, IPTypes +from google.cloud.alloydb.connector import AsyncConnector, IPTypes, RefreshStrategy from sqlalchemy import MetaData, RowMapping, Table, text from sqlalchemy.exc import InvalidRequestError from sqlalchemy.ext.asyncio import AsyncEngine, create_async_engine @@ -167,7 +167,9 @@ async def _create( ) if cls._connector is None: - cls._connector = AsyncConnector(user_agent=USER_AGENT) + cls._connector = AsyncConnector( + user_agent=USER_AGENT, refresh_strategy=RefreshStrategy.LAZY + ) # if user and password are given, use basic auth if user and password: diff --git a/src/langchain_google_alloydb_pg/indexes.py b/src/langchain_google_alloydb_pg/indexes.py index a2e154ce..4fcd3a7a 100644 --- a/src/langchain_google_alloydb_pg/indexes.py +++ b/src/langchain_google_alloydb_pg/indexes.py @@ -87,7 +87,7 @@ def to_string(self) -> str: @dataclass class IVFFlatIndex(BaseIndex): index_type: str = "ivfflat" - lists: int = 1 + lists: int = 100 def index_options(self) -> str: return f"(lists = {self.lists})" diff --git a/src/langchain_google_alloydb_pg/version.py b/src/langchain_google_alloydb_pg/version.py index 8b521633..ed7a893a 100644 --- a/src/langchain_google_alloydb_pg/version.py +++ b/src/langchain_google_alloydb_pg/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "0.4.0" +__version__ = "0.4.1"