Skip to content

Commit de4ac2d

Browse files
Haihan-Jiangwukath
authored andcommitted
fix: make discussion answering model configurable
Merge #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=#6113 from Haihan-Jiang:codex/adk-python-answering-model-config aea24ea PiperOrigin-RevId: 947224603
1 parent b8a1dab commit de4ac2d

5 files changed

Lines changed: 15 additions & 4 deletions

File tree

.github/workflows/discussion_answering.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,11 @@ jobs:
5757
GITHUB_TOKEN: ${{ secrets.ADK_TRIAGE_AGENT }}
5858
ADK_GCP_SA_KEY: ${{ secrets.ADK_GCP_SA_KEY }}
5959
GOOGLE_CLOUD_PROJECT: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
60-
GOOGLE_CLOUD_LOCATION: ${{ secrets.GOOGLE_CLOUD_LOCATION }}
60+
GOOGLE_CLOUD_LOCATION: ${{ vars.ADK_ANSWERING_LOCATION || secrets.GOOGLE_CLOUD_LOCATION }}
6161
VERTEXAI_DATASTORE_ID: ${{ secrets.VERTEXAI_DATASTORE_ID }}
6262
GEMINI_API_DATASTORE_ID: ${{ secrets.GEMINI_API_DATASTORE_ID }}
6363
GOOGLE_GENAI_USE_VERTEXAI: 1
64+
LLM_MODEL_NAME: ${{ vars.ADK_ANSWERING_MODEL || 'gemini-2.5-flash' }}
6465
OWNER: 'google'
6566
REPO: 'adk-python'
6667
INTERACTIVE: 0

contributing/samples/adk_team/adk_answering_agent/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ The following environment variables are required for the agent to connect to the
114114
- `GOOGLE_CLOUD_PROJECT=YOUR_PROJECT_ID`: **(Required)** The Google Cloud project ID.
115115
- `GOOGLE_CLOUD_LOCATION=LOCATION`: **(Required)** The Google Cloud region.
116116
- `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}`.
117+
- `LLM_MODEL_NAME`: The Gemini model used by the answering agent. Defaults to `gemini-2.5-flash`.
117118
- `OWNER`: The GitHub organization or username that owns the repository (e.g., `google`). Needed for both modes.
118119
- `REPO`: The name of the GitHub repository (e.g., `adk-python`). Needed for both modes.
119120
- `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
124125
- `ADK_DOCS_ROOT_PATH=YOUR_ADK_DOCS_ROOT_PATH`: **(Required)** Path to the root of the downloaded adk-docs repo.
125126
- `ADK_PYTHON_ROOT_PATH=YOUR_ADK_PYTHON_ROOT_PATH`: **(Required)** Path to the root of the downloaded adk-python repo.
126127

127-
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.
128+
For local execution in interactive mode, you can place these variables in a
129+
`.env` file in the project's root directory. For the GitHub workflow, required
130+
credentials should be configured as repository secrets. The workflow also
131+
supports the optional repository variables `ADK_ANSWERING_MODEL` and
132+
`ADK_ANSWERING_LOCATION` to override the default model and location without
133+
changing the workflow file.

contributing/samples/adk_team/adk_answering_agent/agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from adk_answering_agent.gemini_assistant.agent import root_agent as gemini_assistant_agent
1616
from adk_answering_agent.settings import BOT_RESPONSE_LABEL
1717
from adk_answering_agent.settings import IS_INTERACTIVE
18+
from adk_answering_agent.settings import LLM_MODEL_NAME
1819
from adk_answering_agent.settings import OWNER
1920
from adk_answering_agent.settings import REPO
2021
from adk_answering_agent.settings import VERTEXAI_DATASTORE_ID
@@ -38,7 +39,7 @@
3839

3940

4041
root_agent = Agent(
41-
model="gemini-3.5-flash",
42+
model=LLM_MODEL_NAME,
4243
name="adk_answering_agent",
4344
description="Answer questions about ADK repo.",
4445
instruction=f"""

contributing/samples/adk_team/adk_answering_agent/gemini_assistant/agent.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
from adk_answering_agent.settings import ADK_GCP_SA_KEY
2121
from adk_answering_agent.settings import GEMINI_API_DATASTORE_ID
22+
from adk_answering_agent.settings import LLM_MODEL_NAME
2223
from adk_answering_agent.utils import error_response
2324
from google.adk.agents.llm_agent import Agent
2425
from google.api_core.exceptions import GoogleAPICallError
@@ -72,7 +73,7 @@ def search_gemini_api_docs(queries: List[str]) -> Dict[str, Any]:
7273

7374

7475
root_agent = Agent(
75-
model="gemini-3.5-flash",
76+
model=LLM_MODEL_NAME,
7677
name="gemini_assistant",
7778
description="Answer questions about Gemini API.",
7879
instruction="""

contributing/samples/adk_team/adk_answering_agent/settings.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@
4141
REPO = os.getenv("REPO", "adk-python")
4242
BOT_RESPONSE_LABEL = os.getenv("BOT_RESPONSE_LABEL", "bot responded")
4343
DISCUSSION_NUMBER = os.getenv("DISCUSSION_NUMBER")
44+
DEFAULT_LLM_MODEL_NAME = "gemini-2.5-flash"
45+
LLM_MODEL_NAME = os.getenv("LLM_MODEL_NAME", DEFAULT_LLM_MODEL_NAME)
4446

4547
IS_INTERACTIVE = os.getenv("INTERACTIVE", "1").lower() in ["true", "1"]

0 commit comments

Comments
 (0)