Spaces:
Build error
Build error
File size: 899 Bytes
20d9528 3a92bf4 20d9528 657f4cd 20d9528 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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
|