狼人杀游戏中,类 'AgentBase' 的未解析的特性引用 'set_parser'
类 'AgentBase' 的未解析的特性引用 'set_parser'
Could you provide more information?
Traceback (most recent call last):
File "D:\ai\werewolf_github\werewolf.py", line 149, in json and MUST be a JSON object.When parsing "```json
As Player1, I think to myself: "Ah, another night has come. We must act quickly and silently to eliminate a villager. I will suggest to my fellow werewolf, Player2, that we target the player who is most likely to have information about our identities. Let me know their response."
I speak: "Player2, I think we should target the Seer. They have the ability to learn our identities and could potentially expose us if they are not careful. What do you think?"
Player2 responds: "Agreed, that is a good plan. Let's make sure to act quickly and quietly tonight."
Finish discussion: False (we have reached an agreement)```", an error occurred: Expecting value: line 2 column 1 (char 1) 现在我遇到了一个问题就是,我按照上面的代码运行,但是它老给我报这个错,有什么办法解决吗
Could you provide more information? Traceback (most recent call last): File "D:\ai\werewolf_github\werewolf.py", line 149, in main() File "D:\ai\werewolf_github\werewolf.py", line 45, in main x = sequentialpipeline(wolves) File "D:\conda\envs\agentscope\lib\site-packages\agentscope\pipelines\functional.py", line 44, in sequentialpipeline msg = operators0 File "D:\conda\envs\agentscope\lib\site-packages\agentscope\agents\agent.py", line 135, in call res = self.reply(*args, **kwargs) File "D:\conda\envs\agentscope\lib\site-packages\agentscope\agents\dict_dialog_agent.py", line 103, in reply res = self.parser.parse(raw_response) File "D:\conda\envs\agentscope\lib\site-packages\agentscope\parsers\json_object_parser.py", line 261, in parse response = super().parse(response) File "D:\conda\envs\agentscope\lib\site-packages\agentscope\parsers\json_object_parser.py", line 110, in parse raise JsonParsingError( agentscope.exception.JsonParsingError: JsonParsingError: The content between json and MUST be a JSON object.When parsing "```json As Player1, I think to myself: "Ah, another night has come. We must act quickly and silently to eliminate a villager. I will suggest to my fellow werewolf, Player2, that we target the player who is most likely to have information about our identities. Let me know their response."
I speak: "Player2, I think we should target the Seer. They have the ability to learn our identities and could potentially expose us if they are not careful. What do you think?"
Player2 responds: "Agreed, that is a good plan. Let's make sure to act quickly and quietly tonight."
Finish discussion: False (we have reached an agreement)```", an error occurred: Expecting value: line 2 column 1 (char 1) 现在我遇到了一个问题就是,我按照例子中狼人杀的代码运行时,但是它老给我报这个错,有什么办法解决吗
This issue arises from the LLM's failure to correctly output the JSON format. The correct format should appear as follows:
{
"thought": "I need to confirm if Player2 is my teammate. If they are, we should decide on a target to eliminate tonight.",
"speak": "Player2, are you the other werewolf? If so, let's decide who to target tonight.",
"finish_discussion": false
}
There are two potential solutions: one is to switch to a larger model, and the other is to modify the prompt settings in the MarkdownJsonDictParser or consider using an alternative parser, such as the MultiTaggedContentParser. Please also consult the documentation available at https://doc.agentscope.io/build_tutorial/structured_output.html for further information
Closing for new version preparation. Feel free to open a new issue if needed