Skip to content

Commit e545e5c

Browse files
committed
fix lint
1 parent 5cf8802 commit e545e5c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pydantic_ai_slim/pydantic_ai/ui/messages_builder.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,17 @@ class MessagesBuilder:
1111

1212
messages: list[ModelMessage] = field(default_factory=list)
1313

14-
def add(self, part: ModelRequest | ModelResponse | ModelRequestPart | ModelResponsePart) -> None:
14+
def add(self, part: ModelRequestPart | ModelResponsePart) -> None:
1515
"""Add a new part, creating a new request or response message if necessary."""
1616
last_message = self.messages[-1] if self.messages else None
1717
if isinstance(part, get_union_args(ModelRequestPart)):
18+
part = cast(ModelRequestPart, part)
1819
if isinstance(last_message, ModelRequest):
19-
last_message.parts = [*last_message.parts, cast(ModelRequestPart, part)]
20+
last_message.parts = [*last_message.parts, part]
2021
else:
2122
self.messages.append(ModelRequest(parts=[part]))
2223
else:
24+
part = cast(ModelResponsePart, part)
2325
if isinstance(last_message, ModelResponse):
2426
last_message.parts = [*last_message.parts, part]
2527
else:

0 commit comments

Comments
 (0)