This commit is contained in:
Chester Curme 2025-07-11 15:25:07 -04:00
parent 7e740e5e1f
commit 3460c48af6
2 changed files with 15 additions and 23 deletions

View File

@ -213,14 +213,8 @@ class AIMessage(BaseMessage):
otherwise, does best-effort parsing to standard types.
"""
blocks: list[types.ContentBlock] = []
if isinstance(self.content, str):
if self.content:
blocks.append({"type": "text", "text": self.content})
else:
pass
elif isinstance(self.content, list):
for item in self.content:
content = [self.content] if isinstance(self.content, str) else self.content
for item in content:
if isinstance(item, str):
blocks.append({"type": "text", "text": item})
@ -235,8 +229,6 @@ class AIMessage(BaseMessage):
raise ValueError(msg)
else:
pass
else:
pass
# Add from tool_calls if missing from content
content_tool_call_ids = {

View File

@ -156,7 +156,7 @@ _DataContentBlockAdapter: TypeAdapter[DataContentBlock] = TypeAdapter(DataConten
# Non-standard
class NonStandardContentBlock(TypedDict, total=False):
class NonStandardContentBlock(TypedDict):
"""Content block provider-specific data.
This block contains data for which there is not yet a standard type.