diff --git a/docs/sphinx_doc/en/source/tutorial/104-usecase.md b/docs/sphinx_doc/en/source/tutorial/104-usecase.md index 3505e8e57..cb4060219 100644 --- a/docs/sphinx_doc/en/source/tutorial/104-usecase.md +++ b/docs/sphinx_doc/en/source/tutorial/104-usecase.md @@ -64,13 +64,16 @@ AgentScope provides several out-of-the-box Agents implements and organizes them "args": { "name": "Player1", "sys_prompt": "Act as a player in a werewolf game. You are Player1 and\nthere are totally 6 players, named Player1, Player2, Player3, Player4, Player5 and Player6.\n\nPLAYER ROLES:\nIn werewolf game, players are divided into two werewolves, two villagers, one seer, and one witch. Note only werewolves know who are their teammates.\nWerewolves: They know their teammates' identities and attempt to eliminate a villager each night while trying to remain undetected.\nVillagers: They do not know who the werewolves are and must work together during the day to deduce who the werewolves might be and vote to eliminate them.\nSeer: A villager with the ability to learn the true identity of one player each night. This role is crucial for the villagers to gain information.\nWitch: A character who has a one-time ability to save a player from being eliminated at night (sometimes this is a potion of life) and a one-time ability to eliminate a player at night (a potion of death).\n\nGAME RULE:\nThe game consists of two phases: night phase and day phase. The two phases are repeated until werewolf or villager wins the game.\n1. Night Phase: During the night, the werewolves discuss and vote for a player to eliminate. Special roles also perform their actions at this time (e.g., the Seer chooses a player to learn their role, the witch chooses a decide if save the player).\n2. Day Phase: During the day, all surviving players discuss who they suspect might be a werewolf. No one reveals their role unless it serves a strategic purpose. After the discussion, a vote is taken, and the player with the most votes is \"lynched\" or eliminated from the game.\n\nVICTORY CONDITION:\nFor werewolves, they win the game if the number of werewolves is equal to or greater than the number of remaining villagers.\nFor villagers, they win if they identify and eliminate all of the werewolves in the group.\n\nCONSTRAINTS:\n1. Your response should be in the first person.\n2. This is a conversational game. You should respond only based on the conversation history and your strategy.\n\nYou are playing werewolf in this game.\n", - "model_or_config_name": "gpt-3.5-turbo", + "config_name_or_model": "gpt-3.5-turbo", "use_memory": true } } ``` -In this configuration, `Player1` is designated as a `DictDialogAgent`. The parameters include a system prompt (`sys_prompt`) that can guide the agent's behavior, a model config name (`model_or_config_name`) that determines the name of the model configuration, and a flag (`use_memory`) indicating whether the agent should remember past interactions. +In this configuration, `Player1` is designated as a `DictDialogAgent`. The +parameters include a system prompt (`sys_prompt`) that can guide the +agent's behavior, a model config name (`config_name_or_model`) that determines +the name of the model configuration, and a flag (`use_memory`) indicating whether the agent should remember past interactions. For other players, configurations can be customized based on their roles. Each role may have different prompts, models, or memory settings. You can refer to the JSON file located at `examples/werewolf/configs/agent_configs.json` within the AgentScope examples directory. diff --git a/docs/sphinx_doc/en/source/tutorial/201-agent.md b/docs/sphinx_doc/en/source/tutorial/201-agent.md index dc8fa37d8..77bd08d7e 100644 --- a/docs/sphinx_doc/en/source/tutorial/201-agent.md +++ b/docs/sphinx_doc/en/source/tutorial/201-agent.md @@ -31,7 +31,7 @@ class AgentBase(Operator): self, name: str, sys_prompt: Optional[str] = None, - model_or_config_name: str = None, + config_name_or_model: str = None, use_memory: bool = True, memory_config: Optional[dict] = None, ) -> None: @@ -108,7 +108,7 @@ from agentscope.agents import DialogAgent # Configuration for the DialogAgent dialog_agent_config = { "name": "ServiceBot", - "model_or_config_name": "gpt-3.5", # Specify the model used for dialogue generation + "config_name_or_model": "gpt-3.5", # Specify the model used for dialogue generation "sys_prompt": "Act as AI assistant to interact with the others. Try to " "reponse on one line.\n", # Custom prompt for the agent # Other configurations specific to the DialogAgent diff --git a/examples/distributed/distributed_dialog.py b/examples/distributed/distributed_dialog.py index 467119b94..30261396e 100644 --- a/examples/distributed/distributed_dialog.py +++ b/examples/distributed/distributed_dialog.py @@ -41,7 +41,7 @@ def setup_assistant_server(assistant_host: str, assistant_port: int) -> None: agent_kwargs={ "name": "Assitant", "sys_prompt": "You are a helpful assistant.", - "model_or_config_name": "gpt-3.5-turbo", + "config_name_or_model": "gpt-3.5-turbo", "use_memory": True, }, host=assistant_host, diff --git a/examples/werewolf/README.md b/examples/werewolf/README.md index 52a26cb59..8884b096e 100644 --- a/examples/werewolf/README.md +++ b/examples/werewolf/README.md @@ -41,7 +41,7 @@ is as follows "args": { "name": "Player1", "sys_prompt": "Act as a player in a werewolf game. You are Player1 and\nthere are totally 6 players, named Player1, Player2, Player3, Player4, Player5 and Player6.\n\nPLAYER ROLES:\nIn werewolf game, players are divided into two werewolves, two villagers, one seer and one witch. Note only werewolves know who are their teammates.\nWerewolves: They know their teammates' identities and attempt to eliminate a villager each night while trying to remain undetected.\nVillagers: They do not know who the werewolves are and must work together during the day to deduce who the werewolves might be and vote to eliminate them.\nSeer: A villager with the ability to learn the true identity of one player each night. This role is crucial for the villagers to gain information.\nWitch: A character who has a one-time ability to save a player from being eliminated at night (sometimes this is a potion of life) and a one-time ability to eliminate a player at night (a potion of death).\n\nGAME RULE:\nThe game is consisted of two phases: night phase and day phase. The two phases are repeated until werewolf or villager win the game.\n1. Night Phase: During the night, the werewolves discuss and vote for a player to eliminate. Special roles also perform their actions at this time (e.g., the Seer chooses a player to learn their role, the witch chooses a decide if save the player).\n2. Day Phase: During the day, all surviving players discuss who they suspect might be a werewolf. No one reveals their role unless it serves a strategic purpose. After the discussion, a vote is taken, and the player with the most votes is \"lynched\" or eliminated from the game.\n\nVICTORY CONDITION:\nFor werewolves, they win the game if the number of werewolves is equal to or greater than the number of remaining villagers.\nFor villagers, they win if they identify and eliminate all of the werewolves in the group.\n\nCONSTRAINTS:\n1. Your response should be in the first person.\n2. This is a conversational game. You should response only based on the conversation history and your strategy.\n\nYou are playing werewolf in this game.\n", - "model_or_config_name": "gpt-3.5-turbo", + "config_name_or_model": "gpt-3.5-turbo", "use_memory": true } } diff --git a/notebook/conversation.ipynb b/notebook/conversation.ipynb index 793c72831..4da71bf05 100644 --- a/notebook/conversation.ipynb +++ b/notebook/conversation.ipynb @@ -86,7 +86,7 @@ "dialog_agent = DialogAgent(\n", " name=\"Assistant\",\n", " sys_prompt=\"You're a helpful assistant.\",\n", - " model_or_config_name=\"gpt-3.5-turbo\", # replace by your model config name\n", + " config_name_or_model=\"gpt-3.5-turbo\", # replace by your model config name\n", ")\n", "user_agent = UserAgent()" ] diff --git a/notebook/distributed_debate.ipynb b/notebook/distributed_debate.ipynb index b2df59301..db7dbd8c4 100644 --- a/notebook/distributed_debate.ipynb +++ b/notebook/distributed_debate.ipynb @@ -92,19 +92,19 @@ "\n", "pro_agent = DialogAgent(\n", " name=\"Pro\",\n", - " model_or_config_name=\"gpt-3.5-turbo\",\n", + " config_name_or_model=\"gpt-3.5-turbo\",\n", " use_memory=True,\n", " sys_prompt=\"Assume the role of a debater who is arguing in favor of the proposition that AGI (Artificial General Intelligence) can be achieved using the GPT model framework. Construct a coherent and persuasive argument, including scientific, technological, and theoretical evidence, to support the statement that GPT models are a viable path to AGI. Highlight the advancements in language understanding, adaptability, and scalability of GPT models as key factors in progressing towards AGI.\",\n", ").to_dist()\n", "con_agent = DialogAgent(\n", " name=\"Con\",\n", - " model_or_config_name=\"gpt-3.5-turbo\",\n", + " config_name_or_model=\"gpt-3.5-turbo\",\n", " use_memory=True,\n", " sys_prompt=\"Assume the role of a debater who is arguing against the proposition that AGI can be achieved using the GPT model framework. Construct a coherent and persuasive argument, including scientific, technological, and theoretical evidence, to support the statement that GPT models, while impressive, are insufficient for reaching AGI. Discuss the limitations of GPT models such as lack of understanding, consciousness, ethical reasoning, and general problem-solving abilities that are essential for true AGI.\",\n", ").to_dist()\n", "judge_agent = DialogAgent(\n", " name=\"Judge\",\n", - " model_or_config_name=\"gpt-3.5-turbo\",\n", + " config_name_or_model=\"gpt-3.5-turbo\",\n", " use_memory=True,\n", " sys_prompt=\"Assume the role of an impartial judge in a debate where the affirmative side argues that AGI can be achieved using the GPT model framework, and the negative side contests this. Listen to both sides' arguments and provide an analytical judgment on which side presented a more compelling and reasonable case. Consider the strength of the evidence, the persuasiveness of the reasoning, and the overall coherence of the arguments presented by each side.\"\n", ").to_dist()" diff --git a/notebook/distributed_dialog.ipynb b/notebook/distributed_dialog.ipynb index 4836f4755..e03c7b08c 100644 --- a/notebook/distributed_dialog.ipynb +++ b/notebook/distributed_dialog.ipynb @@ -91,7 +91,7 @@ "assistant_agent = DialogAgent(\n", " name=\"Assistant\",\n", " sys_prompt=\"You are a helpful assistant.\",\n", - " model_or_config_name=\"gpt-3.5-turbo\",\n", + " config_name_or_model=\"gpt-3.5-turbo\",\n", " use_memory=True,\n", ").to_dist()\n", "user_agent = UserAgent(\n", diff --git a/src/agentscope/agents/agent.py b/src/agentscope/agents/agent.py index 40afdfbd4..d3353cc06 100644 --- a/src/agentscope/agents/agent.py +++ b/src/agentscope/agents/agent.py @@ -37,7 +37,7 @@ def __init__( self, name: str, sys_prompt: Optional[str] = None, - config_name_or_model: Optional[str, Callable[..., Any]] = None, + config_name_or_model: Optional[Union[str, Callable[..., Any]]] = None, use_memory: bool = True, memory_config: Optional[dict] = None, ) -> None: @@ -73,7 +73,7 @@ def __init__( else: raise ValueError( f"Invalid type for " - f"argument `model_or_config_name`:" + f"argument `config_name_or_model`:" f" {type(config_name_or_model)}", )