diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 94d349f12..89f6285d1 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -24,9 +24,9 @@ jobs: - name: Install Minimal Dependencies run: | pip install -q -e . - - name: Run import tests + - name: Run minimal import tests run: | - python -c "import agentscope; print(agentscope.__version__)" + python tests/minimal.py - name: Install Full Dependencies run: | pip install -q -e .[full] diff --git a/docs/sphinx_doc/en/source/tutorial/104-usecase.md b/docs/sphinx_doc/en/source/tutorial/104-usecase.md index 7b0fddae1..60a0ed02e 100644 --- a/docs/sphinx_doc/en/source/tutorial/104-usecase.md +++ b/docs/sphinx_doc/en/source/tutorial/104-usecase.md @@ -291,7 +291,7 @@ With the game logic and agents set up, you're ready to run the Werewolf game. By ```bash cd examples/game_werewolf -python main.py # Assuming the pipeline is implemented in main.py +python werewolf.py # Assuming the pipeline is implemented in werewolf.py ``` It is recommended that you start the game in [AgentScope Studio](https://modelscope.github.io/agentscope/en/tutorial/209-gui.html), where you diff --git a/docs/sphinx_doc/zh_CN/source/tutorial/104-usecase.md b/docs/sphinx_doc/zh_CN/source/tutorial/104-usecase.md index 25608c845..f2b56c3f3 100644 --- a/docs/sphinx_doc/zh_CN/source/tutorial/104-usecase.md +++ b/docs/sphinx_doc/zh_CN/source/tutorial/104-usecase.md @@ -170,7 +170,7 @@ for i in range(1, MAX_GAME_ROUND + 1): # Night phase: werewolves discuss hint = HostMsg(content=Prompts.to_wolves.format(n2s(wolves))) with msghub(wolves, announcement=hint) as hub: - set_parsers(wolves, Prompts.wolves_discuss_parser) + set_parsers(wolves, Prompts.wolves_discuss_parser) for _ in range(MAX_WEREWOLF_DISCUSSION_ROUND): x = sequentialpipeline(wolves) if x.metadata.get("finish_discussion", False): @@ -295,7 +295,7 @@ for i in range(1, MAX_GAME_ROUND + 1): ```bash cd examples/game_werewolf -python main.py # Assuming the pipeline is implemented in main.py +python werewolf.py # Assuming the pipeline is implemented in werewolf.py ``` 建议您在在 [AgentScope Studio](https://modelscope.github.io/agentscope/zh_CN/tutorial/209-gui.html) 中启动游戏,在对应的链接中您将看到下面的内容输出。 diff --git a/docs/sphinx_doc/zh_CN/source/tutorial/209-gui.md b/docs/sphinx_doc/zh_CN/source/tutorial/209-gui.md index 7feeccd29..20c945429 100644 --- a/docs/sphinx_doc/zh_CN/source/tutorial/209-gui.md +++ b/docs/sphinx_doc/zh_CN/source/tutorial/209-gui.md @@ -70,7 +70,7 @@ agentscope.init( # ... project="xxx", name="xxx", - studio_url="http://127.0.0.1:5000" # AgentScope Studio 的 URL + studio_url="http://127.0.0.1:5000" # AgentScope Studio 的 URL ) ``` diff --git a/src/agentscope/models/post_model.py b/src/agentscope/models/post_model.py index 7cb1fc25c..fbd09bd0e 100644 --- a/src/agentscope/models/post_model.py +++ b/src/agentscope/models/post_model.py @@ -8,7 +8,6 @@ import requests from loguru import logger -from .gemini_model import GeminiChatWrapper from .openai_model import OpenAIChatWrapper from .model import ModelWrapperBase, ModelResponse from ..constants import _DEFAULT_MAX_RETRIES @@ -221,6 +220,8 @@ def format( # Gemini elif model_name and model_name.startswith("gemini"): + from .gemini_model import GeminiChatWrapper + return GeminiChatWrapper.format(*args) # Include DashScope, ZhipuAI, Ollama, the other models supported by diff --git a/tests/minimal.py b/tests/minimal.py new file mode 100644 index 000000000..affad7cb7 --- /dev/null +++ b/tests/minimal.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +""" +Minimal case for agentscope +""" +import agentscope +from agentscope.agents import DialogAgent + +print(agentscope.__version__) +agentscope.init( + project="minimal", + model_configs=[ + { + "model_type": "dashscope_chat", + "config_name": "qwen", + "model_name": "qwen-max", + "api_key": "xxx", + }, + { + "model_type": "openai_chat", + "config_name": "gpt-4", + "model_name": "gpt-4", + "api_key": "xxx", + "organization": "xxx", + "generate_args": {"temperature": 0.5}, + }, + { + "model_type": "post_api_chat", + "config_name": "my_post_api", + "api_url": "https://xxx", + "headers": {}, + "json_args": {}, + }, + ], +) +a = DialogAgent( + name="A", + sys_prompt="You are a helpful assistant.", + model_config_name="my_post_api", +) + +b = DialogAgent( + name="B", + sys_prompt="You are a helpful assistant.", + model_config_name="qwen", +) + +c = DialogAgent( + name="C", + sys_prompt="You are a helpful assistant.", + model_config_name="gpt-4", +)