8
8
import httpx
9
9
10
10
from ..._utils import is_dict , is_list , consume_sync_iterator , consume_async_iterator
11
+ from ..._compat import model_dump
11
12
from ..._models import construct_type
12
13
from ..._streaming import Stream , AsyncStream
13
14
from ...types .beta import AssistantStreamEvent
@@ -906,11 +907,11 @@ def accumulate_run_step(
906
907
merged = accumulate_delta (
907
908
cast (
908
909
"dict[object, object]" ,
909
- snapshot . model_dump (exclude_unset = True , warnings = False ),
910
+ model_dump (snapshot , exclude_unset = True , warnings = False ),
910
911
),
911
912
cast (
912
913
"dict[object, object]" ,
913
- data .delta . model_dump ( exclude_unset = True , warnings = False ),
914
+ model_dump ( data .delta , exclude_unset = True , warnings = False ),
914
915
),
915
916
)
916
917
run_step_snapshots [snapshot .id ] = cast (RunStep , construct_type (type_ = RunStep , value = merged ))
@@ -948,7 +949,7 @@ def accumulate_event(
948
949
construct_type (
949
950
# mypy doesn't allow Content for some reason
950
951
type_ = cast (Any , MessageContent ),
951
- value = content_delta . model_dump (exclude_unset = True , warnings = False ),
952
+ value = model_dump (content_delta , exclude_unset = True , warnings = False ),
952
953
),
953
954
),
954
955
)
@@ -957,11 +958,11 @@ def accumulate_event(
957
958
merged = accumulate_delta (
958
959
cast (
959
960
"dict[object, object]" ,
960
- block . model_dump (exclude_unset = True , warnings = False ),
961
+ model_dump (block , exclude_unset = True , warnings = False ),
961
962
),
962
963
cast (
963
964
"dict[object, object]" ,
964
- content_delta . model_dump (exclude_unset = True , warnings = False ),
965
+ model_dump (content_delta , exclude_unset = True , warnings = False ),
965
966
),
966
967
)
967
968
current_message_snapshot .content [content_delta .index ] = cast (
0 commit comments