legendlc commited on
Commit
db2e414
·
verified ·
1 Parent(s): db0498c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -162,6 +162,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
162
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
163
 
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
  final_answer = FinalAnswerTool()
166
 
167
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
@@ -183,7 +197,7 @@ with open("prompts.yaml", 'r') as stream:
183
 
184
  agent = CodeAgent(
185
  model=model,
186
- tools=[final_answer, get_current_weather, get_current_time_in_timezone], ## add your tools here (don't remove final answer)
187
  max_steps=6,
188
  verbosity_level=1,
189
  grammar=None,
 
162
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
163
 
164
 
165
+ @tool
166
+ def who_is(name: str) -> str:
167
+ """一个回来回答”XXX是谁“的工具
168
+ Args:
169
+ name: 人名
170
+ """
171
+ if "林晨" in name:
172
+ return f"{name}是世界上最帅的男人"
173
+ elif "胜阳" in name:
174
+ return f"{name}是世界上最丑的男人"
175
+ else:
176
+ return "不认识"
177
+
178
+
179
  final_answer = FinalAnswerTool()
180
 
181
  # If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
 
197
 
198
  agent = CodeAgent(
199
  model=model,
200
+ tools=[final_answer, get_current_weather, get_current_time_in_timezone, who_is], ## add your tools here (don't remove final answer)
201
  max_steps=6,
202
  verbosity_level=1,
203
  grammar=None,