What happened?
Describe the bug
When I use the MagenticOneGroupChat and gpt-4o to build something, found a little problem.
The ORCHESTRATOR_PROGRESS_LEDGER_PROMPT required the model_client output json format as below
Please output an answer in pure JSON format according to the following schema.
The JSON object must be parsable as-is.
DO NOT OUTPUT ANYTHING OTHER THAN JSON, AND DO NOT DEVIATE FROM THIS SCHEMA:
{{
"is_request_satisfied": {{
"reason": string,
"answer": boolean
}},
"is_in_loop": {{
"reason": string,
"answer": boolean
}},
"is_progress_being_made": {{
"reason": string,
"answer": boolean
}},
"next_speaker": {{
"reason": string,
"answer": string (select from: {names})
}},
"instruction_or_question": {{
"reason": string,
"answer": string
}}
}}
but the result is markdown format json like this and it will cause the team chat failed
{
"content": "```json {...}"
}
To Reproduce
MagenticGroupChat and gpt-4o
ERROR:src.da_agent_magentic:群聊执行失败: Failed to parse ledger information after multiple retries.
Traceback (most recent call last):
File "/agent_demo/src/da_agent_magentic.py", line 100, in analyze_data_file
await Console(team.run_stream(task=task_description))
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_agentchat/ui/_console.py", line 117, in Console
async for message in stream:
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_base_group_chat.py", line 499, in run_stream
await self._runtime.send_message(
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_core/_single_threaded_agent_runtime.py", line 332, in send_message
return await future
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_core/_single_threaded_agent_runtime.py", line 445, in _process_send
response = await recipient_agent.on_message(
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_core/_base_agent.py", line 113, in on_message
return await self.on_message_impl(message, ctx)
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_sequential_routed_agent.py", line 67, in on_message_impl
return await super().on_message_impl(message, ctx)
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_core/_routed_agent.py", line 485, in on_message_impl
return await h(self, message, ctx)
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_core/_routed_agent.py", line 389, in wrapper
return_value = await func(self, message, ctx)
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py", line 186, in handle_start
await self._reenter_outer_loop(ctx.cancellation_token)
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py", line 283, in _reenter_outer_loop
await self._orchestrate_step(cancellation_token=cancellation_token)
File "/agent_demo/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_orchestrator.py", line 353, in _orchestrate_ste
raise ValueError("Failed to parse ledger information after multiple retries.")
Expected behavior
The output should just as the prompt requires, just pure json.
Additional context
When the ORCHESTRATOR_PROGRESS_LEDGER_PROMPT prompt add the following content, the issue will not appear any more.
DO NOT OUTPUT MARKDOWN FORMAT JSON
It should like below
Please output an answer in pure JSON format according to the following schema.
The JSON object must be parsable as-is.
DO NOT OUTPUT ANYTHING OTHER THAN JSON,
DO NOT OUTPUT MARKDOWN FORMAT JSON,
AND DO NOT DEVIATE FROM THIS SCHEMA
...
Which packages was the bug in?
Python AgentChat (autogen-agentchat>=0.4.0)
AutoGen library version.
Python 0.5.6
Other library version.
No response
Model used
gpt-4o
Model provider
OpenAI
Other model provider
No response
Python version
3.10
.NET version
None
Operating system
MacOS
What happened?
Describe the bug
When I use the
MagenticOneGroupChatand gpt-4o to build something, found a little problem.The
ORCHESTRATOR_PROGRESS_LEDGER_PROMPTrequired the model_client output json format as belowbut the result is markdown format json like this and it will cause the team chat failed
{ "content": "```json {...}" }To Reproduce
MagenticGroupChat and gpt-4o
Expected behavior
The output should just as the prompt requires, just pure json.
{ "content": "{...}" }Additional context
When the
ORCHESTRATOR_PROGRESS_LEDGER_PROMPTprompt add the following content, the issue will not appear any more.It should like below
Which packages was the bug in?
Python AgentChat (autogen-agentchat>=0.4.0)
AutoGen library version.
Python 0.5.6
Other library version.
No response
Model used
gpt-4o
Model provider
OpenAI
Other model provider
No response
Python version
3.10
.NET version
None
Operating system
MacOS