Spaces:
Running
Running
Upload tool
Browse filesFiles changed (4)
- agent.json+7-7
- app.py+34-14
- requirements.txt+3-3
- tools/visit_webpage.py+2-2
34 unmodified lines353637383940414243444546474849505134 unmodified lines"name": null,"description": null,"authorized_imports": ["time","datetime","pandas","collections","unicodedata","stat","random","math","itertools","statistics","queue","re"]}34 unmodified lines353637383940414243444546474849505134 unmodified lines"name": null,"description": null,"authorized_imports": ["collections","itertools","statistics","stat","random","math","pandas","datetime","queue","re","unicodedata","time"]}
1234567891011121314151617181920212223from 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')GradioUI(agent).launch()12345678910111213141516171819202122232425262728293031323334353637383940414243from 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=['collections', 'itertools', 'statistics', 'stat', 'random', 'math', 'pandas', 'datetime', 'queue', 're', 'unicodedata', 'time'],prompts_path='./prompts.yaml')GradioUI(agent).launch()
12345smolagentsduckduckgo_searchmarkdownifypandasrequests12345markdownifyrequestspandasduckduckgo_searchsmolagents
12345678from typing import Any, Optionalfrom smolagents.tools import Toolimport smolagentsimport requestsimport markdownifyclass VisitWebpageTool(Tool):name = "visit_webpage"12345678from typing import Any, Optionalfrom smolagents.tools import Toolimport markdownifyimport requestsimport smolagentsclass VisitWebpageTool(Tool):name = "visit_webpage"
agent.json+7-7
app.py+34-14
requirements.txt+3-3
tools/visit_webpage.py+2-2