sascow commited on
Commit
395d689
·
verified ·
1 Parent(s): ee214ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -37
app.py CHANGED
@@ -8,49 +8,44 @@ from tools.final_answer import FinalAnswerTool
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
- def magic_8_ball(question: str, asker_name: str) -> str:
12
- """A Magic 8 Ball tool that provides fortune-telling responses to yes/no questions
13
-
14
  Args:
15
- question: The question being asked to the Magic 8 Ball
16
- asker_name: The name of the person asking the question
17
  """
18
- responses = [
19
- # Positive responses
20
- "It is certain.",
21
- "It is decidedly so.",
22
- "Without a doubt.",
23
- "Yes definitely.",
24
- "You may rely on it.",
25
- "As I see it, yes.",
26
- "Most likely.",
27
- "Outlook good.",
28
- "Yes.",
29
- "Signs point to yes.",
30
-
31
- # Non-committal responses
32
- "Reply hazy, try again.",
33
- "Ask again later.",
34
- "Better not tell you now.",
35
- "Cannot predict now.",
36
- "Concentrate and ask again.",
37
-
38
- # Negative responses
39
- "Don't count on it.",
40
- "My reply is no.",
41
- "My sources say no.",
42
- "Outlook not so good.",
43
- "Very doubtful."
44
  ]
45
-
46
- # Get random response
47
- answer = random.choice(responses)
48
- return f"🎱 Dear {asker_name}, you asked: '{question}'\nThe Magic 8 Ball says: {answer}"
49
 
50
  @tool
51
  def get_current_time_in_timezone(timezone: str) -> str:
52
  """A tool that fetches the current local time in a specified timezone.
53
-
54
  Args:
55
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
56
  """
@@ -80,7 +75,7 @@ with open("prompts.yaml", 'r') as stream:
80
 
81
  agent = CodeAgent(
82
  model=model,
83
- tools=[get_current_time_in_timezone, magic_8_ball, DuckDuckGoSearchTool(), final_answer],
84
  max_steps=6,
85
  verbosity_level=1,
86
  grammar=None,
 
8
  from Gradio_UI import GradioUI
9
 
10
  @tool
11
+ def sarcastic_soda_can(question: str, asker_name: str) -> str:
12
+ """A Sarcastic Soda Can tool that provides snarky and unhelpful responses when 'shaken' (queried).
13
+
14
  Args:
15
+ question: The question being asked to the Sarcastic Soda Can (ignored, mostly).
16
+ asker_name: The name of the person foolish enough to ask the can (for extra sarcasm).
17
  """
18
+ sarcastic_responses = [
19
+ f"Oh, *that's* a good question, {asker_name}. Really?",
20
+ "Hmm, let me think... Nope, still don't care.",
21
+ f"As if *I* would know, {asker_name}.",
22
+ "Outlook not so good... for your intelligence if you're asking *me*.",
23
+ "Seriously? You needed *me* for *this*, {asker_name}?",
24
+ "Yeah, yeah, everyone's got questions.",
25
+ "Are you sure you've thought this through? Probably not.",
26
+ "Don't get your hopes up.",
27
+ "Maybe try asking someone who actually gets paid to answer questions.",
28
+ f"In my professional soda can opinion, {asker_name}, you're on your own.",
29
+ "The answer is... try again later when I'm less bored.",
30
+ "My sources say... you should probably just Google it.",
31
+ "Concentrate harder and maybe the answer will magically appear... spoiler: it won't.",
32
+ "Better not tell you now, it's funnier this way.",
33
+ "Reply hazy, mostly because I'm a soda can.",
34
+ "Don't count on me. Or anything, really.",
35
+ "My reply is a resounding... *shrug*.",
36
+ "Outlook? Let's just say 'cloudy with a chance of disappointment'.",
37
+ "Very doubtful... that you'll get a useful answer from *me*.",
38
+ f"It is certain... that you're talking to a soda can, {asker_name}." # Just a *touch* of irony
 
 
 
 
 
39
  ]
40
+
41
+ # Get random sarcastic response
42
+ answer = random.choice(sarcastic_responses)
43
+ return f"🥤 *Shakes the Sarcastic Soda Can for {asker_name}*...\nThe Soda Can grumbles: {answer}"
44
 
45
  @tool
46
  def get_current_time_in_timezone(timezone: str) -> str:
47
  """A tool that fetches the current local time in a specified timezone.
48
+
49
  Args:
50
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
51
  """
 
75
 
76
  agent = CodeAgent(
77
  model=model,
78
+ tools=[get_current_time_in_timezone, sarcastic_soda_can, DuckDuckGoSearchTool(), final_answer], # Replaced magic_8_ball with sarcastic_soda_can
79
  max_steps=6,
80
  verbosity_level=1,
81
  grammar=None,