Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
rayrayraykk committed Mar 14, 2024
2 parents 885f474 + 197d597 commit 7d1493f
Show file tree
Hide file tree
Showing 107 changed files with 5,210 additions and 1,068 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/sphinx_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
name: Build Documentation
run: |
cd docs/sphinx_doc
make clean html
make clean all
- name: Upload Documentation
uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ repos:
(?x)(
pb2\.py$
| grpc\.py$
| ^docs
)
args: [ --disallow-untyped-defs,
--disallow-incomplete-defs,
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ Welcome to join our community on
|---------|----------|--------|
| <img src="https://gw.alicdn.com/imgextra/i1/O1CN01hhD1mu1Dd3BWVUvxN_!!6000000000238-2-tps-400-400.png" width="100" height="100"> | <img src="https://img.alicdn.com/imgextra/i2/O1CN01tuJ5971OmAqNg9cOw_!!6000000001747-0-tps-444-460.jpg" width="100" height="100"> | <img src="https://img.alicdn.com/imgextra/i3/O1CN01UyfWfx1CYBM3WqlBy_!!6000000000092-2-tps-400-400.png" width="100" height="100"> |


----

## News
Expand All @@ -40,6 +39,7 @@ Table of Contents
=================

- [AgentScope](#agentscope)
- [News](#news)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [From source](#from-source)
Expand All @@ -48,6 +48,7 @@ Table of Contents
- [Basic Usage](#basic-usage)
- [Step 1: Prepare Model Configs](#step-1-prepare-model-configs)
- [OpenAI API Config](#openai-api-config)
- [DashScope API Config](#dashscope-api-config)
- [Post Request API Config](#post-request-api-config)
- [Step 2: Create Agents](#step-2-create-agents)
- [Step 3: Construct Conversation](#step-3-construct-conversation)
Expand Down Expand Up @@ -124,6 +125,7 @@ AgentScope supports the following model API services:
| OpenAI Chat API | `openai` | Standard OpenAI Chat API, FastChat and vllm |
| OpenAI DALL-E API | `openai_dall_e` | Standard DALL-E API |
| OpenAI Embedding API | `openai_embedding` | OpenAI embedding API |
| DashScope Chat API | `dashscope_chat` | DashScope chat API, including Qwen series |
| Post API | `post_api` | Huggingface/ModelScope inference API, and customized post API |

##### OpenAI API Config
Expand All @@ -144,6 +146,21 @@ For OpenAI APIs, you need to prepare a dict of model config with the following f
}
```

##### DashScope API Config

For DashScope APIs, you need to prepare a dict of model config with the following fields:

```
{
"config_name": "{config name}", # The name to identify the config
"model_type": "dashscope_chat" | "dashscope_text_embedding" | "dashscope_image_synthesis",
"model_name": "{model name, e.g. qwen-max}", # The model in dashscope API
"api_key": "xxx", # The API key for DashScope API.
}
```

> Note: The dashscope APIs may have strict requirements on the `role` field in messages. Please use with caution.
##### Post Request API Config

For post requests APIs, the config contains the following fields.
Expand Down
17 changes: 17 additions & 0 deletions README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ AgentScope是一款全新的Multi-Agent框架,专为应用开发者打造,
- [基础使用](#基础使用)
- [第1步:准备Model Configs](#第1步准备model-configs)
- [OpenAI API Configs](#openai-api-configs)
- [DashScope API Config](#dashscope-api-config)
- [Post Request API Config](#post-request-api-config)
- [第2步:创建Agent](#第2步创建agent)
- [第3步:构造对话](#第3步构造对话)
Expand Down Expand Up @@ -120,6 +121,7 @@ AgentScope支持以下模型API服务:
| OpenAI Chat API | `openai` | 标准OpenAI Chat API, FastChat和vllm |
| OpenAI DALL-E API | `openai_dall_e` | 标准DALL-E API |
| OpenAI Embedding API | `openai_embedding` | OpenAI 嵌入式API |
| DashScope Chat API | `dashscope_chat` | DashScope chat API,其中包含通义千问系列 |
| Post API | `post_api` | Huggingface/ModelScope 推理API, 以及定制化的post API |

##### OpenAI API Configs
Expand All @@ -137,6 +139,21 @@ AgentScope支持以下模型API服务:
}
```

##### DashScope API Config

对于 DashScope API,你需要准备一个包含如下字段的配置字典:

```
{
"config_name": "{配置名称}", # 用于识别配置的名称
"model_type": "dashscope_chat" | "dashscope_text_embedding" | "dashscope_image_synthesis",
"model_name": "{模型名称,例如 qwen-max}", # dashscope 中的模型
"api_key": "xxx", # The API key for DashScope API.
}
```

> 注意: dashscope API 可能对消息中的`role`域有严格的要求。请谨慎使用。
##### Post Request API Config

对于post请求API,配置包含以下字段。
Expand Down
42 changes: 27 additions & 15 deletions docs/sphinx_doc/Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,32 @@
# Minimal makefile for Sphinx documentation
#
# Makefile

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build
SPHINXBUILD = sphinx-build
SPHINXPROJ = AgentScope-Doc
ASSETSDIR = assets
BUILDDIR = build/html
SOURCEDIR_EN = en/source
BUILDDIR_EN = build/html/en
SOURCEDIR_ZH = zh_CN/source
BUILDDIR_ZH = build/html/zh_CN

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# English document
en:
@$(SPHINXBUILD) -b html "$(SOURCEDIR_EN)" "$(BUILDDIR_EN)"
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR_EN)"

.PHONY: help Makefile
# Chinese document
zh_CN:
@$(SPHINXBUILD) -b html "$(SOURCEDIR_ZH)" "$(BUILDDIR_ZH)"
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR_ZH)"

index:
@cp "$(ASSETSDIR)/redirect.html" "$(BUILDDIR)/index.html"

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR_EN)" "$(BUILDDIR_EN)" $(O)

all: en zh_CN index

.PHONY: all en zh_CN index
12 changes: 12 additions & 0 deletions docs/sphinx_doc/assets/redirect.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="refresh" content="0; url=en/index.html" />
<title>AgentScope Documentation</title>
</head>
<body>
<p>Redirecting to English documentation...</p>
<p>If you are not redirected, <a href="en/index.html">click here</a>.</p>
</body>
</html>
4 changes: 4 additions & 0 deletions docs/sphinx_doc/en/source/_static/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.language-selector a {
color: white;
width: 20px;
}
5 changes: 5 additions & 0 deletions docs/sphinx_doc/en/source/_templates/language_selector.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<!-- language_selector.html -->
<div class="language-selector">
<a href="{{ pathto('../en/index') }}">English</a></li> |
<a href="{{ pathto('../zh_CN/index') }}">中文</a></li>
</div>
3 changes: 3 additions & 0 deletions docs/sphinx_doc/en/source/_templates/layout.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<!-- layout.html -->
{% extends "!layout.html" %} {% block sidebartitle %} {{ super() }} {% include
"language_selector.html" %} {% endblock %}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Web UI package
app module
-----------------------------

.. automodule:: agentscope.web.app
.. automodule:: agentscope.web._app
:members:
:undoc-members: gradio_groupchat
:show-inheritance:

Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

# -- Project information -----------------------------------------------------

language = "en"

project = "AgentScope"
copyright = "2024, Alibaba Tongyi Lab"
author = "SysML team of Alibaba Tongyi Lab"
Expand Down Expand Up @@ -71,3 +73,7 @@
".rst": "restructuredtext",
".md": "markdown",
}

html_css_files = [
"custom.css",
]
File renamed without changes.
116 changes: 116 additions & 0 deletions docs/sphinx_doc/en/source/tutorial/101-agentscope.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
(101-agentscope-en)=

# About AgentScope

In this tutorial, we will provide an overview of AgentScope by answering
several questions, including what's AgentScope, what can AgentScope provide,
and why we should choose AgentScope. Let's get started!

## What is AgentScope?

AgentScope is a developer-centric multi-agent platform, which enables
developers to build their LLM-empowered multi-agent applications with less
effort.

With the advance of large language models, developers are able to build
diverse applications.
In order to connect LLMs to data and services and solve complex tasks,
AgentScope provides a series of development tools and components for ease of
development.
It features

- **usability**,
- **robustness**, and
- **the support of multi-modal data** and
- **distributed deployment**.

## Key Concepts

### Message

Message is a carrier of information (e.g. instructions, multi-modal
data, and dialogue). In AgentScope, message is a Python dict subclass
with `name` and `content` as necessary fields, and `url` as an optional
field referring to additional resources.

### Agent

Agent is an autonomous entity capable of interacting with environment and
agents, and taking actions to change the environment. In AgentScope, an
agent takes message as input and generates corresponding response message.

### Service

Service refers to the functional APIs that enable agents to perform
specific tasks. In AgentScope, services are categorized into model API
services, which are channels to use the LLMs, and general API services,
which provide a variety of tool functions.

### Workflow

Workflow represents ordered sequences of agent executions and message
exchanges between agents, analogous to computational graphs in TensorFlow,
but with the flexibility to accommodate non-DAG structures.

## Why AgentScope?

**Exceptional usability for developers.**
AgentScope provides high usability for developers with flexible syntactic
sugars, ready-to-use components, and pre-built examples.

**Robust fault tolerance for diverse models and APIs.**
AgentScope ensures robust fault tolerance for diverse models, APIs, and
allows developers to build customized fault-tolerant strategies.

**Extensive compatibility for multi-modal application.**
AgentScope supports multi-modal data (e.g., files, images, audio and videos)
in both dialog presentation, message transmission and data storage.

**Optimized efficiency for distributed multi-agent operations.** AgentScope
introduces an actor-based distributed mechanism that enables centralized
programming of complex distributed workflows, and automatic parallel
optimization.

## How is AgentScope designed?

The architecture of AgentScope comprises three hierarchical layers. The
layers provide supports for multi-agent applications from different levels,
including elementary and advanced functionalities of a single agent
(**utility layer**), resources and runtime management (**manager and wrapper
layer**), and agent-level to workflow-level programming interfaces (**agent
layer**). AgentScope introduces intuitive abstractions designed to fulfill
the diverse functionalities inherent to each layer and simplify the
complicated interlayer dependencies when building multi-agent systems.
Furthermore, we offer programming interfaces and default mechanisms to
strengthen the resilience of multi-agent systems against faults within
different layers.

## AgentScope Code Structure

```bash
AgentScope
├── src
│ ├── agentscope
| ├── agents # Core components and implementations pertaining to agents.
| ├── memory # Structures for agent memory.
| ├── models # Interfaces for integrating diverse model APIs.
| ├── pipeline # Fundamental components and implementations for running pipelines.
| ├── rpc # Rpc module for agent distributed deployment.
| ├── service # Services offering functions independent of memory and state.
| | ├── web # WebUI used to show dialogs.
| ├── utils # Auxiliary utilities and helper functions.
| ├── message.py # Definitions and implementations of messaging between agents.
| ├── prompt.py # Prompt engineering module for model input.
| ├── ... ..
| ├── ... ..
├── scripts # Scripts for launching local Model API
├── examples # Pre-built examples of different applications.
├── docs # Documentation tool for API reference.
├── tests # Unittest modules for continuous integration.
├── LICENSE # The official licensing agreement for AgentScope usage.
└── setup.py # Setup script for installing.
├── ... ..
└── ... ..
```

[[Return to the top]](#101-agentscope)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
(101-installation)=
(102-installation-en)=

# Installation

To install AgentScope, you need to have Python 3.9 or higher installed. We recommend setting up a new virtual environment specifically for AgentScope:

### Create a Virtual Environment
## Create a Virtual Environment

#### Using Conda
### Using Conda

If you're using Conda as your package and environment management tool, you can create a new virtual environment with Python 3.9 using the following commands:

Expand All @@ -18,7 +18,7 @@ conda create -n agentscope python=3.9
conda activate agentscope
```

#### Using Virtualenv
### Using Virtualenv

Alternatively, if you prefer `virtualenv`, you can install it first (if it's not already installed) and then create a new virtual environment as shown:

Expand All @@ -33,9 +33,9 @@ virtualenv agentscope --python=python3.9
source agentscope/bin/activate # On Windows use `agentscope\Scripts\activate`
```

### Installing AgentScope
## Installing AgentScope

#### Install with Pip
### Install with Pip

If you prefer to install AgentScope from Pypi, you can do so easily using `pip`:

Expand All @@ -46,7 +46,7 @@ pip install agentscope
pip install agentscope[distribute] # On Mac use `pip install agentscope\[distribute\]`
```

#### Install from Source
### Install from Source

For users who prefer to install AgentScope directly from the source code, follow these steps to clone the repository and install the platform in editable mode:

Expand All @@ -65,4 +65,4 @@ pip install -e .[distribute] # On Mac use `pip install -e .\[distribute\]`

**Note**: The `[distribute]` option installs additional dependencies required for distributed applications. Remember to activate your virtual environment before running these commands.

[[Return to the top]](#installation)
[[Return to the top]](#102-installation-en)
Loading

0 comments on commit 7d1493f

Please sign in to comment.