gprasanna's picture
Update app.py
c36c687 verified
raw
history blame contribute delete
569 Bytes
from smolagents import CodeAgent, DuckDuckGoSearchTool, HfApiModel
# Model using Hugging Face Inference API
model = HfApiModel() # or HfApiModel("Qwen/Qwen2.5-72B-Instruct", api_key="...")
# Instantiate the DuckDuckGo search tool
search_tool = DuckDuckGoSearchTool(max_results=10)
# Create an agent that can use the search tool
agent = CodeAgent(
tools=[search_tool],
model=model,
add_base_tools=False, # you can set True to also add built-in tools
)
# Run a query that may trigger web search
result = agent.run("What day is it today?")
print(result)