Spaces:
Sleeping
Sleeping
Update gaia_tools.py
Browse files- gaia_tools.py +10 -7
gaia_tools.py
CHANGED
|
@@ -7,10 +7,8 @@ import requests
|
|
| 7 |
def ReverseTextTool(text: str) -> str:
|
| 8 |
"""
|
| 9 |
Reverses a text string character by character.
|
| 10 |
-
|
| 11 |
Args:
|
| 12 |
text (str): The text to reverse
|
| 13 |
-
|
| 14 |
Returns:
|
| 15 |
str: The reversed text
|
| 16 |
"""
|
|
@@ -21,10 +19,8 @@ def ReverseTextTool(text: str) -> str:
|
|
| 21 |
def RunPythonFileTool(file_path: str) -> str:
|
| 22 |
"""
|
| 23 |
Executes a Python script loaded from the specified path using the PythonInterpreterTool.
|
| 24 |
-
|
| 25 |
Args:
|
| 26 |
file_path (str): The full path to the python (.py) file containing the Python code.
|
| 27 |
-
|
| 28 |
Returns:
|
| 29 |
str: The output produced by the code execution, or an error message if it fails.
|
| 30 |
"""
|
|
@@ -38,11 +34,18 @@ def RunPythonFileTool(file_path: str) -> str:
|
|
| 38 |
return f"Execution failed: {e}"
|
| 39 |
|
| 40 |
|
| 41 |
-
|
| 42 |
-
|
| 43 |
@tool
|
| 44 |
def download_server(url: str, save_path: str) -> str:
|
| 45 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
try:
|
| 47 |
response = requests.get(url, timeout=30)
|
| 48 |
response.raise_for_status()
|
|
|
|
| 7 |
def ReverseTextTool(text: str) -> str:
|
| 8 |
"""
|
| 9 |
Reverses a text string character by character.
|
|
|
|
| 10 |
Args:
|
| 11 |
text (str): The text to reverse
|
|
|
|
| 12 |
Returns:
|
| 13 |
str: The reversed text
|
| 14 |
"""
|
|
|
|
| 19 |
def RunPythonFileTool(file_path: str) -> str:
|
| 20 |
"""
|
| 21 |
Executes a Python script loaded from the specified path using the PythonInterpreterTool.
|
|
|
|
| 22 |
Args:
|
| 23 |
file_path (str): The full path to the python (.py) file containing the Python code.
|
|
|
|
| 24 |
Returns:
|
| 25 |
str: The output produced by the code execution, or an error message if it fails.
|
| 26 |
"""
|
|
|
|
| 34 |
return f"Execution failed: {e}"
|
| 35 |
|
| 36 |
|
|
|
|
|
|
|
| 37 |
@tool
|
| 38 |
def download_server(url: str, save_path: str) -> str:
|
| 39 |
+
"""
|
| 40 |
+
Downloads a file from a URL and saves it to the given path.
|
| 41 |
+
|
| 42 |
+
Args:
|
| 43 |
+
url (str): The URL from which to download the file.
|
| 44 |
+
save_path (str): The local file path where the downloaded file will be saved.
|
| 45 |
+
|
| 46 |
+
Returns:
|
| 47 |
+
str: A message indicating the result of the download operation.
|
| 48 |
+
"""
|
| 49 |
try:
|
| 50 |
response = requests.get(url, timeout=30)
|
| 51 |
response.raise_for_status()
|