Skip to content

Commit

Permalink
Merge branch 'modelscope:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zyzhang1130 authored May 17, 2024
2 parents 8d7e880 + 1f22e67 commit 195ac69
Show file tree
Hide file tree
Showing 145 changed files with 11,895 additions and 2,614 deletions.
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ assignees: ''

---

**<u>AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.</u>**

**Describe the bug**
A clear and concise description of what the bug is.

Expand Down
3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ assignees: ''

---

**<u>AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.</u>**



3 changes: 3 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ assignees: ''

---

**<u>AgentScope is an open-source project. To involve a broader community, we recommend asking your questions in English.</u>**


**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sphinx_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
cd docs/sphinx_doc
./build_sphinx_doc.sh
- name: Upload Documentation
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: SphinxDoc
path: 'docs/sphinx_doc/build'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
os: [ubuntu-latest, windows-latest, macos-13]
python-version: ['3.9']
env:
OS: ${{ matrix.os }}
Expand Down
76 changes: 52 additions & 24 deletions README.md

Large diffs are not rendered by default.

71 changes: 49 additions & 22 deletions README_ZH.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/sphinx_doc/build_sphinx_doc.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
sphinx-apidoc -f -o en/source ../../src/agentscope -t template
sphinx-apidoc -f -o zh_CN/source ../../src/agentscope -t template
sphinx-apidoc -f -o en/source ../../src/agentscope -t template -e
sphinx-apidoc -f -o zh_CN/source ../../src/agentscope -t template -e
make clean all
9 changes: 9 additions & 0 deletions docs/sphinx_doc/en/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@

autodoc_member_order = "bysource"

autodoc_default_options = {
"members": True,
"special-members": "__init__",
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

Expand All @@ -57,6 +62,10 @@
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

autodoc_default_options = {
"members": True,
"special-members": "__init__",
}

# -- Options for HTML output -------------------------------------------------

Expand Down
10 changes: 7 additions & 3 deletions docs/sphinx_doc/en/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,19 @@ AgentScope Documentation
:glob:
:caption: AgentScope API Reference

agentscope
agentscope.message
agentscope.models
agentscope.agents
agentscope.memory
agentscope.models
agentscope.parsers
agentscope.exception
agentscope.pipelines
agentscope.service
agentscope.rpc
agentscope.utils
agentscope.web
agentscope
agentscope.prompt
agentscope.utils

Indices and tables
==================
Expand Down
2 changes: 2 additions & 0 deletions docs/sphinx_doc/en/source/tutorial/201-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Each AgentBase derivative is composed of several key characteristics:

* `sys_prompt` & `engine`: The system prompt acts as predefined instructions that guide the agent in its interactions; and the `engine` is used to dynamically generate a suitable prompt. For more details about them, we defer to [Prompt Engine](206-prompt).

* `to_dist`: Used to create a distributed version of the agent, to support efficient collaboration among multiple agents. Note that `to_dist` is a reserved field and will be automatically added to the initialization function of any subclass of `AgentBase`. For more details about `to_dist`, please refer to [Distribution](208-distribute).

In addition to these attributes, `AgentBase` endows agents with pivotal methods such as `observe` and `reply`:

* `observe()`: Through this method, an agent can take note of *message* without immediately replying, allowing it to update its memory based on the observed *message*.
Expand Down
100 changes: 97 additions & 3 deletions docs/sphinx_doc/en/source/tutorial/203-model.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ Currently, AgentScope supports the following model service APIs:
- OpenAI API, including chat, image generation (DALL-E), and Embedding.
- DashScope API, including chat, image sythesis and text embedding.
- Gemini API, including chat and embedding.
- ZhipuAI API, including chat and embedding.
- Ollama API, including chat, embedding and generation.
- LiteLLM API, including chat, with various model APIs.
- Post Request API, model inference services based on Post
requests, including Huggingface/ModelScope Inference API and various
post request based model APIs.
Expand Down Expand Up @@ -81,10 +83,14 @@ In the current AgentScope, the supported `model_type` types, the corresponding
| | Multimodal | [`DashScopeMultiModalWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/dashscope_model.py) | `"dashscope_multimodal"` | qwen-vl-plus, qwen-vl-max, qwen-audio-turbo, ... |
| Gemini API | Chat | [`GeminiChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/gemini_model.py) | `"gemini_chat"` | gemini-pro, ... |
| | Embedding | [`GeminiEmbeddingWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/gemini_model.py) | `"gemini_embedding"` | models/embedding-001, ... |
| ZhipuAI API | Chat | [`ZhipuAIChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/zhipu_model.py) | `"zhipuai_chat"` | glm4, ... |
| | Embedding | [`ZhipuAIEmbeddingWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/zhipu_model.py) | `"zhipuai_embedding"` | embedding-2, ... |
| ollama | Chat | [`OllamaChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/ollama_model.py) | `"ollama_chat"` | llama2, ... |
| | Embedding | [`OllamaEmbeddingWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/ollama_model.py) | `"ollama_embedding"` | llama2, ... |
| | Generation | [`OllamaGenerationWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/ollama_model.py) | `"ollama_generate"` | llama2, ... |
| LiteLLM API | Chat | [`LiteLLMChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/litellm_model.py) | `"litellm_chat"` | - |
| Post Request based API | - | [`PostAPIModelWrapperBase`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `"post_api"` | - |
| | Chat | [`PostAPIChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `"post_api_chat"` | meta-llama/Meta-Llama-3-8B-Instruct, ... |

#### Detailed Parameters

Expand Down Expand Up @@ -302,6 +308,48 @@ Here we provide example configurations for different model wrappers.

<br/>


#### ZhipuAI API

<details>
<summary>ZhipuAI Chat API (<code><a href="https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/zhipu_model.py">agentscope.models.ZhipuAIChatWrapper</a></code>)</summary>

```python
{
"config_name": "my_zhipuai_chat_config",
"model_type": "zhipuai_chat",

# Required parameters
"model_name": "{model_name}", # The model name in ZhipuAI API, e.g. glm-4

# Optional parameters
"api_key": "{your_api_key}"
}
```

</details>

<details>
<summary>ZhipuAI Embedding API (<code><a href="https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/zhipu_model.py">agentscope.models.ZhipuAIEmbeddingWrapper</a></code>)</summary>

```python
{
"config_name": "my_zhipuai_embedding_config",
"model_type": "zhipuai_embedding",

# Required parameters
"model_name": "{model_name}", # The model name in ZhipuAI API, e.g. embedding-2

# Optional parameters
"api_key": "{your_api_key}",
}
```

</details>

<br/>


#### Ollama API

<details>
Expand All @@ -317,7 +365,7 @@ Here we provide example configurations for different model wrappers.

# Optional parameters
"options": { # Parameters passed to the model when calling
# e.g. "temperature": 0., "seed": "123",
# e.g. "temperature": 0., "seed": 123,
},
"keep_alive": "5m", # Controls how long the model will stay loaded into memory
}
Expand All @@ -338,7 +386,7 @@ Here we provide example configurations for different model wrappers.

# Optional parameters
"options": { # Parameters passed to the model when calling
# "temperature": 0., "seed": "123",
# "temperature": 0., "seed": 123,
},
"keep_alive": "5m", # Controls how long the model will stay loaded into memory
}
Expand All @@ -359,7 +407,7 @@ Here we provide example configurations for different model wrappers.

