1
1
from typing import Any , Literal
2
2
from uuid import UUID
3
- from pydantic import BaseModel , Field , JsonValue , field_validator
3
+ from pydantic import BaseModel , Field , JsonValue , field_validator , model_validator
4
4
from enum import Enum
5
5
import json
6
6
@@ -153,3 +153,30 @@ class FunctionCallSSEData(BaseModel):
153
153
class FunctionCallSSE (BaseSSE ):
154
154
event : Literal ["copilotFunctionCall" ] = "copilotFunctionCall"
155
155
data : FunctionCallSSEData
156
+
157
+
158
+
159
+ class StatusUpdateSSEData (BaseModel ):
160
+ eventType : Literal ["INFO" , "WARNING" , "ERROR" ]
161
+ message : str
162
+ group : Literal ["reasoning" ] = "reasoning"
163
+ details : list [dict [str , str | int | float | None ]] | None = None
164
+ #artifacts: list[ClientArtifact] | None = None
165
+
166
+ @model_validator (mode = "before" )
167
+ @classmethod
168
+ def exclude_fields (cls , values ):
169
+ # Exclude these fields from being in the "details" field. (since this
170
+ # pollutes the JSON output)
171
+ _exclude_fields = []
172
+
173
+ if details := values .get ("details" ):
174
+ for detail in details :
175
+ for key in list (detail .keys ()):
176
+ if key .lower () in _exclude_fields :
177
+ detail .pop (key , None )
178
+ return values
179
+
180
+ class StatusUpdateSSE (BaseSSE ):
181
+ event : Literal ["copilotStatusUpdate" ] = "copilotStatusUpdate"
182
+ data : StatusUpdateSSEData
0 commit comments