anuroopageorge commited on
Commit
947a9e7
·
verified ·
1 Parent(s): f02f6ac

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -1
app.py CHANGED
@@ -1,5 +1,6 @@
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
  import datetime
 
3
  import requests
4
  import pytz
5
  import yaml
@@ -18,6 +19,20 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
18
  """
19
  return "What magic will you build ?"
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
23
  """A tool that fetches the current local time in a specified timezone.
@@ -55,7 +70,7 @@ with open("prompts.yaml", 'r') as stream:
55
 
56
  agent = CodeAgent(
57
  model=model,
58
- tools=[final_answer,image_generation_tool], ## add your tools here (don't remove final answer)
59
  max_steps=6,
60
  verbosity_level=1,
61
  grammar=None,
 
1
  from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel,load_tool,tool
2
  import datetime
3
+ import math
4
  import requests
5
  import pytz
6
  import yaml
 
19
  """
20
  return "What magic will you build ?"
21
 
22
+ @tool
23
+ def get_square_root_tool(input_number:int)-> int: #it's import to specify the return type
24
+ #Keep this format for the description / args / args description but feel free to modify the tool
25
+ """A tool that does nothing yet
26
+ Args:
27
+ number: an input_integer whose square root is to be calculated
28
+ """
29
+ try:
30
+ # get square root
31
+ square_root = math.sqrt(input_number)
32
+ return f"Square root of {input_number} is: {square_root}"
33
+ except Exception as e:
34
+ return f"Error fetching Square root of '{input_number}': {str(e)}"
35
+
36
  @tool
37
  def get_current_time_in_timezone(timezone: str) -> str:
38
  """A tool that fetches the current local time in a specified timezone.
 
70
 
71
  agent = CodeAgent(
72
  model=model,
73
+ tools=[final_answer,image_generation_tool,get_square_root_tool], ## add your tools here (don't remove final answer)
74
  max_steps=6,
75
  verbosity_level=1,
76
  grammar=None,