vijayperlakota commited on
Commit
4c8508f
·
verified ·
1 Parent(s): 860d2ad

added web search tool

Browse files
Files changed (1) hide show
  1. app.py +17 -1
app.py CHANGED
@@ -4,6 +4,11 @@ import requests
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
 
 
 
 
 
7
 
8
  from Gradio_UI import GradioUI
9
 
@@ -43,7 +48,18 @@ def get_current_time_in_timezone(timezone: str) -> str:
43
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
44
 
45
 
 
 
 
 
 
 
 
 
 
46
  final_answer = FinalAnswerTool()
 
 
47
  model = HfApiModel(
48
  max_tokens=2096,
49
  temperature=0.5,
@@ -60,7 +76,7 @@ with open("prompts.yaml", 'r') as stream:
60
 
61
  agent = CodeAgent(
62
  model=model,
63
- tools=[final_answer, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
64
  max_steps=6,
65
  verbosity_level=1,
66
  grammar=None,
 
4
  import pytz
5
  import yaml
6
  from tools.final_answer import FinalAnswerTool
7
+ from tools.web_search import DuckDuckGoSearchTool
8
+
9
+
10
+ # import duckduckgo_search
11
+ # from duckduckgo_search import DDGS
12
 
13
  from Gradio_UI import GradioUI
14
 
 
48
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
49
 
50
 
51
+ # @tool
52
+ # def progamming_lang_father(programming_lang: str) -> str
53
+ # """A tool that does the web search to get the information about the inventor of a given programming language
54
+ # Args:
55
+ # programming_lang: Name of the programming language
56
+ # """
57
+ # try:
58
+
59
+
60
  final_answer = FinalAnswerTool()
61
+ web_search = DuckDuckGoSearchTool()
62
+
63
  model = HfApiModel(
64
  max_tokens=2096,
65
  temperature=0.5,
 
76
 
77
  agent = CodeAgent(
78
  model=model,
79
+ tools=[final_answer, get_current_time_in_timezone, image_generation_tool, web_search], ## add your tools here (don't remove final answer)
80
  max_steps=6,
81
  verbosity_level=1,
82
  grammar=None,