acidtib commited on
Commit
f3624f7
·
1 Parent(s): dcab6d9

✨ feat: add webpage visit and search tools to agent

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -4,6 +4,8 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -34,6 +36,8 @@ def get_current_time_in_timezone(timezone: str) -> str:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
 
 
 
37
  final_answer = FinalAnswerTool()
38
  model = HfApiModel(
39
  max_tokens=2096,
@@ -51,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
51
 
52
  agent = CodeAgent(
53
  model=model,
54
- tools=[get_current_time_in_timezone, final_answer], ## add your tools here (don't remove final answer)
55
  max_steps=6,
56
  verbosity_level=1,
57
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from tools.visit_webpage import VisitWebpageTool
8
+ from tools.web_search import DuckDuckGoSearchTool
9
 
10
  from Gradio_UI import GradioUI
11
 
 
36
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
37
 
38
 
39
+ visit_webpage = VisitWebpageTool()
40
+ web_search = DuckDuckGoSearchTool()
41
  final_answer = FinalAnswerTool()
42
  model = HfApiModel(
43
  max_tokens=2096,
 
55
 
56
  agent = CodeAgent(
57
  model=model,
58
+ tools=[visit_webpage, web_search, final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,