Annessha18's picture
Update app.py
4f367b5 verified
raw
history blame
647 Bytes
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