|
12 | 12 |
|
13 | 13 | from agentscope.agent import ReActAgent |
14 | 14 | from agentscope.formatter import DashScopeMultiAgentFormatter, OpenAIMultiAgentFormatter |
15 | | -from agentscope.model import OpenAIChatModel |
| 15 | +from agentscope.model import OpenAIChatModel, DashScopeChatModel |
16 | 16 | from loguru import logger |
17 | 17 | from pydantic import Field |
18 | 18 |
|
@@ -81,8 +81,8 @@ def get_official_agent_prompt(name) -> str: |
81 | 81 |
|
82 | 82 | class ExampleWerewolves(Workflow): |
83 | 83 | trainable_targets: List[str] | None = Field(default=["werewolf"], description="List of agents to be fine-tuned.") |
84 | | - big_external_opponent_llm_url = "http://22.17.52.4:2888/v1" |
85 | | - big_external_opponent_llm_name = "/mnt/data_cpfs/model_cache/modelscope/hub/Qwen/Qwen/Qwen3-235B-A22B-Instruct-2507/" |
| 84 | + big_external_opponent_llm_url: str = Field(default="http://22.17.52.4:2888/v1", description="The URL of the big external opponent LLM. You can replace it with any OpenAI-compatible LLM API URL.") |
| 85 | + big_external_opponent_llm_name: str = Field(default="/mnt/data_cpfs/model_cache/modelscope/hub/Qwen/Qwen/Qwen3-235B-A22B-Instruct-2507/", description="The model name of the big external opponent LLM. You can replace it with any OpenAI-compatible LLM name.") |
86 | 86 |
|
87 | 87 | async def execute(self, workflow_task: WorkflowTask, tuner: AjetTuner) -> WorkflowOutput: |
88 | 88 |
|
@@ -121,9 +121,7 @@ async def execute(self, workflow_task: WorkflowTask, tuner: AjetTuner) -> Workfl |
121 | 121 | name=f"Player{i + 1}", |
122 | 122 | sys_prompt=get_official_agent_prompt(f"Player{i + 1}"), |
123 | 123 | model=model_for_this_agent, |
124 | | - formatter=DashScopeMultiAgentFormatter() |
125 | | - if role in self.trainable_targets |
126 | | - else OpenAIMultiAgentFormatter(), |
| 124 | + formatter=DashScopeMultiAgentFormatter() if isinstance(model_for_this_agent, DashScopeChatModel) else OpenAIMultiAgentFormatter(), |
127 | 125 | max_iters=3 if role in self.trainable_targets else 5, |
128 | 126 | ) |
129 | 127 | # agent.set_console_output_enabled(False) |
|
0 commit comments