dianamclean commited on
Commit
1b069db
·
verified ·
1 Parent(s): b325c19

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -1
app.py CHANGED
@@ -33,7 +33,24 @@ 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
  model = HfApiModel(
39
  max_tokens=2096,
@@ -51,7 +68,8 @@ with open("prompts.yaml", 'r') as stream:
51
 
52
  agent = CodeAgent(
53
  model=model,
54
- tools=[final_answer, get_current_time_in_timezone, image_generation_tool], ## add your tools here (don't remove final answer)
 
55
  max_steps=6,
56
  verbosity_level=1,
57
  grammar=None,
 
33
  except Exception as e:
34
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
35
 
36
+ def get_joke_tool(arg1:str)-> str: #it's import to specify the return type
37
+ #Keep this format for the description / args / args description but feel free to modify the tool
38
+ """A tool that tells a joke
39
+ Args:
40
+ arg1: the first argument ex programming
41
+ arg2: the second argument ex 0
42
+ """
43
+ if arg1 = "programming":
44
+ joke= "why didn't the programmer quit his job? because he didn't get a raise"
45
+
46
+ else:
47
+ "What magic will you build ?"
48
+
49
+ return joke
50
 
51
+
52
+
53
+
54
  final_answer = FinalAnswerTool()
55
  model = HfApiModel(
56
  max_tokens=2096,
 
68
 
69
  agent = CodeAgent(
70
  model=model,
71
+ tools=[final_answer, get_current_time_in_timezone, get_joke_tool, image_generation_tool], ## add your tools here (don't remove final answer)
72
+ print tools, ## new
73
  max_steps=6,
74
  verbosity_level=1,
75
  grammar=None,