Upload tool
Browse filesFiles changed (4)
- agent.json+6-6
- app.py+16-17
- requirements.txt+3-3
- tools/visit_webpage.py+1-1
34 unmodified lines353637383940414243444546474849505134 unmodified lines"name": null,"description": null,"authorized_imports": ["datetime","queue","stat","itertools","pandas","random","collections","math","statistics","unicodedata","re","time"]}34 unmodified lines353637383940414243444546474849505134 unmodified lines"name": null,"description": null,"authorized_imports": ["unicodedata","datetime","queue","itertools","stat","time","pandas","re","random","statistics","collections","math"]}
1234567891011121314151617181920212223from smolagents import GradioUI, CodeAgent, HfApiModelfrom scripts.web_search import DuckDuckGoSearchToolfrom scripts.visit_webpage import VisitWebpageToolfrom scripts.final_answer import FinalAnswerToolmodel = HfApiModel()web_search = DuckDuckGoSearchTool()visit_webpage = VisitWebpageTool()final_answer = FinalAnswerTool()agent = CodeAgent(model=model,tools= [web_search, visit_webpage, final_answer],max_steps=6,verbosity_level=1,grammar=None,planning_interval=None,name=None,description=None,authorized_imports=['datetime', 'queue', 'stat', 'itertools', 'pandas', 'random', 'collections', 'math', 'statistics', 'unicodedata', 're', 'time'],prompts_path='./prompts.yaml')12345678910111213141516171819202122from smolagents import GradioUI, {{ class_name }}, {{ agent_dict['model']['class'] }}{% for tool in tools.values() %}from scripts.{{ tool.name }} import {{ tool.__class__.__name__ }}{% endfor %}model = {{ agent_dict['model']['class'] }}(){% for tool in tools.values() %}{{ tool.name }} = {{ tool.__class__.__name__ }}(){% endfor %}agent = {{ class_name }}(model=model,tools=[{% for tool in tools.keys() %}{{ tool }}{% if not loop.last %}, {% endif %}{% endfor %}],{% for attribute_name, value in agent_dict.items() if attribute_name not in ["model", "tools", "prompt_templates"] %}{{ attribute_name }}={{ value }},{% endfor %}prompts_path='./prompts.yaml')
12345smolagentsrequestsduckduckgo_searchpandasmarkdownify12345requestsmarkdownifypandassmolagentsduckduckgo_search
12345678from typing import Any, Optionalfrom smolagents.tools import Toolimport markdownifyimport smolagentsimport requestsclass VisitWebpageTool(Tool):name = "visit_webpage"12345678from typing import Any, Optionalfrom smolagents.tools import Toolimport markdownifyimport requestsimport smolagentsclass VisitWebpageTool(Tool):name = "visit_webpage"
agent.json+6-6
app.py+16-17
requirements.txt+3-3
tools/visit_webpage.py+1-1