Spaces:
Sleeping
Sleeping
File size: 808 Bytes
8e25013 c19d193 8e25013 9b5b26a 8e25013 ae7a494 8e25013 46f7576 8e25013 e121372 46f7576 d9195b8 c2ac6c6 13d500a 8c01ffb 8e25013 8c01ffb 8fe992b 8e25013 d9195b8 8c01ffb 2793719 861422e 8fe992b b628e0e |
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 31 32 33 34 |
from smolagents import CodeAgent, HfApiModel
import yaml
from tools import FinalAnswerTool, VisitWebpageTool, DuckDuckGoSearchTool
from Gradio_UI import GradioUI
# Load prompts
with open("prompts.yaml", 'r') as stream:
prompt_templates = yaml.safe_load(stream)
# Initialize tools
final_answer = FinalAnswerTool()
web_search = DuckDuckGoSearchTool(max_results=5)
visit_webpage = VisitWebpageTool()
# Configure model
model = HfApiModel(
max_tokens=2096,
temperature=0.2,
model_id='Qwen/Qwen2.5-Coder-32B-Instruct'
)
# Create agent
agent = CodeAgent(
model=model,
tools=[final_answer, web_search, visit_webpage],
max_steps=6,
verbosity_level=1,
grammar=None,
planning_interval=None,
prompt_templates=prompt_templates
)
# Launch Gradio UI
GradioUI(agent).launch() |