Skip to content

Commit

Permalink
Update sphinx doc for v0.0.2 (#125)
Browse files Browse the repository at this point in the history
  • Loading branch information
pan-x-c authored Mar 29, 2024
1 parent b6342b2 commit a930908
Show file tree
Hide file tree
Showing 21 changed files with 164 additions and 80 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ the following libraries.
- Distribution
- [Distributed Conversation](./examples/distributed_basic)
- [Distributed Debate](./examples/distributed_debate)
- [Distributed Search](./examples/distributed_search)
- [Distributed Parallel Search](./examples/distributed_search)

More models, services and examples are coming soon!

Expand All @@ -136,7 +136,7 @@ install AgentScope from source._**
git clone https://github.com/modelscope/agentscope.git

# Install the package in editable mode
cd AgentScope
cd agentscope
pip install -e .
```

Expand Down
4 changes: 2 additions & 2 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ AgentScope支持使用以下库快速部署本地模型服务。
- 分布式
- [分布式对话](./examples/distributed_basic)
- [分布式辩论](./examples/distributed_debate)
- [分布式搜索](./examples/distributed_search)
- [分布式并行搜索](./examples/distributed_search)

更多模型API、服务和示例即将推出!

Expand All @@ -122,7 +122,7 @@ AgentScope需要Python 3.9或更高版本。
# 从github拉取源代码
git clone https://github.com/modelscope/agentscope.git
# 以编辑模式安装包
cd AgentScope
cd agentscope
pip install -e .
```

Expand Down
24 changes: 24 additions & 0 deletions docs/sphinx_doc/en/source/agentscope.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ model module
:undoc-members:
:show-inheritance:

dashscope\_model module
---------------------------------------

.. automodule:: agentscope.models.dashscope_model
:members:
:undoc-members:
:show-inheritance:

openai\_model module
---------------------------------------

Expand All @@ -25,6 +33,22 @@ openai\_model module
:undoc-members:
:show-inheritance:

ollama\_model module
---------------------------------------

.. automodule:: agentscope.models.ollama_model
:members:
:undoc-members:
:show-inheritance:

gemini\_model module
---------------------------------------

.. automodule:: agentscope.models.gemini_model
:members:
:undoc-members:
:show-inheritance:

post\_model module
-------------------------------------

Expand Down
7 changes: 7 additions & 0 deletions docs/sphinx_doc/en/source/agentscope.service.web_search.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ search module
:undoc-members:
:show-inheritance:

web\_digest module
---------------------------------------------

.. automodule:: agentscope.service.web_search.web_digest
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/sphinx_doc/en/source/tutorial/102-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ For users who prefer to install AgentScope directly from the source code, follow
```bash
# Pull the source code from Github
git clone https://github.com/modelscope/agentscope.git
cd AgentScope
cd agentscope

# For centralized multi-agent applications
pip install -e .
Expand Down
9 changes: 4 additions & 5 deletions docs/sphinx_doc/en/source/tutorial/104-usecase.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Let the adventure begin to unlock the potential of multi-agent applications with

Firstly, ensure that you have installed and configured AgentScope properly. Besides, we will involve the basic concepts of `Model API`, `Agent`, `Msg`, and `Pipeline,` as described in [Tutorial-Concept](101-agentscope).

**Note**: all the configurations and code for this tutorial can be found in `examples/werewolf`.
**Note**: all the configurations and code for this tutorial can be found in `examples/game_werewolf`.

### Step 1: Prepare Model API and Set Model Configs

Expand Down Expand Up @@ -72,7 +72,7 @@ AgentScope provides several out-of-the-box Agents implements and organizes them

In this configuration, `Player1` is designated as a `DictDialogAgent`. The parameters include a system prompt (`sys_prompt`) that can guide the agent's behavior, a model config name (`model_config_name`) that determines the name of the model configuration, and a flag (`use_memory`) indicating whether the agent should remember past interactions.

For other players, configurations can be customized based on their roles. Each role may have different prompts, models, or memory settings. You can refer to the JSON file located at `examples/werewolf/configs/agent_configs.json` within the AgentScope examples directory.
For other players, configurations can be customized based on their roles. Each role may have different prompts, models, or memory settings. You can refer to the JSON file located at `examples/game_werewolf/configs/agent_configs.json` within the AgentScope examples directory.

### Step 3: Initialize AgentScope and the Agents

Expand Down Expand Up @@ -153,7 +153,7 @@ for i in range(1, MAX_GAME_ROUND + 1):

After the discussion, werewolves proceed to vote for their target, and the majority's choice is determined. The result of the vote is then broadcast to all werewolves.

**Note**: the detailed prompts and utility functions can be found in `examples/werewolf`.
**Note**: the detailed prompts and utility functions can be found in `examples/game_werewolf`.

```python
# werewolves vote
Expand Down Expand Up @@ -262,7 +262,7 @@ These code blocks outline the core game loop for Werewolf using AgentScope's `ms
With the game logic and agents set up, you're ready to run the Werewolf game. By executing the `pipeline`, the game will proceed through the predefined phases, with agents interacting based on their roles and the strategies coded above:

```bash
cd examples/werewolf
cd examples/game_werewolf
python main.py # Assuming the pipeline is implemented in main.py
```

Expand Down Expand Up @@ -308,5 +308,4 @@ Moderator: The day is coming, all the players open your eyes. Last night is peac

Now you've grasped how to conveniently set up a multi-agent application with AgentScope. Feel free to tailor the game to include additional roles and introduce more sophisticated strategies. For more advanced tutorials that delve deeper into more capabilities of AgentScope, such as *memory management* and *service functions* utilized by agents, please refer to the tutorials in the **Advanced Exploration** section and look up the API references.


[[Return to the top]](#104-usecase-en)
15 changes: 9 additions & 6 deletions docs/sphinx_doc/en/source/tutorial/201-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,15 @@ The *AgentPool* within AgentScope is a curated ensemble of ready-to-use, special

Below is a table summarizing the functionality of some of the key agents available in the Agent Pool:

| Agent Type | Description | Typical Use Cases |
| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| `AgentBase` | Serves as the superclass for all agents, providing essential attributes and methods. | The foundation for building any custom agent. |
| `DialogAgent` | Manages dialogues by understanding context and generating coherent responses. | Customer service bots, virtual assistants. |
| `UserAgent` | Interacts with the user to collect input, generating messages that may include URLs or additional specifics based on required keys. | Collecting user input for agents |
| *More to Come* | AgentScope is continuously expanding its pool with more specialized agents for diverse applications. | |
| Agent Type | Description | Typical Use Cases |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| `AgentBase` | Serves as the superclass for all agents, providing essential attributes and methods. | The foundation for building any custom agent. |
| `DialogAgent` | Manages dialogues by understanding context and generating coherent responses. | Customer service bots, virtual assistants. |
| `DictDialogAgent` | Manages dialogues by understanding context and generating coherent responses, and the responses are in json format. | Customer service bots, virtual assistants. |
| `UserAgent` | Interacts with the user to collect input, generating messages that may include URLs or additional specifics based on required keys. | Collecting user input for agents |
| `TextToImageAgent` | An agent that convert user input text to image. | Converting text to image |
| `ReActAgent` | An agent class that implements the ReAct algorithm. | Solving complex tasks |
| *More to Come* | AgentScope is continuously expanding its pool with more specialized agents for diverse applications. | |

## Customizing Agents from the AgentPool

Expand Down
40 changes: 21 additions & 19 deletions docs/sphinx_doc/en/source/tutorial/204-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,27 @@ AgentScope and how to use them to enhance the capabilities of your agents.

The following table outlines the various Service functions by type. These functions can be called using `agentscope.service.{function_name}`.

| Service Scene | Service Function Name | Description |
| -------------- | --------------------- | ------------------------------------------------------------ |
| Code | `execute_python_code` | Execute a piece of Python code, optionally inside a Docker container. |
| Retrieval | `retrieve_from_list` | Retrieve a specific item from a list based on given criteria. |
| SQL Query | `query_mysql` | Execute SQL queries on a MySQL database and return results. |
| | `query_sqlite` | Execute SQL queries on a SQLite database and return results. |
| | `query_mongodb` | Perform queries or operations on a MongoDB collection. |
| Text Processing | `summarization` | Summarize a piece of text using a large language model to highlight its main points. |
| Web Search | `web_search` | Perform a web search using a specified search engine (currently supports Google and Bing). |
| File | `create_file` | Create a new file at a specified path, optionally with initial content. |
| | `delete_file` | Delete a file specified by a file path. |
| | `move_file` | Move or rename a file from one path to another. |
| | `create_directory` | Create a new directory at a specified path. |
| | `delete_directory` | Delete a directory and all its contents. |
| | `move_directory` | Move or rename a directory from one path to another. |
| | `read_text_file` | Read and return the content of a text file. |
| | `write_text_file` | Write text content to a file at a specified path. |
| | `read_json_file` | Read and parse the content of a JSON file. |
| | `write_json_file` | Serialize a Python object to JSON and write to a file. |
| Service Scene | Service Function Name | Description |
| --------------------------- | --------------------- | -------------------------------------------------------------------------------------------------------------- |
| Code | `execute_python_code` | Execute a piece of Python code, optionally inside a Docker container. |
| Retrieval | `retrieve_from_list` | Retrieve a specific item from a list based on given criteria. |
| SQL Query | `query_mysql` | Execute SQL queries on a MySQL database and return results. |
| | `query_sqlite` | Execute SQL queries on a SQLite database and return results. |
| | `query_mongodb` | Perform queries or operations on a MongoDB collection. |
| Text Processing | `summarization` | Summarize a piece of text using a large language model to highlight its main points. |
| Web Search | `web_search` | Perform a web search using a specified search engine (currently supports Google and Bing). |
| | `load_web` | Load and parse the web page of the specificed url (currently only supports HTML). |
| | `digest_webpage` | Digest the content of a already loaded web page (currently only supports HTML). |
| File | `create_file` | Create a new file at a specified path, optionally with initial content. |
| | `delete_file` | Delete a file specified by a file path. |
| | `move_file` | Move or rename a file from one path to another. |
| | `create_directory` | Create a new directory at a specified path. |
| | `delete_directory` | Delete a directory and all its contents. |
| | `move_directory` | Move or rename a directory from one path to another. |
| | `read_text_file` | Read and return the content of a text file. |
| | `write_text_file` | Write text content to a file at a specified path. |
| | `read_json_file` | Read and parse the content of a JSON file. |
| | `write_json_file` | Serialize a Python object to JSON and write to a file. |
| *More services coming soon* | | More service functions are in development and will be added to AgentScope to further enhance its capabilities. |

About each service function, you can find detailed information in the
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx_doc/en/source/tutorial/302-contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Did you find a bug or have a feature request? Please first check the issue track
To work on an issue or a new feature, start by forking the AgentScope repository and then cloning your fork locally.

```bash
git clone https://github.com/your-username/AgentScope.git
cd AgentScope
git clone https://github.com/your-username/agentscope.git
cd agentscope
```

### Create a New Branch
Expand Down
24 changes: 24 additions & 0 deletions docs/sphinx_doc/zh_CN/source/agentscope.models.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ model module
:undoc-members:
:show-inheritance:

dashscope\_model module
---------------------------------------

.. automodule:: agentscope.models.dashscope_model
:members:
:undoc-members:
:show-inheritance:

openai\_model module
---------------------------------------

Expand All @@ -25,6 +33,22 @@ openai\_model module
:undoc-members:
:show-inheritance:

ollama\_model module
---------------------------------------

.. automodule:: agentscope.models.ollama_model
:members:
:undoc-members:
:show-inheritance:

gemini\_model module
---------------------------------------

.. automodule:: agentscope.models.gemini_model
:members:
:undoc-members:
:show-inheritance:

post\_model module
-------------------------------------

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,10 @@ search module
:undoc-members:
:show-inheritance:

web\_digest module
---------------------------------------------

.. automodule:: agentscope.service.web_search.web_digest
:members:
:undoc-members:
:show-inheritance:
2 changes: 1 addition & 1 deletion docs/sphinx_doc/zh_CN/source/tutorial/102-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ source agentscope/bin/activate # 在Windows上使用`agentscope\Scripts\activat
```bash
# 从GitHub上拉取AgentScope的源代码
git clone https://github.com/modelscope/agentscope.git
cd AgentScope
cd agentscope

# 针对本地化的multi-agent应用
pip install -e .
Expand Down
6 changes: 3 additions & 3 deletions docs/sphinx_doc/zh_CN/source/tutorial/104-usecase.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

首先,确保您已经正确安装和配置好AgentScope。除此之外,本节内容会涉及到`Model API`, `Agent`, `Msg``Pipeline`这几个概念(详情可以参考[关于AgentScope](101-agentscope))。以下是本节教程内容概览。

**提示**:本教程中的所有配置和代码文件均可以在`examples/werewolf`中找到。
**提示**:本教程中的所有配置和代码文件均可以在`examples/game_werewolf`中找到。

### 第一步: 准备模型API和设定模型配置

Expand Down Expand Up @@ -72,7 +72,7 @@ AgentScope提供了几种开箱即用的agent实现,作为一个agent样例池

在这个配置中,Player1被指定为一个DictDialogAgent。参数包括一个系统提示(sys_prompt),它可以指导agent的行为;一个模型配置名(model_config_name),它决定了模型配置的名称;以及一个标志(use_memory),指示agent是否应该记住过去的互动。

对于其他玩家,大家可以根据他们的角色进行定制。每个角色可能有不同的提示、模型或记忆设置。你可以参考位于AgentScope示例目录下的`examples/werewolf/configs/agent_configs.json`文件。
对于其他玩家,大家可以根据他们的角色进行定制。每个角色可能有不同的提示、模型或记忆设置。你可以参考位于AgentScope示例目录下的`examples/game_werewolf/configs/agent_configs.json`文件。

### 第三步:初始化AgentScope和Agents

Expand Down Expand Up @@ -153,7 +153,7 @@ for i in range(1, MAX_GAME_ROUND + 1):

讨论结束后,根据少数服从多数,狼人进行投票选出他们的目标。然后,投票的结果将广播给所有狼人。

注意:具体的提示和实用函数可以在`examples/werewolf`中找到。
注意:具体的提示和实用函数可以在`examples/game_werewolf`中找到。

```python
# werewolves vote
Expand Down
Loading

0 comments on commit a930908

Please sign in to comment.