Spaces:
Sleeping
Sleeping
Update tools.py
Browse files
tools.py
CHANGED
|
@@ -1,10 +1,26 @@
|
|
| 1 |
from typing import Any, Optional
|
| 2 |
from smolagents.tools import Tool
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
simplify_system_message = """
|
| 5 |
You are a general AI assistant. I will give you a question and answer, you should simplify answer. Your answer should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 6 |
"""
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
#class FinalAnswerTool(Tool):
|
| 9 |
# name = "final_answer"
|
| 10 |
# description = "Provides a final answer to the given problem."
|
|
|
|
| 1 |
from typing import Any, Optional
|
| 2 |
from smolagents.tools import Tool
|
| 3 |
+
import io
|
| 4 |
+
import openpyxl
|
| 5 |
+
import os
|
| 6 |
+
from smolagents import tool
|
| 7 |
+
import requests
|
| 8 |
+
from PIL import Image
|
| 9 |
+
|
| 10 |
|
| 11 |
simplify_system_message = """
|
| 12 |
You are a general AI assistant. I will give you a question and answer, you should simplify answer. Your answer should be a number OR as few words as possible OR a comma separated list of numbers and/or strings. If you are asked for a number, don't use comma to write your number neither use units such as $ or percent sign unless specified otherwise. If you are asked for a string, don't use articles, neither abbreviations (e.g. for cities), and write the digits in plain text unless specified otherwise. If you are asked for a comma separated list, apply the above rules depending of whether the element to be put in the list is a number or a string.
|
| 13 |
"""
|
| 14 |
|
| 15 |
+
@tool
|
| 16 |
+
def tool_reverse_string(text: str) -> str:
|
| 17 |
+
"""
|
| 18 |
+
Use this tool only if you encounter text that seems to be written backwards
|
| 19 |
+
Args:
|
| 20 |
+
text: The string to reverse.
|
| 21 |
+
"""
|
| 22 |
+
return text[::-1]
|
| 23 |
+
|
| 24 |
#class FinalAnswerTool(Tool):
|
| 25 |
# name = "final_answer"
|
| 26 |
# description = "Provides a final answer to the given problem."
|