File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -143,8 +143,9 @@ async def copilotkit_emit_state(state: Any) -> Literal[True]:
143143 """
144144 execution = get_context_execution ()
145145
146+ state_as_dict = state .model_dump () if isinstance (state , BaseModel ) else state
146147 state = {
147- k : v for k , v in state .items () if k not in ["messages" ]
148+ k : v for k , v in state_as_dict .items () if k not in ["messages" , "copilotkit " ]
148149 }
149150
150151 await queue_put (
Original file line number Diff line number Diff line change @@ -335,7 +335,11 @@ def predict_state(
335335 state = json .dumps (
336336 _filter_state (
337337 state = {
338- ** execution ["state" ],
338+ ** (
339+ execution ["state" ].model_dump ()
340+ if isinstance (execution ["state" ], BaseModel )
341+ else execution ["state" ]
342+ ),
339343 ** execution ["predicted_state" ]
340344 }
341345 )
You can’t perform that action at this time.
0 commit comments