From cd72fbeb4ecf69aa18ef63bf2126b999bfdd96e6 Mon Sep 17 00:00:00 2001 From: ZiTao-Li Date: Sun, 28 Apr 2024 15:23:05 +0800 Subject: [PATCH] update documents --- .../en/source/tutorial/203-model.md | 71 ++++++++++++++++++- .../zh_CN/source/tutorial/203-model.md | 69 ++++++++++++++++++ 2 files changed, 138 insertions(+), 2 deletions(-) diff --git a/docs/sphinx_doc/en/source/tutorial/203-model.md b/docs/sphinx_doc/en/source/tutorial/203-model.md index 2cdc5d0bb..0dc663f9c 100644 --- a/docs/sphinx_doc/en/source/tutorial/203-model.md +++ b/docs/sphinx_doc/en/source/tutorial/203-model.md @@ -72,7 +72,7 @@ In the current AgentScope, the supported `model_type` types, the corresponding | API | Task | Model Wrapper | `model_type` | Some Supported Models | |------------------------|-----------------|---------------------------------------------------------------------------------------------------------------------------------|-------------------------------|--------------------------------------------------| -| OpenAI API | Chat | [`OpenAIChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/openai_model.py) | `"openai_chat"` | gpt-4, gpt-3.5-turbo, ... | +| OpenAI API | Chat | [`OpenAIChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/openai_model.py) | `"openai_chat"` | gpt-4, gpt-3.5-turbo, ... | | | Embedding | [`OpenAIEmbeddingWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/openai_model.py) | `"openai_embedding"` | text-embedding-ada-002, ... | | | DALL·E | [`OpenAIDALLEWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/openai_model.py) | `"openai_dall_e"` | dall-e-2, dall-e-3 | | DashScope API | Chat | [`DashScopeChatWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/dashscope_model.py) | `"dashscope_chat"` | qwen-plus, qwen-max, ... | @@ -84,7 +84,10 @@ In the current AgentScope, the supported `model_type` types, the corresponding | 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, ... | -| Post Request based API | - | [`PostAPIModelWrapperBase`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `"post_api"` | - | +| Post Request based API | General | [`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` | - | +| | Image Synthesis | [`PostAPIDALLEWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `post_api_dall_e` | - | | +| | Embedding | [`PostAPIEmbeddingWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `post_api_embedding` | - | #### Detailed Parameters @@ -390,6 +393,70 @@ Here we provide example configurations for different model wrappers. } ``` + +
+Post request API for Chat (agentscope.models.PostAPIModelWrapperBase) + +```python +{ + "config_name": "my_postapiwrapper_config", + "model_type": "post_api_chat", + + # Required parameters + "api_url": "https://xxx.xxx", + "headers": { + # e.g. "Authorization": "Bearer xxx", + }, + + # Optional parameters + "messages_key": "messages", +} +``` + +
+ + +
+Post request API for Image Synthesis (agentscope.models.PostAPIDALLEWrapper) + +```python +{ + "config_name": "my_postapiwrapper_config", + "model_type": "post_api_dall_e", + + # Required parameters + "api_url": "https://xxx.xxx", + "headers": { + # e.g. "Authorization": "Bearer xxx", + }, + + # Optional parameters + "messages_key": "messages", +} +``` + +
+ + +
+Post request API for Embedding (agentscope.models.PostAPIEmbeddingWrapper) + +```python +{ + "config_name": "my_postapiwrapper_config", + "model_type": "post_api_embedding", + + # Required parameters + "api_url": "https://xxx.xxx", + "headers": { + # e.g. "Authorization": "Bearer xxx", + }, + + # Optional parameters + "messages_key": "messages", +} +``` +

diff --git a/docs/sphinx_doc/zh_CN/source/tutorial/203-model.md b/docs/sphinx_doc/zh_CN/source/tutorial/203-model.md index 1a06c39d2..95d6560d3 100644 --- a/docs/sphinx_doc/zh_CN/source/tutorial/203-model.md +++ b/docs/sphinx_doc/zh_CN/source/tutorial/203-model.md @@ -105,6 +105,9 @@ API如下: | | 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, ... | | 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` | - | +| | Image Synthesis | [`PostAPIDALLEWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `post_api_dall_e` | - | | +| | Embedding | [`PostAPIEmbeddingWrapper`](https://github.com/modelscope/agentscope/blob/main/src/agentscope/models/post_model.py) | `post_api_embedding` | - | #### 详细参数 @@ -410,6 +413,72 @@ API如下: } ``` + +
+Post request API for Chat (agentscope.models.PostAPIModelWrapperBase) + +```python +{ + "config_name": "my_postapiwrapper_config", + "model_type": "post_api_chat", + + # Required parameters + "api_url": "https://xxx.xxx", + "headers": { + # e.g. "Authorization": "Bearer xxx", + }, + + # Optional parameters + "messages_key": "messages", +} +``` + +
+ + +
+Post request API for Image Synthesis (agentscope.models.PostAPIDALLEWrapper) + +```python +{ + "config_name": "my_postapiwrapper_config", + "model_type": "post_api_dall_e", + + # Required parameters + "api_url": "https://xxx.xxx", + "headers": { + # e.g. "Authorization": "Bearer xxx", + }, + + # Optional parameters + "messages_key": "messages", +} +``` + +
+ + +
+Post request API for Embedding (agentscope.models.PostAPIEmbeddingWrapper) + +```python +{ + "config_name": "my_postapiwrapper_config", + "model_type": "post_api_embedding", + + # Required parameters + "api_url": "https://xxx.xxx", + "headers": { + # e.g. "Authorization": "Bearer xxx", + }, + + # Optional parameters + "messages_key": "messages", +} +``` + +
+