Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ dependencies = [
"numpy>=1.24.4, <=2.2.6; python_version == '3.10'",
"numpy>=1.24.4, <=2.0.2; python_version <= '3.9'",
"langchain-postgres>=0.0.16",
"langgraph-checkpoint>=2.0.9, <3.0.0",
"langgraph-checkpoint>=2.0.9, <4.0.0",
"aiohttp>=3.12.15, <4.0.0",
]

Expand All @@ -41,7 +41,7 @@ Changelog = "https://github.com/googleapis/langchain-google-alloydb-pg-python/bl

[project.optional-dependencies]
langgraph = [
"langgraph-checkpoint>=2.0.9, <3.0.0"
"langgraph-checkpoint>=2.0.9, <4.0.0"
]
test = [
"black[jupyter]==25.9.0",
Expand Down
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
google-cloud-alloydb-connector[asyncpg]==1.9.1
google-cloud-storage==3.4.1
numpy==2.3.4; python_version >= "3.11"
google-cloud-alloydb-connector[asyncpg]==1.11.0
google-cloud-storage==3.7.0
numpy==2.3.5; python_version >= "3.11"
numpy==2.2.6; python_version == "3.10"
numpy==2.0.2; python_version <= "3.9"
langgraph==0.6.10
langgraph==1.0.4
langchain-postgres==0.0.16
45 changes: 28 additions & 17 deletions tests/test_model_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,45 @@ async def model_manager(self, engine):
model_manager = await AlloyDBModelManager.create(engine)
yield model_manager

async def test_model_manager_constructor(self, engine):
with pytest.raises(Exception):
AlloyDBModelManager(engine=engine)

async def test_acreate_model(self, model_manager):
@pytest_asyncio.fixture(scope="function")
async def model(self, model_manager):
model_id = "text-embedding-005" + str(uuid.uuid4()).replace("-", "_")
await model_manager.acreate_model(
model_id=EMBEDDING_MODEL_NAME,
model_id=model_id,
model_provider="google",
model_qualified_name="text-embedding-005",
model_type="text_embedding",
)
try:
yield model_manager, model_id
finally:
await model_manager.adrop_model(model_id=model_id)

async def test_model_manager_constructor(self, engine):
with pytest.raises(Exception):
AlloyDBModelManager(engine=engine)

@pytest.mark.depends(on=["test_acreate_model"])
async def test_aget_model(self, model_manager):
model_info = await model_manager.aget_model(model_id=EMBEDDING_MODEL_NAME)
assert model_info.model_id == EMBEDDING_MODEL_NAME
async def test_acreate_model(self, model):
pass

async def test_aget_model(self, model):
model_manager, model_id = model
model_info = await model_manager.aget_model(model_id=model_id)
assert model_info.model_id == model_id

async def test_non_existent_model(self, model_manager):
model_info = await model_manager.aget_model(model_id="Non_existent_model")
assert model_info is None

@pytest.mark.depends(on=["test_aget_model"])
async def test_alist_models(self, model_manager):
async def test_alist_models(self, model):
model_manager, model_id = model
models_list = await model_manager.alist_models()
assert len(models_list) >= 3
assert len(models_list) >= 1
model_ids = [model_info.model_id for model_info in models_list]
assert EMBEDDING_MODEL_NAME in model_ids
assert model_id in model_ids

@pytest.mark.depends(on=["test_alist_models"])
async def test_adrop_model(self, model_manager):
await model_manager.adrop_model(model_id=EMBEDDING_MODEL_NAME)
async def test_adrop_model(self, model):
model_manager, model_id = model
await model_manager.adrop_model(model_id=model_id)
model_info = await model_manager.aget_model(model_id=model_id)
assert model_info is None