Spaces:
Sleeping
Sleeping
Remove wikipedia_search tool
Browse files
app.py
CHANGED
|
@@ -3,24 +3,11 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
-
import wikipedia
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
-
@tool
|
| 13 |
-
def wikipedia_search(query: str) -> str:
|
| 14 |
-
"""Search Wikipedia and return a short summary.
|
| 15 |
-
Args:
|
| 16 |
-
query: Search term
|
| 17 |
-
"""
|
| 18 |
-
try:
|
| 19 |
-
summary = wikipedia.summary(query, sentences=2)
|
| 20 |
-
return f"Wikipedia Summary: {summary}"
|
| 21 |
-
except Exception as e:
|
| 22 |
-
return f"Error fetching Wikipedia data: {str(e)}"
|
| 23 |
-
|
| 24 |
@tool
|
| 25 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 26 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
|
@@ -68,7 +55,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
-
tools=[final_answer, image_generation_tool,
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
|
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
+
tools=[final_answer, image_generation_tool, DuckDuckGoSearchTool], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|