Update tools.py
Browse files
tools.py
CHANGED
|
@@ -4,7 +4,6 @@ from huggingface_hub import InferenceClient
|
|
| 4 |
|
| 5 |
class Web_research(Tool):
|
| 6 |
name="web_research"
|
| 7 |
-
#description="You are a general AI assistant. I will ask you a question. Report your thoughts, and finish your answer with the following template: FINAL ANSWER: [YOUR FINAL ANSWER]. YOUR FINAL 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."
|
| 8 |
description = "Web search on a specific topic."
|
| 9 |
inputs = {
|
| 10 |
"topic": {
|
|
@@ -20,6 +19,27 @@ class Web_research(Tool):
|
|
| 20 |
results = search_tool(f"{topic}")
|
| 21 |
return f"Here is what we can find on the web for {topic} : str({results})"
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
class image_interpreter(Tool):
|
| 24 |
name="multimodal_tool"
|
| 25 |
description = "Allows you to answer any question which relies on image input."
|
|
|
|
| 4 |
|
| 5 |
class Web_research(Tool):
|
| 6 |
name="web_research"
|
|
|
|
| 7 |
description = "Web search on a specific topic."
|
| 8 |
inputs = {
|
| 9 |
"topic": {
|
|
|
|
| 19 |
results = search_tool(f"{topic}")
|
| 20 |
return f"Here is what we can find on the web for {topic} : str({results})"
|
| 21 |
|
| 22 |
+
class translate_everything(Tool):
|
| 23 |
+
name="trabslator"
|
| 24 |
+
description = "You do not understand a sentence? It does not look like any language you know? Try this tool, maybe the sentence is just reversed!"
|
| 25 |
+
inputs = {
|
| 26 |
+
"sentence": {
|
| 27 |
+
"type": "string",
|
| 28 |
+
"description": "The sentence to translate"
|
| 29 |
+
}
|
| 30 |
+
}
|
| 31 |
+
output_type = "string"
|
| 32 |
+
|
| 33 |
+
def forward(self, sentence: str):
|
| 34 |
+
# Input string
|
| 35 |
+
reversed_words = sentence.split() #' '.join(s.split()[::-1])
|
| 36 |
+
right_sentence=[]
|
| 37 |
+
for word in reversed_words:
|
| 38 |
+
right_sentence.append(word[::-1])
|
| 39 |
+
|
| 40 |
+
translated_sentence = " ".join(right_sentence[::-1])
|
| 41 |
+
return f"The translated sentence is : {translated_sentence}"
|
| 42 |
+
|
| 43 |
class image_interpreter(Tool):
|
| 44 |
name="multimodal_tool"
|
| 45 |
description = "Allows you to answer any question which relies on image input."
|