Skip to content

Commit 696d147

Browse files
Few doc improvements
1 parent aa06a7a commit 696d147

File tree

4 files changed

+27
-34
lines changed

4 files changed

+27
-34
lines changed

docs/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ Once you have setup the `doc-builder` and additional packages with the pip insta
4747
you can generate the documentation by typing the following command:
4848

4949
```bash
50-
doc-builder build smolagents docs/source/ --build_dir ~/tmp/test-build
50+
doc-builder build smolagents docs/source/en/ --build_dir ~/tmp/test-build
5151
```
5252

5353
You can adapt the `--build_dir` to set any temporary folder that you prefer. This command will create it and generate
@@ -59,7 +59,7 @@ Markdown editor.
5959
To preview the docs, run the following command:
6060

6161
```bash
62-
doc-builder preview smolagents docs/source/
62+
doc-builder preview smolagents docs/source/en/
6363
```
6464

6565
The docs will be viewable at [http://localhost:5173](http://localhost:5173). You can also preview the docs once you

docs/source/en/conceptual_guides/intro_agents.md

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,28 @@ rendered properly in your Markdown viewer.
1515
-->
1616
# Introduction to Agents
1717

18-
### What is an agent?
18+
### 🤔 What are agents?
1919

20-
Any efficient system using AI will need to provide LLMs some kind of access to the real world: for instance the possibility to call a search tool to get external information, or to act on certain programs in order to solve a task.
20+
Any efficient system using AI will need to provide LLMs some kind of access to the real world: for instance the possibility to call a search tool to get external information, or to act on certain programs in order to solve a task. In other words, LLMs should have ***agency***. Agentic programs are the gateway to the outside world for LLMs.
2121

22-
In other words, give them some ***agency***. Agentic programs are the gateway to the outside world for LLMs.
23-
24-
For a rigorous definition, AI Agents are *“programs in which the workflow is determined by LLM outputs”*.
22+
> [!TIP]
23+
> AI Agents are **programs where LLM outputs control the workflow**.
2524
2625
Any system leveraging LLMs will integrate the LLM outputs into code. The influence of the LLM's input on the code workflow is the level of agency of LLMs in the system.
2726

28-
Note that with this definition, "agent" is not a discrete, 0 or 1 definition: instead, "agency" evolves on a continuous spectrum, as you give more or less influence to the LLM on your workflow.
29-
30-
- If the output of the LLM has no impact on the workflow, as in a program that just postprocesses a LLM's output and returns it, this system is not agentic at all.
31-
- If an LLM output is used to determine which branch of an `if/else` switch is ran, the system starts to have some level of agency: it's a router.
32-
33-
Then it can get more agentic.
27+
Note that with this definition, "agent" is not a discrete, 0 or 1 definition: instead, "agency" evolves on a continuous spectrum, as you give more or less power to the LLM on your workflow.
3428

35-
- If you use an LLM output to determine which function is run and with which arguments, that's tool calling.
36-
- If you use an LLM output to determine if you should keep iterating in a while loop, you have a multi-step agent.
29+
See in the table below how agency can vary across systems:
3730

38-
| Agency Level | Description | How that's called | Example Pattern |
39-
|-------------|-------------|-------------|-----------------|
40-
| No Agency | LLM output has no impact on program flow | Simple Processor | `process_llm_output(llm_response)` |
41-
| Basic Agency | LLM output determines basic control flow | Router | `if llm_decision(): path_a() else: path_b()` |
42-
| Higher Agency | LLM output determines function execution | Tool Caller | `run_function(llm_chosen_tool, llm_chosen_args)` |
43-
| High Agency | LLM output controls iteration and program continuation | Multi-step Agent | `while llm_should_continue(): execute_next_step()` |
44-
| High Agency | One agentic workflow can start another agentic workflow | Multi-Agent | `if llm_trigger(): execute_agent()` |
31+
| Agency Level | Description | How that's called | Example Pattern |
32+
| ------------ | ------------------------------------------------------- | ----------------- | -------------------------------------------------- |
33+
| ☆☆☆ | LLM output has no impact on program flow | Simple Processor | `process_llm_output(llm_response)` |
34+
| ★☆☆ | LLM output determines basic control flow | Router | `if llm_decision(): path_a() else: path_b()` |
35+
| ★★☆ | LLM output determines function execution | Tool Caller | `run_function(llm_chosen_tool, llm_chosen_args)` |
36+
| ★★★ | LLM output controls iteration and program continuation | Multi-step Agent | `while llm_should_continue(): execute_next_step()` |
37+
| ★★★ | One agentic workflow can start another agentic workflow | Multi-Agent | `if llm_trigger(): execute_agent()` |
4538

46-
Since the system’s versatility goes in lockstep with the level of agency that you give to the LLM, agentic systems can perform much broader tasks than any classic program.
47-
48-
Programs are not just tools anymore, confined to an ultra-specialized task : they are agents.
49-
50-
One type of agentic system is quite simple: the multi-step agent. It has this structure:
39+
The multi-step agent has this code structure:
5140

5241
```python
5342
memory = [user_defined_task]
@@ -57,7 +46,11 @@ while llm_should_continue(memory): # this loop is the multi-step part
5746
memory += [action, observations]
5847
```
5948

60-
This agentic system just runs in a loop, execution a new action at each step (the action can involve calling some pre-determined *tools* that are just functions), until its observations make it apparent that a satisfactory state has been reached to solve the given task.
49+
This agentic system runs in a loop, executing a new action at each step (the action can involve calling some pre-determined *tools* that are just functions), until its observations make it apparent that a satisfactory state has been reached to solve the given task. Here’s an example of how a multi-step agent can solve a simple math question:
50+
51+
<div class="flex justify-center">
52+
<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/Agent_ManimCE.gif"/>
53+
</div>
6154

6255

6356
### When to use an agentic system ?
@@ -114,12 +107,12 @@ All these elements need tight coupling to make a well-functioning system. That's
114107

115108
Why is code better? Well, because we crafted our code languages specifically to be great at expressing actions performed by a computer. If JSON snippets were a better way, JSON would be the top programming language and programming would be hell on earth.
116109

117-
Code has better:
110+
Writing actions in code rather than JSON-like snippets provides better:
118111

119112
- **Composability:** could you nest JSON actions within each other, or define a set of JSON actions to re-use later, the same way you could just define a python function?
120113
- **Object management:** how do you store the output of an action like `generate_image` in JSON?
121-
- **Generality:** code is built to express simply anything you can do have a computer do.
122-
- **Representation in LLM training corpuses:** why not leverage this benediction of the sky that plenty of quality actions have already been included in LLM training corpuses?
114+
- **Generality:** code is built to express simply anything you can have a computer do.
115+
- **Representation in LLM training data:** plenty of quality code actions is already included in LLMs’ training data which means they’re already trained for this!
123116

124117
This is illustrated on the figure below, taken from [Executable Code Actions Elicit Better LLM Agents](https://huggingface.co/papers/2402.01030).
125118

docs/source/en/examples/multiagents.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ translates to about 2,660,762 GWh/year.
192192
2021.
193193
```
194194

195-
Seems like we'll need some sizeable powerplants if the scaling hypothesis continues.
195+
Seems like we'll need some sizeable powerplants if the [scaling hypothesis](https://gwern.net/scaling-hypothesis) continues to hold true.
196196

197197
Our agents managed to efficiently collaborate towards solving the task! ✅
198198

199-
💡 You can easily extend this to more agents: one does the code execution, one the web search, one handles file loadings...
199+
💡 You can easily extend this orchestration to more agents: one does the code execution, one the web search, one handles file loadings...

docs/source/en/tutorials/building_good_agents.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ agent.run(
131131
additional_args={"mp3_sound_file_url":'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/recording.mp3'}
132132
)
133133
```
134-
For instance, use this to pass images or strings.
134+
For instance, you can use this `additional_args` argument to pass images or strings that you want your agent to leverage.
135135

136136

137137

0 commit comments

Comments
 (0)