File size: 647 Bytes
10e9b7d 4f367b5 10e9b7d 4f367b5 e80aab9 4f367b5 e80aab9 4f367b5 |
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 |
import os
from smolagents import Agent, DuckDuckGoSearchTool
from smolagents.models import OpenAIServerModel
def build_agent():
model = OpenAIServerModel(
model_id="gpt-4o-mini",
api_key=os.environ["OPENAI_API_KEY"],
)
tools = [
DuckDuckGoSearchTool(),
]
agent = Agent(
model=model,
tools=tools,
max_steps=6,
system_prompt=(
"You are a careful research agent. "
"Use search tools when factual information is required. "
"If unsure, search first. "
"Return concise final answers only."
),
)
return agent
|