From 71029add365202a13c55c39e8d8e6a0666167dc5 Mon Sep 17 00:00:00 2001 From: Xingyao Wang Date: Mon, 30 Dec 2024 06:04:05 +0800 Subject: [PATCH] Update openhands/events/serialization/event.py Co-authored-by: Engel Nyst --- openhands/events/serialization/event.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/openhands/events/serialization/event.py b/openhands/events/serialization/event.py index 8c43702551b9..cf2637ab667d 100644 --- a/openhands/events/serialization/event.py +++ b/openhands/events/serialization/event.py @@ -90,6 +90,10 @@ def event_to_dict(event: 'Event') -> dict: d['timeout'] = event.timeout elif 'observation' in d: d['content'] = props.pop('content', '') + + # props is a dict whose values can include a complex object like an instance of a BaseModel subclass + # such as CmdOutputMetadata + # we serialize it along with the rest d['extras'] = {k: _convert_pydantic_to_dict(v) for k, v in props.items()} # Include success field for CmdOutputObservation if hasattr(event, 'success'):