You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
50
50
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`.
52
52
To do so, we could import the library's built-in `VisitWebpageTool`, but we will build it again to see how it's done.
53
53
54
54
So let's create our `VisitWebpageTool` tool from scratch using `markdownify`.
Copy file name to clipboardExpand all lines: docs/source/en/guided_tour.mdx
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -281,7 +281,7 @@ When the agent is initialized, the tool attributes are used to generate a tool d
281
281
282
282
### Default toolbox
283
283
284
-
`smolagents` comes with a default toolbox for empowering agents, that you can add to your agent upon initialization with argument `add_base_tools=True`:
284
+
If you install `smolagents` with the "toolkit" extra, it comes with a default toolbox for empowering agents, that you can add to your agent upon initialization with argument `add_base_tools=True`:
285
285
286
286
-**DuckDuckGo web search***: performs a web search using DuckDuckGo browser.
287
287
-**Python code interpreter**: runs your LLM generated Python code in a secure environment. This tool will only be added to [`ToolCallingAgent`] if you initialize it with `add_base_tools=True`, since code-based agent can already natively execute Python code
@@ -290,9 +290,10 @@ When the agent is initialized, the tool attributes are used to generate a tool d
290
290
You can manually use a tool by calling it with its arguments.
291
291
292
292
```python
293
-
from smolagents import DuckDuckGoSearchTool
293
+
# !pip install smolagents[toolkit]
294
+
from smolagents import WebSearchTool
294
295
295
-
search_tool =DuckDuckGoSearchTool()
296
+
search_tool =WebSearchTool()
296
297
print(search_tool("Who's the current president of Russia?"))
- A clear name. The name should be descriptive enough of what this tool does to help the LLM brain powering the agent. Since this tool returns the model with the most downloads for a task, let's name it `model_download_tool`.
341
342
- Type hints on both inputs and output
342
-
- A description, that includes an 'Args:' part where each argument is described (without a type indication this time, it will be pulled from the type hint). Same as for the tool name, this description is an instruction manual for the LLM powering you agent, so do not neglect it.
343
+
- A description, that includes an 'Args:' part where each argument is described (without a type indication this time, it will be pulled from the type hint). Same as for the tool name, this description is an instruction manual for the LLM powering your agent, so do not neglect it.
343
344
344
345
All these elements will be automatically baked into the agent's system prompt upon initialization: so strive to make them as clear as possible!
345
346
@@ -364,7 +365,7 @@ class ModelDownloadTool(Tool):
364
365
365
366
The subclass needs the following attributes:
366
367
- A clear `name`. The name should be descriptive enough of what this tool does to help the LLM brain powering the agent. Since this tool returns the model with the most downloads for a task, let's name it `model_download_tool`.
367
-
- A `description`. Same as for the `name`, this description is an instruction manual for the LLM powering you agent, so do not neglect it.
368
+
- A `description`. Same as for the `name`, this description is an instruction manual for the LLM powering your agent, so do not neglect it.
368
369
- Input types and descriptions
369
370
- Output type
370
371
All these attributes will be automatically baked into the agent's system prompt upon initialization: so strive to make them as clear as possible!
@@ -423,15 +424,15 @@ You can easily build hierarchical multi-agent systems with `smolagents`.
423
424
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.
424
425
Then you can pass this managed agent in the parameter managed_agents upon initialization of the manager agent.
425
426
426
-
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`]:
427
428
428
429
```py
429
-
from smolagents import CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
430
+
from smolagents import CodeAgent, InferenceClientModel, WebSearchTool
430
431
431
432
model = InferenceClientModel()
432
433
433
434
web_agent = CodeAgent(
434
-
tools=[DuckDuckGoSearchTool()],
435
+
tools=[WebSearchTool()],
435
436
model=model,
436
437
name="web_search",
437
438
description="Runs web searches for you. Give it your query as an argument."
Copy file name to clipboardExpand all lines: docs/source/en/tutorials/building_good_agents.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -397,15 +397,15 @@ This also works with the [`ToolCallingAgent`].
397
397
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.
398
398
399
399
```py
400
-
from smolagents import load_tool, CodeAgent, InferenceClientModel, DuckDuckGoSearchTool
400
+
from smolagents import load_tool, CodeAgent, InferenceClientModel, WebSearchTool
Copy file name to clipboardExpand all lines: docs/source/en/tutorials/inspect_runs.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,7 +30,7 @@ Here's how it then looks like on the platform:
30
30
First install the required packages. Here we install [Phoenix by Arize AI](https://github.com/Arize-ai/phoenix) because that's a good solution to collect and inspect the logs, but there are other OpenTelemetry-compatible platforms that you could use for this collection & inspection part.
0 commit comments