Spaces:
Runtime error
Runtime error
File size: 569 Bytes
fdc6408 8fe992b fdc6408 9b5b26a fdc6408 8c01ffb fdc6408 8c01ffb 42d25e8 8fe992b fdc6408 8fe992b fdc6408 c36c687 fdc6408 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
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)
|