Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -5,20 +5,20 @@ import pytz
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from langchain.text_splitter import CharacterTextSplitter
|
|
|
|
| 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 web_search(query:str)
|
| 14 |
"""Allows search through DuckDuckGo
|
| 15 |
Args:
|
| 16 |
query: what you want to search
|
| 17 |
"""
|
| 18 |
search_tool = DuckDuckGoSearchTool()
|
| 19 |
results = search_tool(query)
|
| 20 |
-
|
| 21 |
-
print(result)
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -68,7 +68,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
-
tools=[final_answer, web_search, text_splitter],
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|
|
|
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
from langchain.text_splitter import CharacterTextSplitter
|
| 8 |
+
from typing import List
|
| 9 |
|
| 10 |
from Gradio_UI import GradioUI
|
| 11 |
|
| 12 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 13 |
@tool
|
| 14 |
+
def web_search(query:str) -> str:
|
| 15 |
"""Allows search through DuckDuckGo
|
| 16 |
Args:
|
| 17 |
query: what you want to search
|
| 18 |
"""
|
| 19 |
search_tool = DuckDuckGoSearchTool()
|
| 20 |
results = search_tool(query)
|
| 21 |
+
return "\n".join(results)
|
|
|
|
| 22 |
|
| 23 |
@tool
|
| 24 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 68 |
|
| 69 |
agent = CodeAgent(
|
| 70 |
model=model,
|
| 71 |
+
tools=[final_answer, web_search, text_splitter, image_generation_tool],
|
| 72 |
max_steps=6,
|
| 73 |
verbosity_level=1,
|
| 74 |
grammar=None,
|