fix ut and missing annotation

This commit is contained in:
better629 2024-04-08 20:27:35 +08:00
parent f54bb159b5
commit d692d9fb7b
5 changed files with 19 additions and 16 deletions

View file

@ -12,7 +12,7 @@ from metagpt.actions import Action
class Speak(Action):
"""Action: Any speak action in a game"""
PROMPT_TEMPLATE = """
PROMPT_TEMPLATE: str = """
{
"BACKGROUND": "It's a Werewolf game, in this game, we have 2 werewolves, 2 villagers, 1 guard, 1 witch, 1 seer. You are __profile__. Note that villager, seer, guard and witch are all in villager side, they have the same objective. Werewolves can collectively hunt ONE player at night."
,"HISTORY": "You have knowledge to the following conversation: __context__"
@ -36,7 +36,7 @@ class Speak(Action):
}
}
"""
STRATEGY = """
STRATEGY: str = """
Decide whether to reveal your identity based on benefits vs. risks, provide useful information, and vote to eliminate the most suspicious.
If you have special abilities, pay attention to those who falsely claims your role, for they are probably werewolves.
"""
@ -109,7 +109,7 @@ class NighttimeWhispers(Action):
return prompt_json
"""
PROMPT_TEMPLATE = """
PROMPT_TEMPLATE: str = """
{
"BACKGROUND": "It's a Werewolf game, in this game, we have 2 werewolves, 2 villagers, 1 guard, 1 witch, 1 seer. You are __profile__. Note that villager, seer, guard and witch are all in villager side, they have the same objective. Werewolves can collectively hunt ONE player at night."
,"HISTORY": "You have knowledge to the following conversation: __context__"
@ -128,7 +128,7 @@ class NighttimeWhispers(Action):
}
}
"""
STRATEGY = """
STRATEGY: str = """
Decide which player is most threatening to you or most needs your support, take your action correspondingly.
"""
@ -188,7 +188,7 @@ class NighttimeWhispers(Action):
class Reflect(Action):
PROMPT_TEMPLATE = """
PROMPT_TEMPLATE: str = """
{
"BACKGROUND": "It's a Werewolf game, in this game, we have 2 werewolves, 2 villagers, 1 guard, 1 witch, 1 seer. You are __profile__. Note that villager, seer, guard and witch are all in villager side, they have the same objective. Werewolves can collectively hunt ONE player at night."
,"HISTORY": "You have knowledge to the following conversation: __context__"

View file

@ -39,7 +39,7 @@ class AddNewExperiences(Action):
try:
chroma_client.get_collection(name=self.collection_name)
chroma_client.delete_collection(name=self.collection_name)
logger.info(f"existing collection {self.collection_name} deleted")
logger.info(f"existing collection `{self.collection_name}` deleted")
except:
pass
@ -106,7 +106,6 @@ class RetrieveExperiences(Action):
name=self.collection_name,
embedding_function=EMB_FN,
)
self.has_experiences = True
except:
logger.warning(f"No experience pool {self.collection_name}")
self.has_experiences = False

View file

@ -8,7 +8,7 @@ class Hunt(NighttimeWhispers):
class Impersonate(Speak):
"""Action: werewolf impersonating a good guy in daytime speak"""
STRATEGY = """
STRATEGY: str = """
Try continuously impersonating a role, such as Seer, Guard, Villager, etc., in order to mislead
other players, make them trust you, and thus hiding your werewolf identity. However, pay attention to what your werewolf partner said,
DONT claim the same role as your werewolf partner. Remmber NOT to reveal your real identity as a werewolf!

View file

@ -26,7 +26,7 @@ class Save(NighttimeWhispers):
class Poison(NighttimeWhispers):
STRATEGY = """
STRATEGY: str = """
Only poison a player if you are confident he/she is a werewolf. Don't poison a player randomly or at first night.
If someone claims to be the witch, poison him/her, because you are the only witch, he/she can only be a werewolf.
"""