# Optional parameters
"options": { # Parameters passed to the model when calling
# "temperature": 0., "seed": "123",
# "temperature": 0., "seed": 123,
},
"keep_alive": "5m", # Controls how long the model will stay loaded into memory
}
Expand Down Expand Up @@ -394,6 +442,52 @@ Here we provide example configurations for different model wrappers.

<br/>


#### LiteLLM Chat API

<details>
<summary>LiteLLM Chat API (<code><a href="https://github.
com/modelscope/agentscope/blob/main/src/agentscope/models/litellm_model.py">agentscope.models.LiteLLMChatModelWrapper</a></code>)</summary>

```python
{
"config_name": "lite_llm_openai_chat_gpt-3.5-turbo",
"model_type": "litellm_chat",
"model_name": "gpt-3.5-turbo" # You should note that for different models, you should set the corresponding environment variables, such as OPENAI_API_KEY, etc. You may refer to https://docs.litellm.ai/docs/ for this.
},
```

</details>

<br/>


#### Post Request Chat API

<details>
<summary>Post request Chat API (<code><a href="https://github.
com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py">agentscope.models.PostAPIChatModelWrapper</a></code>)</summary>

```python
{
"config_name": "my_postapichatwrapper_config",
"model_type": "post_api_chat",

# Required parameters
"api_url": "https://xxx.xxx",
"headers": {
# e.g. "Authorization": "Bearer xxx",
},

# Optional parameters
"messages_key": "messages",
}
```

</details>

<br/>

## Build Model Service from Scratch

For developers who need to build their own model services, AgentScope
Expand Down
Loading

0 comments on commit 195ac69

Please sign in to comment.