Skip to content

Commit bdfdeb1

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
fix: Fix log showing how to get an Agent Engine. Positional arguments are not allowed.
PiperOrigin-RevId: 822269101
1 parent db286c4 commit bdfdeb1

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

tests/unit/vertexai/genai/test_agent_engines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ def test_create_agent_engine(self, mock_await_operation, mock_prepare, caplog):
12631263
assert "View progress and logs at" in caplog.text
12641264
assert "Agent Engine created. To use it in another session:" in caplog.text
12651265
assert (
1266-
f"agent_engine=client.agent_engines.get("
1266+
f"agent_engine=client.agent_engines.get(name="
12671267
f"'{_TEST_AGENT_ENGINE_RESOURCE_NAME}')" in caplog.text
12681268
)
12691269

@@ -1687,7 +1687,7 @@ def test_update_agent_engine_requirements(
16871687
assert "Agent Engine updated. To use it in another session:" in caplog.text
16881688
assert (
16891689
f"agent_engine=client.agent_engines.get("
1690-
f"'{_TEST_AGENT_ENGINE_RESOURCE_NAME}')" in caplog.text
1690+
f"name='{_TEST_AGENT_ENGINE_RESOURCE_NAME}')" in caplog.text
16911691
)
16921692

16931693
@mock.patch.object(_agent_engines_utils, "_prepare")

vertexai/_genai/agent_engines.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ def create(
895895
if agent_engine.api_resource:
896896
logger.info("Agent Engine created. To use it in another session:")
897897
logger.info(
898-
f"agent_engine=client.agent_engines.get('{agent_engine.api_resource.name}')"
898+
f"agent_engine=client.agent_engines.get(name='{agent_engine.api_resource.name}')"
899899
)
900900
elif operation.error:
901901
raise RuntimeError(f"Failed to create Agent Engine: {operation.error}")
@@ -1313,7 +1313,7 @@ def update(
13131313
if agent_engine.api_resource:
13141314
logger.info("Agent Engine updated. To use it in another session:")
13151315
logger.info(
1316-
f"agent_engine=client.agent_engines.get('{agent_engine.api_resource.name}')"
1316+
f"agent_engine=client.agent_engines.get(name='{agent_engine.api_resource.name}')"
13171317
)
13181318
elif operation.error:
13191319
raise RuntimeError(f"Failed to update Agent Engine: {operation.error}")

0 commit comments

Comments
 (0)