Donny commited on
Commit
9daede1
·
1 Parent(s): 6e5850a

Add visit webpage tool

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -4,6 +4,7 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
7
 
8
  from Gradio_UI import GradioUI
9
  from typing import List
@@ -27,7 +28,7 @@ def search(query: str) -> List[str]:
27
  """
28
  try:
29
  search_engine = DuckDuckGoSearchTool()
30
- return search_engine.forward(query)
31
  except Exception as e:
32
  return f"Fail to get search result of '{query}': {str(e)}"
33
 
@@ -48,6 +49,7 @@ def get_current_time_in_timezone(timezone: str) -> str:
48
 
49
 
50
  final_answer = FinalAnswerTool()
 
51
 
52
  # 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:
53
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
@@ -68,7 +70,9 @@ with open("prompts.yaml", 'r') as stream:
68
 
69
  agent = CodeAgent(
70
  model=model,
71
- tools=[final_answer, get_current_time_in_timezone, image_generation_tool, search], ## add your tools here (don't remove final answer)
 
 
72
  max_steps=6,
73
  verbosity_level=1,
74
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from tools.visit_webpage import VisitWebpageTool
8
 
9
  from Gradio_UI import GradioUI
10
  from typing import List
 
28
  """
29
  try:
30
  search_engine = DuckDuckGoSearchTool()
31
+ return search_engine(query)
32
  except Exception as e:
33
  return f"Fail to get search result of '{query}': {str(e)}"
34
 
 
49
 
50
 
51
  final_answer = FinalAnswerTool()
52
+ visit_webpage = VisitWebpageTool()
53
 
54
  # 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:
55
  # model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud'
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer, get_current_time_in_timezone,
74
+ image_generation_tool, search,
75
+ visit_webpage], ## add your tools here (don't remove final answer)
76
  max_steps=6,
77
  verbosity_level=1,
78
  grammar=None,