You've already forked adk-python
mirror of
https://github.com/encounter/adk-python.git
synced 2026-03-30 10:57:20 -07:00
fix: Add vertexai initialization for code being deployed to AgentEngine
Co-authored-by: Yeesian Ng <ysian@google.com> PiperOrigin-RevId: 832031219
This commit is contained in:
committed by
Copybara-Service
parent
ffbb0b37e1
commit
b8e4aedfbf
@@ -64,6 +64,8 @@ CMD adk {command} --port={port} {host_option} {service_option} {trace_to_cloud_o
|
||||
"""
|
||||
|
||||
_AGENT_ENGINE_APP_TEMPLATE: Final[str] = """
|
||||
import os
|
||||
import vertexai
|
||||
from vertexai.agent_engines import AdkApp
|
||||
|
||||
if {is_config_agent}:
|
||||
@@ -78,9 +80,12 @@ else:
|
||||
from .agent import {adk_app_object}
|
||||
|
||||
if {express_mode}: # Whether or not to use Express Mode
|
||||
import os
|
||||
import vertexai
|
||||
vertexai.init(api_key=os.environ.get("GOOGLE_API_KEY"))
|
||||
else:
|
||||
vertexai.init(
|
||||
project=os.environ.get("GOOGLE_CLOUD_PROJECT"),
|
||||
location=os.environ.get("GOOGLE_CLOUD_LOCATION"),
|
||||
)
|
||||
|
||||
adk_app = AdkApp(
|
||||
{adk_app_type}={adk_app_object},
|
||||
|
||||
Reference in New Issue
Block a user