susmitsil commited on
Commit
0ca608e
·
verified ·
1 Parent(s): ae7a494

Added tools

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -33,6 +33,20 @@ def get_current_time_in_timezone(timezone: str) -> str:
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  final_answer = FinalAnswerTool()
38
 
@@ -55,7 +69,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
+ @tool
37
+ def basic_search(q:str)-> str:
38
+ """A tool that takes in a user query and returns the output from a DuckDuckGo search.
39
+ Args:
40
+ q: User query
41
+ """
42
+
43
+ try:
44
+ search_tool = DuckDuckGoSearchTool()
45
+ results = search_tool(q)
46
+ return str(results)
47
+ except Exception as e:
48
+ return f"Error: {str(e)}"
49
+
50
 
51
  final_answer = FinalAnswerTool()
52
 
 
69
 
70
  agent = CodeAgent(
71
  model=model,
72
+ tools=[final_answer, get_current_time_in_timezone, basic_search, image_generation_tool], ## add your tools here (don't remove final answer)
73
  max_steps=6,
74
  verbosity_level=1,
75
  grammar=None,