Spaces:
Runtime error
Runtime error
Download agent_core.py from Cloudme50/Unit_4_Final_Assignment_AIAgent: direct link, hf CLI and curl.
- Browser
- Download file 944 Bytes
-
https://huggingface.co/spaces/Cloudme50/Unit_4_Final_Assignment_AIAgent/resolve/main/agent_core.py
- Command line
-
hf download hf://spaces/Cloudme50/Unit_4_Final_Assignment_AIAgent/agent_core.py
-
curl -L -o agent_core.py https://huggingface.co/spaces/Cloudme50/Unit_4_Final_Assignment_AIAgent/resolve/main/agent_core.py
944 Bytes
| # agent_core.py | |
| from smolagents import CodeAgent, HfApiModel | |
| from tools import DuckDuckGoSearchTool, WeatherInfoTool, HubStatsTool | |
| from retriever import load_guest_dataset | |
| # Initialize model | |
| model = HfApiModel( | |
| max_tokens=2096, | |
| temperature=0.5, | |
| #model_id='https://pflgm2locj2t89co.us-east-1.aws.endpoints.huggingface.cloud', | |
| #model_id='meta-llama/Llama-3.2-3B-Instruct',# it is possible that this model may be overloaded | |
| model_id='Qwen/Qwen2.5-Coder-32B-Instruct',# it is possible that this model may be overloaded | |
| custom_role_conversions=None, | |
| ) | |
| # Initialize tools | |
| search_tool = DuckDuckGoSearchTool() | |
| weather_info_tool = WeatherInfoTool() | |
| hub_stats_tool = HubStatsTool() | |
| guest_info_tool = load_guest_dataset() | |
| # Initialize Agent (a.k.a. Alfred) | |
| alfred = CodeAgent( | |
| tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool], | |
| model=model, | |
| add_base_tools=True, | |
| planning_interval=3 | |
| ) | |