Bastati's picture
Updated the agent
3a92bf4
raw
history blame contribute delete
899 Bytes
import yaml
from smolagents import CodeAgent,InferenceClientModel
from tools import DuckDuckGoSearchTool,VisitWebpageTool,ReadPythonScript,FinalAnswerTool
with open("prompts.yaml", 'r') as stream:
prompt_templates = yaml.safe_load(stream)
search_tool = DuckDuckGoSearchTool()
web_page_visit_tool = VisitWebpageTool()
python_script_reader_tool = ReadPythonScript()
final_answer = FinalAnswerTool()
# --- Basic Agent Definition ---
def build_agent(model_id:str='Qwen/Qwen2.5-Coder-32B-Instruct'):
model = InferenceClientModel(
max_tokens=4192,
temperature=0.5,
model_id=model_id,# it is possible that this model may be overloaded
custom_role_conversions=None,
)
agent = CodeAgent(
model=model,
tools=[search_tool,web_page_visit_tool,python_script_reader_tool],
prompt_templates=prompt_templates,
name= "Alex"
)
return agent