Spaces:
Sleeping
Sleeping
Add requests_get_tool
Browse filesAdd requests_get_tool (via langchain), so the agent is able to
visit the URLs created by get_papers_url_for_date.
Remove code related to image generation as the agent should focus on papers, not images.
Reorganize imports.
app.py
CHANGED
@@ -1,8 +1,10 @@
|
|
1 |
-
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel, load_tool, tool
|
2 |
import datetime
|
3 |
import requests
|
4 |
import pytz
|
5 |
import yaml
|
|
|
|
|
|
|
6 |
from tools.final_answer import FinalAnswerTool
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
@@ -44,8 +46,7 @@ model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may
|
|
44 |
custom_role_conversions=None,
|
45 |
)
|
46 |
|
47 |
-
|
48 |
-
image_generation_tool = load_tool("agents-course/text-to-image", trust_remote_code=True)
|
49 |
search_tool = DuckDuckGoSearchTool()
|
50 |
|
51 |
with open("prompts.yaml", 'r') as stream:
|
@@ -53,7 +54,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
53 |
|
54 |
agent = CodeAgent(
|
55 |
model=model,
|
56 |
-
tools=[final_answer, search_tool, get_papers_url_for_date, get_current_time_in_timezone],
|
57 |
max_steps=6,
|
58 |
verbosity_level=1,
|
59 |
grammar=None,
|
|
|
|
|
1 |
import datetime
|
2 |
import requests
|
3 |
import pytz
|
4 |
import yaml
|
5 |
+
|
6 |
+
from langchain.tools.requests.tool import RequestsGetTool
|
7 |
+
from smolagents import CodeAgent,DuckDuckGoSearchTool, HfApiModel, tool, Tool
|
8 |
from tools.final_answer import FinalAnswerTool
|
9 |
|
10 |
from Gradio_UI import GradioUI
|
|
|
46 |
custom_role_conversions=None,
|
47 |
)
|
48 |
|
49 |
+
requests_get_tool = Tool.from_langchain(RequestsGetTool())
|
|
|
50 |
search_tool = DuckDuckGoSearchTool()
|
51 |
|
52 |
with open("prompts.yaml", 'r') as stream:
|
|
|
54 |
|
55 |
agent = CodeAgent(
|
56 |
model=model,
|
57 |
+
tools=[final_answer, search_tool, requests_get_tool, get_papers_url_for_date, get_current_time_in_timezone],
|
58 |
max_steps=6,
|
59 |
verbosity_level=1,
|
60 |
grammar=None,
|