Skip to content

Commit ddcdcfb

Browse files
committed
add a readme in tuner
1 parent b8a5df6 commit ddcdcfb

File tree

4 files changed

+64
-2
lines changed

4 files changed

+64
-2
lines changed

tuner/README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# AgentScope Tuner
2+
3+
This directory contains several examples of how to use the AgentScope Tuner for tuning AgentScope applications. The table below summarizes the available examples:
4+
5+
| Example Name | Description | Example Path | Multi-step Interaction | LLM-as-a-Judge | Tool-use | Multi-Agent | Data Augmentation |
6+
|-------------------|------------------------------------------------------------------------------------|---------------------------------|-------------------------|-----------------|----------|-------------|-------------------|
7+
| Math Agent | A quick start example for tuning a math-solving agent to enhance its capabilities. | [math_agent](./math_agent) ||||||
8+
| Frozen Lake | Make an agent to navigate the Frozen Lake environment in multi-step interactions. | [frozen_lake](./frozen_lake) ||||||
9+
| Learn to Ask | Using LLM as a judge to provide feedback to facilitate agent tuning. | [learn_to_ask](./learn_to_ask) ||||||
10+
| Email Search | Enhance the tool use ability of your agent on tasks without ground truth. | [email_search](./email_search) ||||||
11+
| Werewolf Game | Enhance the agent's performance in a multi-agent game setting. | [werewolf_game](./werewolf_game)||||||
12+
| Data Augment | Data augmentation for better tuning results. | [data_augment](./data_augment) ||||||
13+
14+
Each example contains a README file with detailed instructions on how to set up and run the tuning process for that specific scenario. Feel free to explore and modify the examples to suit your needs!
15+
16+
17+
## Prerequisites
18+
19+
AgentScope Tuner requires:
20+
21+
- Python 3.10 or higher
22+
- `agentscope>=1.0.12`
23+
- `trinity-rft>=0.4.1`
24+
25+
AgentScope Tuner is built on top of [Trinity-RFT](https://github.com/modelscope/Trinity-RFT).
26+
Please refer to the [Trinity-RFT installation guide](https://modelscope.github.io/Trinity-RFT/en/main/tutorial/trinity_installation.html)
27+
for detailed instructions on how to set up the environment.

tuner/README_zh.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# AgentScope Tuner 中文说明
2+
3+
本目录包含了多个使用 AgentScope Tuner 对 AgentScope 应用进行调优的示例。下表总结了可用的示例:
4+
5+
| 示例名称 | 描述 | 示例路径 | 多步交互 | LLM 评审 | 工具使用 | 多智能体 | 数据增强 |
6+
|------------------|-------------------------------------------|---------------------------------|----------|----------|----------|----------|----------|
7+
| 数学智能体 | 快速入门示例,调优数学智能体以提升其能力。 | [math_agent](./math_agent) ||||||
8+
| Frozen Lake | 让智能体在多步交互中导航冰湖环境。 | [frozen_lake](./frozen_lake) ||||||
9+
| Learn to Ask | 使用 LLM 作为评审,为智能体调优提供反馈 | [learn_to_ask](./learn_to_ask) ||||||
10+
| 邮件搜索 | 在无标准答案任务中提升智能体的工具使用能力。 | [email_search](./email_search) ||||||
11+
| 狼人杀游戏 | 提升智能体在多智能体游戏场景下的表现。 | [werewolf_game](./werewolf_game)||||||
12+
| 数据增强 | 通过数据增强获得更好的调优效果。 | [data_augment](./data_augment) ||||||
13+
14+
每个示例目录下均包含详细的 README 文件,介绍了该场景下的调优流程和使用方法。欢迎根据实际需求进行探索和修改!
15+
16+
## 先决条件
17+
18+
AgentScope Tuner 需要:
19+
20+
- Python 3.10 或更高版本
21+
- `agentscope>=1.0.12`
22+
- `trinity-rft>=0.4.1`
23+
24+
AgentScope Tuner 构建于 [Trinity-RFT](https://github.com/modelscope/Trinity-RFT) 之上。
25+
请参考 [Trinity-RFT 安装指南](https://modelscope.github.io/Trinity-RFT/zh/main/tutorial/trinity_installation.html)
26+
获取详细的安装方法。

tuner/math_agent/README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This guide walks you through the steps to implement and train an agent workflow
77

88
To train your agent workflow using RL, you need to understand three components:
99

10-
1. **Workflow function**: Refactor your agent workflow into a workflow function that follows the specified input/output signature.
10+
1. **Workflow function**: Refactor your agent application into a workflow function that follows the specified input/output signature.
1111
2. **Judge function**: Implement a judge function that computes rewards based on the agent's responses.
1212
3. **Task dataset**: Prepare a dataset containing training samples for the agent to learn.
1313

@@ -29,6 +29,10 @@ flowchart TD
2929
class Task taskcolor;
3030
```
3131

32+
The workflow function takes a chat model and a task from dataset as input, and produces the agent's response.
33+
The judge function takes the same task and the agent's response as input, and computes a scalar reward.
34+
The judge function is optional; if not provided, the workflow function can directly output the reward.
35+
3236
## How to implement
3337

3438
Here we use a math problem solving scenario as an example to illustrate how to implement the above three components.
@@ -37,12 +41,15 @@ Suppose you have an agent workflow that solves math problems using the `ReActAge
3741

3842
```python
3943
from agentscope.agent import ReActAgent
44+
from agentscope.model import OpenAIChatModel
4045
from agentscope.formatter import OpenAIChatFormatter
4146
from agentscope.message import Msg
4247

4348

4449
async def run_react_agent(query: str):
45-
# model = ... # Initialize your ChatModel here
50+
model = OpenAIChatModel(
51+
# your model config here...
52+
)
4653

4754
agent = ReActAgent(
4855
name="react_agent",

tuner/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
agentscope[full]>=1.0.12
2+
trinity-rft>=0.4.1

0 commit comments

Comments
 (0)