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

狼人杀游戏中,类 'AgentBase' 的未解析的特性引用 'set_parser' #515

Open
jayabkkuh opened this issue Jan 15, 2025 · 4 comments

Comments

@jayabkkuh
Copy link

类 'AgentBase' 的未解析的特性引用 'set_parser'

@DavdGao
Copy link
Collaborator

DavdGao commented Jan 15, 2025

Could you provide more information?

@jayabkkuh
Copy link
Author

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)
现在我遇到了一个问题就是,我按照上面的代码运行,但是它老给我报这个错,有什么办法解决吗

@jayabkkuh
Copy link
Author

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)
现在我遇到了一个问题就是,我按照例子中狼人杀的代码运行时,但是它老给我报这个错,有什么办法解决吗

@qbc2016
Copy link
Collaborator

qbc2016 commented Jan 15, 2025

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants