Spaces:
Sleeping
Sleeping
| from smolagents import CodeAgent, HfApiModel | |
| import yaml | |
| from tools import FinalAnswerTool, WeatherTool, DuckDuckGoSearchTool | |
| from Gradio_UI import GradioUI | |
| # Initialize our tools | |
| final_answer = FinalAnswerTool() | |
| weather_tool = WeatherTool() | |
| search_tool = DuckDuckGoSearchTool() | |
| model = HfApiModel( | |
| max_tokens=2096, | |
| temperature=0.5, | |
| model_id='Qwen/Qwen2.5-Coder-32B-Instruct', | |
| custom_role_conversions=None, | |
| ) | |
| with open("prompts.yaml", 'r') as stream: | |
| prompt_templates = yaml.safe_load(stream) | |
| # We're creating our CodeAgent with multiple tools | |
| agent = CodeAgent( | |
| model=model, | |
| tools=[ | |
| final_answer, | |
| search_tool, | |
| weather_tool | |
| ], | |
| max_steps=6, | |
| verbosity_level=1, | |
| grammar=None, | |
| planning_interval=None, | |
| name=None, | |
| description=None, | |
| prompt_templates=prompt_templates | |
| ) | |
| GradioUI(agent).launch() |