Skip to content

Commit f1fd950

Browse files
committed
fix(ag-ui): list typing under python 3.9
Python 3.9 doesn't support multiple types in a single list type hint so switch to Union for compatibility.
1 parent 9d08360 commit f1fd950

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pydantic_ai_slim/pydantic_ai/ag_ui.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
NoReturn,
2222
Protocol,
2323
TypeVar,
24+
Union,
2425
cast,
2526
runtime_checkable,
2627
)
@@ -1016,7 +1017,7 @@ class _RequestStreamContext:
10161017

10171018
message_id: str = ''
10181019
last_tool_call_id: str | None = None
1019-
part_ends: list[BaseEvent | None] = field(default_factory=lambda: list[BaseEvent | None]())
1020+
part_ends: list[BaseEvent | None] = field(default_factory=lambda: list[Union[BaseEvent, None]]())
10201021
local_tool_calls: set[str] = field(default_factory=set)
10211022

10221023
def new_message_id(self) -> str:

0 commit comments

Comments
 (0)