Skip to content

Commit 4e3336d

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
No public description
PiperOrigin-RevId: 814417092
1 parent da85725 commit 4e3336d

File tree

2 files changed

+24
-16
lines changed
  • vertexai
    • agent_engines/templates
    • preview/reasoning_engines/templates

2 files changed

+24
-16
lines changed

vertexai/agent_engines/templates/adk.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -555,15 +555,19 @@ def set_up(self):
555555
elif "GOOGLE_CLOUD_AGENT_ENGINE_ID" in os.environ and is_version_sufficient(
556556
"1.5.0"
557557
):
558-
from google.adk.memory.vertex_ai_memory_bank_service import (
559-
VertexAiMemoryBankService,
560-
)
558+
try:
559+
from google.adk.memory.vertex_ai_memory_bank_service import (
560+
VertexAiMemoryBankService,
561+
)
561562

562-
self._tmpl_attrs["memory_service"] = VertexAiMemoryBankService(
563-
project=project,
564-
location=location,
565-
agent_engine_id=os.environ.get("GOOGLE_CLOUD_AGENT_ENGINE_ID"),
566-
)
563+
self._tmpl_attrs["memory_service"] = VertexAiMemoryBankService(
564+
project=project,
565+
location=location,
566+
agent_engine_id=os.environ.get("GOOGLE_CLOUD_AGENT_ENGINE_ID"),
567+
)
568+
except ImportError:
569+
# TODO(ysian): Handle this via _g3 import for google3.
570+
pass
567571
else:
568572
self._tmpl_attrs["memory_service"] = InMemoryMemoryService()
569573

vertexai/preview/reasoning_engines/templates/adk.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -536,15 +536,19 @@ def set_up(self):
536536
elif "GOOGLE_CLOUD_AGENT_ENGINE_ID" in os.environ and is_version_sufficient(
537537
"1.5.0"
538538
):
539-
from google.adk.memory.vertex_ai_memory_bank_service import (
540-
VertexAiMemoryBankService,
541-
)
539+
try:
540+
from google.adk.memory.vertex_ai_memory_bank_service import (
541+
VertexAiMemoryBankService,
542+
)
542543

543-
self._tmpl_attrs["memory_service"] = VertexAiMemoryBankService(
544-
project=project,
545-
location=location,
546-
agent_engine_id=os.environ.get("GOOGLE_CLOUD_AGENT_ENGINE_ID"),
547-
)
544+
self._tmpl_attrs["memory_service"] = VertexAiMemoryBankService(
545+
project=project,
546+
location=location,
547+
agent_engine_id=os.environ.get("GOOGLE_CLOUD_AGENT_ENGINE_ID"),
548+
)
549+
except ImportError:
550+
# TODO(ysian): Handle this via _g3 import for google3.
551+
pass
548552
else:
549553
self._tmpl_attrs["memory_service"] = InMemoryMemoryService()
550554

0 commit comments

Comments
 (0)