rename tool_set to toolset to uniform the naming

PiperOrigin-RevId: 758422703
This commit is contained in:
Xiang (Sean) Zhou
2025-05-13 16:33:53 -07:00
committed by Copybara-Service
parent af978fe194
commit 931fb338f8
5 changed files with 101 additions and 101 deletions

View File

@@ -16,7 +16,7 @@ import os
from dotenv import load_dotenv
from google.adk import Agent
from google.adk.tools.google_api_tool import bigquery_tool_set
from google.adk.tools.google_api_tool import bigquery_toolset
# Load environment variables from .env file
load_dotenv()
@@ -24,7 +24,7 @@ load_dotenv()
# Access the variable
oauth_client_id = os.getenv("OAUTH_CLIENT_ID")
oauth_client_secret = os.getenv("OAUTH_CLIENT_SECRET")
bigquery_tool_set.configure_auth(oauth_client_id, oauth_client_secret)
bigquery_toolset.configure_auth(oauth_client_id, oauth_client_secret)
tools_to_expose = [
"bigquery_datasets_list",
@@ -34,7 +34,7 @@ tools_to_expose = [
"bigquery_tables_get",
"bigquery_tables_insert",
]
bigquery_tool_set.set_tool_filter(
bigquery_toolset.set_tool_filter(
lambda tool, ctx=None: tool.name in tools_to_expose
)
@@ -74,5 +74,5 @@ root_agent = Agent(
{userInfo?}
</User>
""",
tools=[bigquery_tool_set],
tools=[bigquery_toolset],
)

View File

@@ -27,7 +27,7 @@ from google.adk.auth import AuthCredential
from google.adk.auth import AuthCredentialTypes
from google.adk.auth import OAuth2Auth
from google.adk.tools import ToolContext
from google.adk.tools.google_api_tool import calendar_tool_set
from google.adk.tools.google_api_tool import calendar_toolset
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
@@ -42,15 +42,15 @@ oauth_client_secret = os.getenv("OAUTH_CLIENT_SECRET")
SCOPES = ["https://www.googleapis.com/auth/calendar"]
calendar_tool_set.configure_auth(
calendar_toolset.configure_auth(
client_id=oauth_client_id, client_secret=oauth_client_secret
)
calendar_tool_set.set_tool_filter(
# you can also replace below customized `list_calendar_events` with build-in
# google calendar tool by adding `calendar_events_list` in the filter list
lambda tool, ctx=None: tool.name
in ["calendar_events_get"]
)
get_calendar_events = calendar_toolset.get_tool("calendar_events_get")
# list_calendar_events = calendar_toolset.get_tool("calendar_events_list")
# you can replace below customized list_calendar_events tool with above ADK
# build-in google calendar tool which is commented for now to acheive same
# effect.
def list_calendar_events(
@@ -210,6 +210,6 @@ root_agent = Agent(
Currnet time: {_time}
""",
tools=[list_calendar_events, calendar_tool_set],
tools=[list_calendar_events, get_calendar_events],
before_agent_callback=update_time,
)