fix(agent): legg til vertexai.init() — ADK må initialiseras eksplisitt for Cloud Run
This commit is contained in:
parent
294f455d67
commit
9627da37ae
|
|
@ -13,6 +13,7 @@ import google.auth
|
||||||
import google.auth.transport.requests
|
import google.auth.transport.requests
|
||||||
from typing import Literal
|
from typing import Literal
|
||||||
|
|
||||||
|
import vertexai
|
||||||
from google.adk.agents import Agent
|
from google.adk.agents import Agent
|
||||||
from google.adk.tools import FunctionTool
|
from google.adk.tools import FunctionTool
|
||||||
from google.adk.runners import Runner
|
from google.adk.runners import Runner
|
||||||
|
|
@ -22,7 +23,10 @@ from google.genai import types
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
PROJECT_ID = os.environ.get("GOOGLE_CLOUD_PROJECT", "propane-will-491900-m5")
|
PROJECT_ID = os.environ.get("GOOGLE_CLOUD_PROJECT", "propane-will-491900-m5")
|
||||||
LOCATION = os.environ.get("GOOGLE_CLOUD_LOCATION", "global")
|
LOCATION = os.environ.get("GOOGLE_CLOUD_LOCATION", "us-central1")
|
||||||
|
|
||||||
|
# Initialiser Vertex AI eksplisitt — ADK krev dette for Cloud Run
|
||||||
|
vertexai.init(project=PROJECT_ID, location=LOCATION)
|
||||||
|
|
||||||
ORCHESTRATOR_MODEL = os.environ.get("ORCHESTRATOR_MODEL", "gemini-2.5-flash")
|
ORCHESTRATOR_MODEL = os.environ.get("ORCHESTRATOR_MODEL", "gemini-2.5-flash")
|
||||||
SUBAGENT_MODEL = os.environ.get("SUBAGENT_MODEL", "gemini-2.5-flash")
|
SUBAGENT_MODEL = os.environ.get("SUBAGENT_MODEL", "gemini-2.5-flash")
|
||||||
|
|
@ -65,7 +69,7 @@ create_bq_table_if_not_exists()
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# OPAX MCP Client (inlina)
|
# OPAX MCP Client (inlina)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
_OPAX_MCP_URL = os.environ.get("MCP_SERVER_URL", "https://opax-mcp-zjbqp3prqq-uc.a.run.app")
|
_OPAX_MCP_URL = os.environ.get("MCP_SERVER_URL", "https://opax-mcp-357036551735.us-central1.run.app")
|
||||||
_MCP_SECRET = os.environ.get("MCP_SECRET", "")
|
_MCP_SECRET = os.environ.get("MCP_SECRET", "")
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user