baibianxiaomage commited on
Commit
9b20d4a
·
verified ·
1 Parent(s): 0f832cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -35,7 +35,6 @@ def safe_request_json(url: str, *, params=None, headers=None, timeout=DEFAULT_TI
35
  @tool
36
  def get_weather(location: str) -> str:
37
  """Get the current weather for a specified city or region.
38
- Use this tool whenever the user asks about weather, temperature, humidity, wind, or forecast.
39
  Args:
40
  location: A city, region, or country name, such as Beijing, Tokyo, Shanghai, or New York.
41
  """
@@ -77,7 +76,6 @@ def get_weather(location: str) -> str:
77
  @tool
78
  def get_nba_games(date: str) -> str:
79
  """Get NBA game results for a specific date.
80
- Use this tool whenever the user asks for NBA games, scores, or results on a given date.
81
  Args:
82
  date: A date in YYYY-MM-DD format, for example '2026-03-08'.
83
  """
@@ -132,9 +130,8 @@ def get_nba_games(date: str) -> str:
132
  @tool
133
  def get_current_time_in_timezone(timezone: str) -> str:
134
  """Get the current local time in a specified timezone.
135
- Use this tool whenever the user asks for the current time in a city or timezone.
136
  Args:
137
- timezone: A valid timezone string, such as 'Asia/Shanghai' or 'America/New_York'.
138
  """
139
  try:
140
  tz = pytz.timezone(timezone)
@@ -162,14 +159,9 @@ agent = ToolCallingAgent(
162
  get_current_time_in_timezone,
163
  ],
164
  max_steps=4,
 
165
  name="Chen_Qiang",
166
  description="An agent for weather, NBA results, and timezone queries.",
167
- instructions=(
168
- "When the user asks about weather, always use the get_weather tool. "
169
- "When the user asks about NBA games or scores, always use the get_nba_games tool. "
170
- "When the user asks about time in a timezone, always use the get_current_time_in_timezone tool. "
171
- "Do not invent tools or functions that are not provided."
172
- ),
173
  )
174
 
175
  GradioUI(agent).launch()
 
35
  @tool
36
  def get_weather(location: str) -> str:
37
  """Get the current weather for a specified city or region.
 
38
  Args:
39
  location: A city, region, or country name, such as Beijing, Tokyo, Shanghai, or New York.
40
  """
 
76
  @tool
77
  def get_nba_games(date: str) -> str:
78
  """Get NBA game results for a specific date.
 
79
  Args:
80
  date: A date in YYYY-MM-DD format, for example '2026-03-08'.
81
  """
 
130
  @tool
131
  def get_current_time_in_timezone(timezone: str) -> str:
132
  """Get the current local time in a specified timezone.
 
133
  Args:
134
+ timezone: A valid timezone string, such as Asia/Shanghai or America/New_York.
135
  """
136
  try:
137
  tz = pytz.timezone(timezone)
 
159
  get_current_time_in_timezone,
160
  ],
161
  max_steps=4,
162
+ planning_interval=None,
163
  name="Chen_Qiang",
164
  description="An agent for weather, NBA results, and timezone queries.",
 
 
 
 
 
 
165
  )
166
 
167
  GradioUI(agent).launch()