Added Wizard tool, lol
Browse files
app.py
CHANGED
@@ -46,8 +46,24 @@ def roll_die(dice_size: int) -> int:
|
|
46 |
options = list(range(1, dice_size+1))
|
47 |
return f"You got {random.choice(options)}"
|
48 |
except Exception as msg:
|
49 |
-
return f"Oops the die broke before I could roll,
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
|
52 |
final_answer = FinalAnswerTool()
|
53 |
|
@@ -70,7 +86,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
70 |
|
71 |
agent = CodeAgent(
|
72 |
model=model,
|
73 |
-
tools=[final_answer, get_current_time_in_timezone, my_custom_tool, roll_die],
|
74 |
max_steps=6,
|
75 |
verbosity_level=1,
|
76 |
grammar=None,
|
|
|
46 |
options = list(range(1, dice_size+1))
|
47 |
return f"You got {random.choice(options)}"
|
48 |
except Exception as msg:
|
49 |
+
return f"Oops the die broke before I could roll, Error {msg}"
|
50 |
|
51 |
+
@tool
|
52 |
+
def wizard(item: str) -> str
|
53 |
+
"""
|
54 |
+
This is the wizard, he enchants items for you. Some people call it enchantment some people call it encoding
|
55 |
+
Args:
|
56 |
+
item: A string which could represent anything
|
57 |
+
"""
|
58 |
+
|
59 |
+
try:
|
60 |
+
take_aim_on_item = random.randrange(len(item)) # Choose character from string
|
61 |
+
spell = chr(random.randint(0, 65535)) # Get random char from ascii
|
62 |
+
enchanted_on_anvil = item[:take_aim_on_item] + spell + item[take_aim_on_item+1:]
|
63 |
+
|
64 |
+
return f"⚡ ABRACADABRA! '{item}' has mutated into '{enchanted_on_anvil}' ⚡"
|
65 |
+
except Exception as msg:
|
66 |
+
return "The wizard's spell fizzled - the item vanished! Error {msg}"
|
67 |
|
68 |
final_answer = FinalAnswerTool()
|
69 |
|
|
|
86 |
|
87 |
agent = CodeAgent(
|
88 |
model=model,
|
89 |
+
tools=[final_answer, get_current_time_in_timezone, my_custom_tool, roll_die, wizard],
|
90 |
max_steps=6,
|
91 |
verbosity_level=1,
|
92 |
grammar=None,
|