Skip to content

Commit

Permalink
fix bug on errornous message serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
xingyaoww committed Nov 8, 2024
1 parent 93ac44e commit 4fb2f07
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion openhands/core/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ def serialize_model(self) -> dict:
# - into a single string: for providers that don't support list of content items (e.g. no vision, no tool calls)
# - into a list of content items: the new APIs of providers with vision/prompt caching/tool calls
# NOTE: remove this when litellm or providers support the new API
if self.cache_enabled or self.vision_enabled or self.tool_call_id is not None:
if (
self.cache_enabled
or self.vision_enabled
or self.tool_call_id is not None
or self.tool_calls is not None
):
return self._list_serializer()
return self._string_serializer()

Expand Down

0 comments on commit 4fb2f07

Please sign in to comment.