Spaces:
Runtime error
Runtime error
Oyelami Oyewole A.
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -18,34 +18,6 @@ def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
21 |
-
@tool
|
22 |
-
def get_random_quote() -> str:
|
23 |
-
"""Fetches a random quote from the web using only the requests module.
|
24 |
-
|
25 |
-
Returns:
|
26 |
-
A string containing the quote and author.
|
27 |
-
"""
|
28 |
-
try:
|
29 |
-
url = "https://quotes.toscrape.com/random"
|
30 |
-
response = requests.get(url)
|
31 |
-
html = response.text
|
32 |
-
|
33 |
-
# Very basic string parsing
|
34 |
-
quote_start = html.find('<span class="text"') # Locate quote start
|
35 |
-
quote_start = html.find('>', quote_start) + 1
|
36 |
-
quote_end = html.find('</span>', quote_start)
|
37 |
-
quote = html[quote_start:quote_end]
|
38 |
-
|
39 |
-
author_start = html.find('<small class="author"') # Locate author start
|
40 |
-
author_start = html.find('>', author_start) + 1
|
41 |
-
author_end = html.find('</small>', author_start)
|
42 |
-
author = html[author_start:author_end]
|
43 |
-
|
44 |
-
return f"{quote} — {author}"
|
45 |
-
|
46 |
-
except Exception as e:
|
47 |
-
return f"Error: {e}"
|
48 |
-
|
49 |
@tool
|
50 |
def get_current_time_in_timezone(timezone: str) -> str:
|
51 |
"""A tool that fetches the current local time in a specified timezone.
|
@@ -83,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
83 |
|
84 |
agent = CodeAgent(
|
85 |
model=model,
|
86 |
-
tools=[final_answer
|
87 |
max_steps=6,
|
88 |
verbosity_level=1,
|
89 |
grammar=None,
|
|
|
18 |
"""
|
19 |
return "What magic will you build ?"
|
20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
@tool
|
22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
23 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
55 |
|
56 |
agent = CodeAgent(
|
57 |
model=model,
|
58 |
+
tools=[final_answer], ## add your tools here (don't remove final answer)
|
59 |
max_steps=6,
|
60 |
verbosity_level=1,
|
61 |
grammar=None,
|