mirror of
https://github.com/microsoft/autogen.git
synced 2025-08-31 20:07:30 +00:00
fix(magentic-one): Enhance error handling in orchestrate_step to manage invalid ledger formats (#4845)
* fix(magentic-one): Enhance error handling in orchestrate_step to manage invalid ledger formats * formatting --------- Co-authored-by: Roy Belio <robelio@microsoft.com> Co-authored-by: Jack Gerrits <jackgerrits@users.noreply.github.com> Co-authored-by: Jack Gerrits <jack@jackgerrits.com>
This commit is contained in:
parent
52c2a70e95
commit
00b06ab2e1
@ -297,6 +297,7 @@ class MagenticOneOrchestrator(BaseGroupChatManager):
|
||||
for key in required_keys:
|
||||
if (
|
||||
key not in progress_ledger
|
||||
or not isinstance(progress_ledger[key], dict)
|
||||
or "answer" not in progress_ledger[key]
|
||||
or "reason" not in progress_ledger[key]
|
||||
):
|
||||
@ -305,7 +306,9 @@ class MagenticOneOrchestrator(BaseGroupChatManager):
|
||||
if not key_error:
|
||||
break
|
||||
await self._log_message(f"Failed to parse ledger information, retrying: {ledger_str}")
|
||||
except json.JSONDecodeError:
|
||||
except (json.JSONDecodeError, TypeError):
|
||||
key_error = True
|
||||
await self._log_message("Invalid ledger format encountered, retrying...")
|
||||
continue
|
||||
if key_error:
|
||||
raise ValueError("Failed to parse ledger information after multiple retries.")
|
||||
|
Loading…
x
Reference in New Issue
Block a user