Sharmendra commited on
Commit
51457df
·
verified ·
1 Parent(s): 9a8c112

added quote generation and message generation.

Browse files
Files changed (1) hide show
  1. app.py +23 -7
app.py CHANGED
@@ -10,13 +10,30 @@ from Gradio_UI import GradioUI
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
  def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
- #Keep this format for the description / args / args description but feel free to modify the tool
14
- """A tool that does nothing yet
15
  Args:
16
- arg1: the first argument
17
- arg2: the second argument
18
  """
19
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
  @tool
22
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -33,7 +50,6 @@ 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 +67,7 @@ with open("prompts.yaml", 'r') as stream:
51
 
52
  agent = CodeAgent(
53
  model=model,
54
- tools=[final_answer], ## add your tools here (don't remove final answer)
55
  max_steps=6,
56
  verbosity_level=1,
57
  grammar=None,
 
10
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
11
  @tool
12
  def my_cutom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
13
+ #Keep this format for the description/args / args description but feel free to modify the tool
14
+ """A tool that combines a string and an integer to create a unique message
15
  Args:
16
+ arg1: the first argument as a string
17
+ arg2: the second argument as an integer
18
  """
19
+ return f"Custom Tool Output: {arg1} repeated {arg2} times is {' '.join([arg1]*arg2)}"
20
+
21
+ @tool
22
+ def my_quote_tool(arg1:str, arg2:int)-> str:
23
+ """A tool that generates a random inspirational quote.
24
+ Args:
25
+ arg1: the first argument (not used)
26
+ arg2: the second argument (not used)
27
+ """
28
+ quotes = [
29
+ "The best way to get started is to quit talking and begin doing.",
30
+ "Don't let yesterday take up too much of today.",
31
+ "It's not whether you get knocked down, it's whether you get up.",
32
+ "If you are working on something exciting, it will keep you motivated.",
33
+ "Success is not in what you have, but who you are."
34
+ ]
35
+ return random.choice(quotes)
36
+
37
 
38
  @tool
39
  def get_current_time_in_timezone(timezone: str) -> str:
 
50
  except Exception as e:
51
  return f"Error fetching time for timezone '{timezone}': {str(e)}"
52
 
 
53
  final_answer = FinalAnswerTool()
54
  model = HfApiModel(
55
  max_tokens=2096,
 
67
 
68
  agent = CodeAgent(
69
  model=model,
70
+ tools=[final_answer,my_quote_tool, my_cutom_tool, get_current_time_in_timezone ], ## add your tools here (don't remove final answer)
71
  max_steps=6,
72
  verbosity_level=1,
73
  grammar=None,