fix: make discussion answering model configurable
Merge https://github.com/google/adk-python/pull/6113 ## Summary - Configure the discussion answering agents through `LLM_MODEL_NAME` instead of hardcoding `gemini-3.5-flash`. - Let the GitHub workflow override both the answering model and Vertex location with repository variables. - Downgrade the default model from `gemini-3.5-flash` to `gemini-2.5-flash` because `gemini-3.5-flash` 404s on Vertex AI Search (#6104). - Document the new knobs. Fixes #6104 ## Testing - `git diff --check` - `python3.12 -m py_compile contributing/samples/adk_team/adk_answering_agent/settings.py contributing/samples/adk_team/adk_answering_agent/agent.py contributing/samples/adk_team/adk_answering_agent/gemini_assistant/agent.py` Co-authored-by: Kathy Wu <wukathy@google.com> COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/6113 from Haihan-Jiang:codex/adk-python-answering-model-config aea24eab14eaf479b7d42f59f25a94e0baa713a5 PiperOrigin-RevId: 947224603
This commit is contained in:
committed by
Copybara-Service
parent
b8a1dabf9e
commit
de4ac2d93f
@@ -57,10 +57,11 @@ jobs:
|
||||
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
|
||||
ADK_GCP_SA_KEY: ${{ secrets.ADK_GCP_SA_KEY }}
|
||||
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
|
||||
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
|
||||
GOOGLE_CLOUD_LOCATION: ${{ vars.ADK_ANSWERING_LOCATION || secrets.GOOGLE_CLOUD_LOCATION }}
|
||||
VERTEXAI_DATASTORE_ID: ${{ secrets.VERTEXAI_DATASTORE_ID }}
|
||||
GEMINI_API_DATASTORE_ID: ${{ secrets.GEMINI_API_DATASTORE_ID }}
|
||||
GOOGLE_GENAI_USE_VERTEXAI: 1
|
||||
LLM_MODEL_NAME: ${{ vars.ADK_ANSWERING_MODEL || 'gemini-2.5-flash' }}
|
||||
OWNER: 'google'
|
||||
REPO: 'adk-python'
|
||||
INTERACTIVE: 0
|
||||
|
||||
@@ -114,6 +114,7 @@ The following environment variables are required for the agent to connect to the
|
||||
- `GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID`: **(Required)** The Google Cloud project ID.
|
||||
- `GOOGLE_CLOUD_LOCATION=LOCATION`: **(Required)** The Google Cloud region.
|
||||
- `VERTEXAI_DATASTORE_ID=YOUR_DATASTORE_ID`: **(Required)** The full Vertex AI datastore ID for the document store (i.e. knowledge base), with the format of `projects/{project_number}/locations/{location}/collections/{collection}/dataStores/{datastore_id}`.
|
||||
- `LLM_MODEL_NAME`: The Gemini model used by the answering agent. Defaults to `gemini-2.5-flash`.
|
||||
- `OWNER`: The GitHub organization or username that owns the repository (e.g., `google`). Needed for both modes.
|
||||
- `REPO`: The name of the GitHub repository (e.g., `adk-python`). Needed for both modes.
|
||||
- `INTERACTIVE`: Controls the agent's interaction mode. For the automated workflow, this is set to `0`. For interactive mode, it should be set to `1` or left unset.
|
||||
@@ -124,4 +125,9 @@ The following environment variables are required to upload the docs to update th
|
||||
- `ADK_DOCS_ROOT_PATH=YOUR_ADK_DOCS_ROOT_PATH`: **(Required)** Path to the root of the downloaded adk-docs repo.
|
||||
- `ADK_PYTHON_ROOT_PATH=YOUR_ADK_PYTHON_ROOT_PATH`: **(Required)** Path to the root of the downloaded adk-python repo.
|
||||
|
||||
For local execution in interactive mode, you can place these variables in a `.env` file in the project's root directory. For the GitHub workflow, they should be configured as repository secrets.
|
||||
For local execution in interactive mode, you can place these variables in a
|
||||
`.env` file in the project's root directory. For the GitHub workflow, required
|
||||
credentials should be configured as repository secrets. The workflow also
|
||||
supports the optional repository variables `ADK_ANSWERING_MODEL` and
|
||||
`ADK_ANSWERING_LOCATION` to override the default model and location without
|
||||
changing the workflow file.
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
from adk_answering_agent.gemini_assistant.agent import root_agent as gemini_assistant_agent
|
||||
from adk_answering_agent.settings import BOT_RESPONSE_LABEL
|
||||
from adk_answering_agent.settings import IS_INTERACTIVE
|
||||
from adk_answering_agent.settings import LLM_MODEL_NAME
|
||||
from adk_answering_agent.settings import OWNER
|
||||
from adk_answering_agent.settings import REPO
|
||||
from adk_answering_agent.settings import VERTEXAI_DATASTORE_ID
|
||||
@@ -38,7 +39,7 @@ else:
|
||||
|
||||
|
||||
root_agent = Agent(
|
||||
model="gemini-3.5-flash",
|
||||
model=LLM_MODEL_NAME,
|
||||
name="adk_answering_agent",
|
||||
description="Answer questions about ADK repo.",
|
||||
instruction=f"""
|
||||
|
||||
@@ -19,6 +19,7 @@ from typing import List
|
||||
|
||||
from adk_answering_agent.settings import ADK_GCP_SA_KEY
|
||||
from adk_answering_agent.settings import GEMINI_API_DATASTORE_ID
|
||||
from adk_answering_agent.settings import LLM_MODEL_NAME
|
||||
from adk_answering_agent.utils import error_response
|
||||
from google.adk.agents.llm_agent import Agent
|
||||
from google.api_core.exceptions import GoogleAPICallError
|
||||
@@ -72,7 +73,7 @@ def search_gemini_api_docs(queries: List[str]) -> Dict[str, Any]:
|
||||
|
||||
|
||||
root_agent = Agent(
|
||||
model="gemini-3.5-flash",
|
||||
model=LLM_MODEL_NAME,
|
||||
name="gemini_assistant",
|
||||
description="Answer questions about Gemini API.",
|
||||
instruction="""
|
||||
|
||||
@@ -41,5 +41,7 @@ OWNER = os.getenv("OWNER", "google")
|
||||
REPO = os.getenv("REPO", "adk-python")
|
||||
BOT_RESPONSE_LABEL = os.getenv("BOT_RESPONSE_LABEL", "bot responded")
|
||||
DISCUSSION_NUMBER = os.getenv("DISCUSSION_NUMBER")
|
||||
DEFAULT_LLM_MODEL_NAME = "gemini-2.5-flash"
|
||||
LLM_MODEL_NAME = os.getenv("LLM_MODEL_NAME", DEFAULT_LLM_MODEL_NAME)
|
||||
|
||||
IS_INTERACTIVE = os.getenv("INTERACTIVE", "1").lower() in ["true", "1"]
|
||||
|
||||
Reference in New Issue
Block a user