Cloudme50's picture
update
024fcea verified
Raw History Blame Contribute Delete
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
)