Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,10 +15,13 @@ def my_custom_tool(arg1: str, arg2: str) -> str:
|
|
| 15 |
arg1: The input text to search.
|
| 16 |
arg2: The letter to count (e.g., 'a').
|
| 17 |
"""
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 15 |
arg1: The input text to search.
|
| 16 |
arg2: The letter to count (e.g., 'a').
|
| 17 |
"""
|
| 18 |
+
try:
|
| 19 |
+
if len(arg2) != 1 or not arg2.isalpha():
|
| 20 |
+
return "Error: arg2 must be a single alphabet letter."
|
| 21 |
+
count = arg1.count(arg2)
|
| 22 |
+
return f"The letter '{arg2}' appears {count} time(s) in the text."
|
| 23 |
+
except Exception as e:
|
| 24 |
+
return f"Error: {str(e)}"
|
| 25 |
|
| 26 |
@tool
|
| 27 |
def get_current_time_in_timezone(timezone: str) -> str:
|