Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Hot Fix] Add test for minimal dependencies #445

Merged
merged 5 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/unittest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx_doc/en/source/tutorial/104-usecase.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions docs/sphinx_doc/zh_CN/source/tutorial/104-usecase.md
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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) 中启动游戏,在对应的链接中您将看到下面的内容输出。
Expand Down
2 changes: 1 addition & 1 deletion docs/sphinx_doc/zh_CN/source/tutorial/209-gui.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ agentscope.init(
# ...
project="xxx",
name="xxx",
studio_url="http://127.0.0.15000" # AgentScope Studio 的 URL
studio_url="http://127.0.0.1:5000" # AgentScope Studio 的 URL
)
```

Expand Down
3 changes: 2 additions & 1 deletion src/agentscope/models/post_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
51 changes: 51 additions & 0 deletions tests/minimal.py
Original file line number Diff line number Diff line change
@@ -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",
)