Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,6 +33,23 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
|
@@ -55,7 +72,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 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,
|
|
|
|
| 33 |
except Exception as e:
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
+
@tool
|
| 37 |
+
def does_file_exist(file_name: str) -> bool:
|
| 38 |
+
"""
|
| 39 |
+
A tool that checks if a file exists in the current directory.
|
| 40 |
+
Args:
|
| 41 |
+
file_name: a string representing the file name to find.
|
| 42 |
+
|
| 43 |
+
Returns:
|
| 44 |
+
bool: returns True if the file exists else returns False
|
| 45 |
+
"""
|
| 46 |
+
try:
|
| 47 |
+
from pathlib import Path
|
| 48 |
+
file_path: Path = Path(f"./{file_name}")
|
| 49 |
+
return file_path.exists()
|
| 50 |
+
except Exception as e:
|
| 51 |
+
reutnr f"Error finding the file {file_name}: {str(e)}"
|
| 52 |
+
|
| 53 |
|
| 54 |
final_answer = FinalAnswerTool()
|
| 55 |
|
|
|
|
| 72 |
|
| 73 |
agent = CodeAgent(
|
| 74 |
model=model,
|
| 75 |
+
tools=[final_answer, image_generation_tool, DuckDuckGoSearchTool, does_file_exist], ## add your tools here (don't remove final answer)
|
| 76 |
max_steps=6,
|
| 77 |
verbosity_level=1,
|
| 78 |
grammar=None,
|