olaf-bu commited on
Commit
3b0a72a
·
1 Parent(s): f60ba66

added duckduckgo to self_imports

Browse files
Files changed (2) hide show
  1. agent.py +1 -1
  2. tools.py +13 -9
agent.py CHANGED
@@ -26,7 +26,7 @@ class Agent:
26
  self.tools = tools
27
  self.imports = ['pandas', 'numpy', 'os', 'requests',
28
  'tempfile', 'datetime', 'json', 'time', 're',
29
- 'openpyxl', 'pathlib', 'sys',
30
  ]
31
  self.agent = CodeAgent(
32
  model=self.model,
 
26
  self.tools = tools
27
  self.imports = ['pandas', 'numpy', 'os', 'requests',
28
  'tempfile', 'datetime', 'json', 'time', 're',
29
+ 'openpyxl', 'pathlib', 'sys', 'duckduckgo_search'
30
  ]
31
  self.agent = CodeAgent(
32
  model=self.model,
tools.py CHANGED
@@ -100,13 +100,17 @@ def get_tools() -> List[Tool]:
100
  Returns:
101
  List[Tool]: List of initialized tool instances.
102
  """
103
- tools = [
104
- DuckDuckGoSearchTool(),
105
- PythonInterpreterTool(),
106
- WikipediaSearchTool(),
107
- VisitWebpageTool(),
108
- OpenAISpeechToTextTool(),
109
- YouTubeTranscriptionTool(),
110
- ReadFileTool(),
111
- ]
 
 
 
 
112
  return tools
 
100
  Returns:
101
  List[Tool]: List of initialized tool instances.
102
  """
103
+ try:
104
+ tools = [DuckDuckGoSearchTool(),
105
+ PythonInterpreterTool(),
106
+ WikipediaSearchTool(),
107
+ VisitWebpageTool(),
108
+ OpenAISpeechToTextTool(),
109
+ YouTubeTranscriptionTool(),
110
+ ReadFileTool(),
111
+ ]
112
+ except Exception as e:
113
+ logger.error('error while instantiating the tools: %s', e)
114
+ return f'error instantiating the tools {str(e)}'
115
+
116
  return tools