Skip to content

Commit 98661a8

Browse files
Replace DuckDuckGoSearchTool with WebSearchTool in docs (huggingface#1303)
1 parent 7629223 commit 98661a8

23 files changed

Lines changed: 66 additions & 61 deletions

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ pip install smolagents[toolkit]
5757
```
5858
Then define your agent, give it the tools it needs and run it!
5959
```py
60-
from smolagents import CodeAgent, DuckDuckGoSearchTool, InferenceClientModel
60+
from smolagents import CodeAgent, WebSearchTool, InferenceClientModel
6161

6262
model = InferenceClientModel()
63-
agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
63+
agent = CodeAgent(tools=[WebSearchTool()], model=model)
6464

6565
agent.run("How many seconds would it take for a leopard at full speed to run through Pont des Arts?")
6666
```

docs/source/en/examples/multiagents.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
4646

4747
## 🔍 Create a web search tool
4848

49-
For web browsing, we can already use our pre-existing [`DuckDuckGoSearchTool`](https://github.com/huggingface/smolagents/blob/main/src/smolagents/default_tools.py#L151-L176) tool to provide a Google search equivalent.
49+
For web browsing, we can already use our native [`WebSearchTool`] tool to provide a Google search equivalent.
5050

51-
But then we will also need to be able to peak into the page found by the `DuckDuckGoSearchTool`.
51+
But then we will also need to be able to peak into the page found by the `WebSearchTool`.
5252
To do so, we could import the library's built-in `VisitWebpageTool`, but we will build it again to see how it's done.
5353

5454
So let's create our `VisitWebpageTool` tool from scratch using `markdownify`.
@@ -109,14 +109,14 @@ from smolagents import (
109109
CodeAgent,
110110
ToolCallingAgent,
111111
InferenceClientModel,
112-
DuckDuckGoSearchTool,
112+
WebSearchTool,
113113
LiteLLMModel,
114114
)
115115

116116
model = InferenceClientModel(model_id=model_id)
117117

118118
web_agent = ToolCallingAgent(
119-
tools=[DuckDuckGoSearchTool(), visit_webpage],
119+
tools=[WebSearchTool(), visit_webpage],
120120
model=model,
121121
max_steps=10,
122122
name="web_search_agent",

docs/source/en/guided_tour.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ You can manually use a tool by calling it with its arguments.
291291

292292
```python
293293
# !pip install smolagents[toolkit]
294-
from smolagents import DuckDuckGoSearchTool
294+
from smolagents import WebSearchTool
295295

296-
search_tool = DuckDuckGoSearchTool()
296+
search_tool = WebSearchTool()
297297
print(search_tool("Who's the current president of Russia?"))
298298
```
299299

@@ -424,15 +424,15 @@ You can easily build hierarchical multi-agent systems with `smolagents`.
424424
To do so, just ensure your agent has `name` and`description` attributes, which will then be embedded in the manager agent's system prompt to let it know how to call this managed agent, as we also do for tools.
425425
Then you can pass this managed agent in the parameter managed_agents upon initialization of the manager agent.
426426

427-
Here's an example of making an agent that managed a specific web search agent using our [`DuckDuckGoSearchTool`]:
427+
Here's an example of making an agent that managed a specific web search agent using our native [`WebSearchTool`]:
428428

429429
```py
430-
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
430+
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool
431431

432432
model = InferenceClientModel()
433433

434434
web_agent = CodeAgent(
435-
tools=[DuckDuckGoSearchTool()],
435+
tools=[WebSearchTool()],
436436
model=model,
437437
name="web_search",
438438
description="Runs web searches for you. Give it your query as an argument."

docs/source/en/reference/tools.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ contains the API docs for the underlying classes.
4242

4343
[[autodoc]] UserInputTool
4444

45+
### WebSearchTool
46+
47+
[[autodoc]] WebSearchTool
48+
4549
### DuckDuckGoSearchTool
4650

4751
[[autodoc]] DuckDuckGoSearchTool

docs/source/en/tutorials/building_good_agents.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,15 @@ This also works with the [`ToolCallingAgent`].
397397
We provide a model for a supplementary planning step, that an agent can run regularly in-between normal action steps. In this step, there is no tool call, the LLM is simply asked to update a list of facts it knows and to reflect on what steps it should take next based on those facts.
398398

399399
```py
400-
from smolagents import load_tool, CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
400+
from smolagents import load_tool, CodeAgent, InferenceClientModel, WebSearchTool
401401
from dotenv import load_dotenv
402402

403403
load_dotenv()
404404

405405
# Import tool from Hub
406406
image_generation_tool = load_tool("m-ric/text-to-image", trust_remote_code=True)
407407

408-
search_tool = DuckDuckGoSearchTool()
408+
search_tool = WebSearchTool()
409409

410410
agent = CodeAgent(
411411
tools=[search_tool, image_generation_tool],

docs/source/en/tutorials/inspect_runs.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ Then you can run your agents!
5454
from smolagents import (
5555
CodeAgent,
5656
ToolCallingAgent,
57-
DuckDuckGoSearchTool,
57+
WebSearchTool,
5858
VisitWebpageTool,
5959
InferenceClientModel,
6060
)
6161

6262
model = InferenceClientModel()
6363

6464
search_agent = ToolCallingAgent(
65-
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
65+
tools=[WebSearchTool(), VisitWebpageTool()],
6666
model=model,
6767
name="search_agent",
6868
description="This is an agent that can do web search.",
@@ -143,7 +143,7 @@ SmolagentsInstrumentor().instrument(tracer_provider=trace_provider)
143143
from smolagents import (
144144
CodeAgent,
145145
ToolCallingAgent,
146-
DuckDuckGoSearchTool,
146+
WebSearchTool,
147147
VisitWebpageTool,
148148
InferenceClientModel,
149149
)
@@ -153,7 +153,7 @@ model = InferenceClientModel(
153153
)
154154

155155
search_agent = ToolCallingAgent(
156-
tools=[DuckDuckGoSearchTool(), VisitWebpageTool()],
156+
tools=[WebSearchTool(), VisitWebpageTool()],
157157
model=model,
158158
name="search_agent",
159159
description="This is an agent that can do web search.",

docs/source/en/tutorials/memory.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Then you should pass this function in the `step_callbacks` argument upon initial
8383

8484
```py
8585
CodeAgent(
86-
tools=[DuckDuckGoSearchTool(), go_back, close_popups, search_item_ctrl_f],
86+
tools=[WebSearchTool(), go_back, close_popups, search_item_ctrl_f],
8787
model=model,
8888
additional_authorized_imports=["helium"],
8989
step_callbacks=[update_screenshot],

docs/source/hi/examples/multiagents.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ model_id = "Qwen/Qwen2.5-Coder-32B-Instruct"
4949

5050
## 🔍 एक वेब सर्च टूल बनाएं
5151

52-
वेब ब्राउज़िंग के लिए, हम पहले से मौजूद [`DuckDuckGoSearchTool`](https://github.com/huggingface/smolagents/blob/main/src/smolagents/default_tools.py#L151-L176) टूल का उपयोग कर सकते हैं जो Google search के समान सुविधा प्रदान करता है।
52+
वेब ब्राउज़िंग के लिए, हम पहले से मौजूद [`WebSearchTool`] टूल का उपयोग कर सकते हैं जो Google search के समान सुविधा प्रदान करता है।
5353

54-
लेकिन फिर हमें `DuckDuckGoSearchTool` द्वारा खोजे गए पेज को देखने में भी सक्षम होने की आवश्यकता होगी।
54+
लेकिन फिर हमें `WebSearchTool` द्वारा खोजे गए पेज को देखने में भी सक्षम होने की आवश्यकता होगी।
5555
ऐसा करने के लिए, हम लाइब्रेरी के बिल्ट-इन `VisitWebpageTool` को इम्पोर्ट कर सकते हैं, लेकिन हम इसे फिर से बनाएंगे यह देखने के लिए कि यह कैसे किया जाता है।
5656

5757
तो आइए `markdownify` का उपयोग करके शुरू से अपना `VisitWebpageTool` टूल बनाएं।
@@ -113,14 +113,14 @@ from smolagents import (
113113
ToolCallingAgent,
114114
InferenceClientModel,
115115
ManagedAgent,
116-
DuckDuckGoSearchTool,
116+
WebSearchTool,
117117
LiteLLMModel,
118118
)
119119

120120
model = InferenceClientModel(model_id=model_id)
121121

122122
web_agent = ToolCallingAgent(
123-
tools=[DuckDuckGoSearchTool(), visit_webpage],
123+
tools=[WebSearchTool(), visit_webpage],
124124
model=model,
125125
max_steps=10,
126126
)

docs/source/hi/guided_tour.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,9 @@ agent.run("Could you get me the title of the page at url 'https://huggingface.co
152152
आप मैन्युअल रूप से एक टूल का उपयोग उसके आर्ग्यूमेंट्स के साथ कॉल करके कर सकते हैं।
153153

154154
```python
155-
from smolagents import DuckDuckGoSearchTool
155+
from smolagents import WebSearchTool
156156

157-
search_tool = DuckDuckGoSearchTool()
157+
search_tool = WebSearchTool()
158158
print(search_tool("Who's the current president of Russia?"))
159159
```
160160

@@ -283,14 +283,14 @@ Microsoft के फ्रेमवर्क [Autogen](https://huggingface.co/pa
283283

284284
ऐसा करने के लिए, एजेंट को [`ManagedAgent`] ऑब्जेक्ट में समाहित करें। यह ऑब्जेक्ट `agent`, `name`, और एक `description` जैसे तर्कों की आवश्यकता होती है, जो फिर मैनेजर एजेंट की सिस्टम प्रॉम्प्ट में एम्बेड किया जाता है
285285

286-
यहां एक एजेंट बनाने का उदाहरण दिया गया है जो हमारे [`DuckDuckGoSearchTool`] का उपयोग करके एक विशिष्ट वेब खोज एजेंट को प्रबंधित करता है।
286+
यहां एक एजेंट बनाने का उदाहरण दिया गया है जो हमारे [`WebSearchTool`] का उपयोग करके एक विशिष्ट वेब खोज एजेंट को प्रबंधित करता है।
287287

288288
```py
289-
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool, ManagedAgent
289+
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool, ManagedAgent
290290

291291
model = InferenceClientModel()
292292

293-
web_agent = CodeAgent(tools=[DuckDuckGoSearchTool()], model=model)
293+
web_agent = CodeAgent(tools=[WebSearchTool()], model=model)
294294

295295
managed_web_agent = ManagedAgent(
296296
agent=web_agent,

docs/source/hi/tutorials/building_good_agents.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,15 +397,15 @@ This also works with the [`ToolCallingAgent`].
397397
हम पूरक योजना चरण के लिए एक मॉडल प्रदान करते हैं, जिसे एजेंट सामान्य क्रियाओं के चरणों के बीच नियमित रूप से चला सकता है। इस चरण में कोई टूल कॉल नहीं होती है, LLM से केवल उन तथ्यों की सूची को अपडेट करने के लिए कहा जाता है जो उसे ज्ञात हैं और इन तथ्यों के आधार पर उसे अगले कदमों के बारे में विचार करना होता है।
398398

399399
```py
400-
from smolagents import load_tool, CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
400+
from smolagents import load_tool, CodeAgent, InferenceClientModel, WebSearchTool
401401
from dotenv import load_dotenv
402402

403403
load_dotenv()
404404

405405
# Import tool from Hub
406406
image_generation_tool = load_tool("m-ric/text-to-image", trust_remote_code=True)
407407

408-
search_tool = DuckDuckGoSearchTool()
408+
search_tool = WebSearchTool()
409409

410410
agent = CodeAgent(
411411
tools=[search_tool],

0 commit comments

Comments
 (0)