aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Himanshu Mittal <himsmittal@gmail.com> 2024-01-02 21:02:18 +0530
committerGravatar GitHub <noreply@github.com> 2024-01-02 16:32:18 +0100
commitb8238c222841860daf351d459691d42a4dee35c5 (patch)
tree38bb8a556e842c8ea151b32920034da621afb753
parentfix(agent/release): Add gitpython as a direct dependency (diff)
downloadAuto-GPT-b8238c222841860daf351d459691d42a4dee35c5.tar.gz
Auto-GPT-b8238c222841860daf351d459691d42a4dee35c5.tar.bz2
Auto-GPT-b8238c222841860daf351d459691d42a4dee35c5.zip
[Documentation Update] Updating Using and Creating Abilities to use Action Annotations (#6653)
Changing ability documentation
-rw-r--r--autogpts/forge/tutorials/003_crafting_agent_logic.md16
1 files changed, 8 insertions, 8 deletions
diff --git a/autogpts/forge/tutorials/003_crafting_agent_logic.md b/autogpts/forge/tutorials/003_crafting_agent_logic.md
index 4a5066fa9..41a057a34 100644
--- a/autogpts/forge/tutorials/003_crafting_agent_logic.md
+++ b/autogpts/forge/tutorials/003_crafting_agent_logic.md
@@ -264,16 +264,16 @@ Extracting clear messages from LLM outputs can be complex. Our method is simple
Abilities are the gears and levers that enable the agent to interact with tasks at hand. Let's unpack the mechanisms behind these abilities and how you can harness, and even extend, them.
-In the SDK, there's a `abilities` folder containing `registry.py`, `finish.py`, and a `file_system` subfolder. You can also add your own abilities here. `registry.py` is the main file for abilities. It contains the `@ability` decorator and the `AbilityRegister` class. This class actively tracks abilities and outlines their function. The base Agent class includes a default ability register available via `self.abilities`. It looks like this:
+In the Forge folder, there's a `actions` folder containing `registry.py`, `finish.py`, and a `file_system` subfolder. You can also add your own abilities here. `registry.py` is the main file for abilities. It contains the `@action` decorator and the `ActionRegister` class. This class actively tracks abilities and outlines their function. The base Agent class includes a default Action register available via `self.abilities`. It looks like this:
```python
-self.abilities = AbilityRegister(self)
+self.abilities = ActionRegister(self)
```
-The `AbilityRegister` has two key methods. `list_abilities_for_prompt` prepares abilities for prompts. `run_ability` makes the ability work. An ability is a function with the `@ability` decorator. It must have specific parameters, including the agent and `task_id`.
+The `ActionRegister` has two key methods. `list_abilities_for_prompt` prepares abilities for prompts. `run_action` makes the ability work. An ability is a function with the `@action` decorator. It must have specific parameters, including the agent and `task_id`.
```python
-@ability(
+@action(
name="write_file",
description="Write data to a file",
parameters=[
@@ -296,14 +296,14 @@ async def write_file(agent, task_id: str, file_path: str, data: bytes) -> None:
pass
```
-The `@ability` decorator defines the ability's details, like its identity (name), functionality (description), and operational parameters.
+The `@action` decorator defines the ability's details, like its identity (name), functionality (description), and operational parameters.
## Example of a Custom Ability: Webpage Fetcher
```python
import requests
-@ability(
+@action(
name="fetch_webpage",
description="Retrieve the content of a webpage",
parameters=[
@@ -339,7 +339,7 @@ With the ability details, we use it. We call the `run_ability` function:
```python
# Run the ability and get the output
# We don't actually use the output in this example
-output = await self.abilities.run_ability(
+output = await self.abilities.run_action(
task_id, ability["name"], **ability["args"]
)
```
@@ -420,7 +420,7 @@ async def execute_step(self, task_id: str, step_request: StepRequestBody) -> Ste
# Run the ability and get the output
# We don't actually use the output in this example
- output = await self.abilities.run_ability(
+ output = await self.abilities.run_action(
task_id, ability["name"], **ability["args"]
)