Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,49 +8,44 @@ from tools.final_answer import FinalAnswerTool
|
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
@tool
|
| 11 |
-
def
|
| 12 |
-
"""A
|
| 13 |
-
|
| 14 |
Args:
|
| 15 |
-
question: The question being asked to the
|
| 16 |
-
asker_name: The name of the person
|
| 17 |
"""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
"
|
| 21 |
-
"
|
| 22 |
-
"
|
| 23 |
-
"
|
| 24 |
-
"
|
| 25 |
-
"
|
| 26 |
-
"
|
| 27 |
-
"
|
| 28 |
-
"
|
| 29 |
-
"
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
"
|
| 33 |
-
"
|
| 34 |
-
"
|
| 35 |
-
"
|
| 36 |
-
"
|
| 37 |
-
|
| 38 |
-
#
|
| 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(
|
| 48 |
-
return f"
|
| 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,
|
| 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,
|