@@ -232,6 +232,18 @@ type CodeInterpreterToolCallCodeInterpreterOutputUnion struct {
232
232
} `json:"-"`
233
233
}
234
234
235
+ // anyCodeInterpreterToolCallCodeInterpreterOutput is implemented by each variant
236
+ // of [CodeInterpreterToolCallCodeInterpreterOutputUnion] to add type safety for
237
+ // the return type of [CodeInterpreterToolCallCodeInterpreterOutputUnion.AsAny]
238
+ type anyCodeInterpreterToolCallCodeInterpreterOutput interface {
239
+ implCodeInterpreterToolCallCodeInterpreterOutputUnion ()
240
+ }
241
+
242
+ func (CodeInterpreterToolCallCodeInterpreterOutputLogs ) implCodeInterpreterToolCallCodeInterpreterOutputUnion () {
243
+ }
244
+ func (CodeInterpreterToolCallCodeInterpreterOutputImage ) implCodeInterpreterToolCallCodeInterpreterOutputUnion () {
245
+ }
246
+
235
247
// Use the following switch statement to find the correct variant
236
248
//
237
249
// switch variant := CodeInterpreterToolCallCodeInterpreterOutputUnion.AsAny().(type) {
@@ -240,7 +252,7 @@ type CodeInterpreterToolCallCodeInterpreterOutputUnion struct {
240
252
// default:
241
253
// fmt.Errorf("no variant present")
242
254
// }
243
- func (u CodeInterpreterToolCallCodeInterpreterOutputUnion ) AsAny () any {
255
+ func (u CodeInterpreterToolCallCodeInterpreterOutputUnion ) AsAny () anyCodeInterpreterToolCallCodeInterpreterOutput {
244
256
switch u .Type {
245
257
case "logs" :
246
258
return u .AsLogs ()
@@ -405,6 +417,17 @@ type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion struct {
405
417
} `json:"-"`
406
418
}
407
419
420
+ // anyCodeInterpreterToolCallDeltaCodeInterpreterOutput is implemented by each
421
+ // variant of [CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion] to add type
422
+ // safety for the return type of
423
+ // [CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion.AsAny]
424
+ type anyCodeInterpreterToolCallDeltaCodeInterpreterOutput interface {
425
+ implCodeInterpreterToolCallDeltaCodeInterpreterOutputUnion ()
426
+ }
427
+
428
+ func (CodeInterpreterLogs ) implCodeInterpreterToolCallDeltaCodeInterpreterOutputUnion () {}
429
+ func (CodeInterpreterOutputImage ) implCodeInterpreterToolCallDeltaCodeInterpreterOutputUnion () {}
430
+
408
431
// Use the following switch statement to find the correct variant
409
432
//
410
433
// switch variant := CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion.AsAny().(type) {
@@ -413,7 +436,7 @@ type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion struct {
413
436
// default:
414
437
// fmt.Errorf("no variant present")
415
438
// }
416
- func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion ) AsAny () any {
439
+ func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion ) AsAny () anyCodeInterpreterToolCallDeltaCodeInterpreterOutput {
417
440
switch u .Type {
418
441
case "logs" :
419
442
return u .AsLogs ()
@@ -879,6 +902,16 @@ type RunStepStepDetailsUnion struct {
879
902
} `json:"-"`
880
903
}
881
904
905
+ // anyRunStepStepDetails is implemented by each variant of
906
+ // [RunStepStepDetailsUnion] to add type safety for the return type of
907
+ // [RunStepStepDetailsUnion.AsAny]
908
+ type anyRunStepStepDetails interface {
909
+ implRunStepStepDetailsUnion ()
910
+ }
911
+
912
+ func (MessageCreationStepDetails ) implRunStepStepDetailsUnion () {}
913
+ func (ToolCallsStepDetails ) implRunStepStepDetailsUnion () {}
914
+
882
915
// Use the following switch statement to find the correct variant
883
916
//
884
917
// switch variant := RunStepStepDetailsUnion.AsAny().(type) {
@@ -887,7 +920,7 @@ type RunStepStepDetailsUnion struct {
887
920
// default:
888
921
// fmt.Errorf("no variant present")
889
922
// }
890
- func (u RunStepStepDetailsUnion ) AsAny () any {
923
+ func (u RunStepStepDetailsUnion ) AsAny () anyRunStepStepDetails {
891
924
switch u .Type {
892
925
case "message_creation" :
893
926
return u .AsMessageCreation ()
@@ -988,6 +1021,16 @@ type RunStepDeltaStepDetailsUnion struct {
988
1021
} `json:"-"`
989
1022
}
990
1023
1024
+ // anyRunStepDeltaStepDetails is implemented by each variant of
1025
+ // [RunStepDeltaStepDetailsUnion] to add type safety for the return type of
1026
+ // [RunStepDeltaStepDetailsUnion.AsAny]
1027
+ type anyRunStepDeltaStepDetails interface {
1028
+ implRunStepDeltaStepDetailsUnion ()
1029
+ }
1030
+
1031
+ func (RunStepDeltaMessageDelta ) implRunStepDeltaStepDetailsUnion () {}
1032
+ func (ToolCallDeltaObject ) implRunStepDeltaStepDetailsUnion () {}
1033
+
991
1034
// Use the following switch statement to find the correct variant
992
1035
//
993
1036
// switch variant := RunStepDeltaStepDetailsUnion.AsAny().(type) {
@@ -996,7 +1039,7 @@ type RunStepDeltaStepDetailsUnion struct {
996
1039
// default:
997
1040
// fmt.Errorf("no variant present")
998
1041
// }
999
- func (u RunStepDeltaStepDetailsUnion ) AsAny () any {
1042
+ func (u RunStepDeltaStepDetailsUnion ) AsAny () anyRunStepDeltaStepDetails {
1000
1043
switch u .Type {
1001
1044
case "message_creation" :
1002
1045
return u .AsMessageCreation ()
@@ -1120,6 +1163,16 @@ type ToolCallUnion struct {
1120
1163
} `json:"-"`
1121
1164
}
1122
1165
1166
+ // anyToolCall is implemented by each variant of [ToolCallUnion] to add type safety
1167
+ // for the return type of [ToolCallUnion.AsAny]
1168
+ type anyToolCall interface {
1169
+ implToolCallUnion ()
1170
+ }
1171
+
1172
+ func (CodeInterpreterToolCall ) implToolCallUnion () {}
1173
+ func (FileSearchToolCall ) implToolCallUnion () {}
1174
+ func (FunctionToolCall ) implToolCallUnion () {}
1175
+
1123
1176
// Use the following switch statement to find the correct variant
1124
1177
//
1125
1178
// switch variant := ToolCallUnion.AsAny().(type) {
@@ -1129,7 +1182,7 @@ type ToolCallUnion struct {
1129
1182
// default:
1130
1183
// fmt.Errorf("no variant present")
1131
1184
// }
1132
- func (u ToolCallUnion ) AsAny () any {
1185
+ func (u ToolCallUnion ) AsAny () anyToolCall {
1133
1186
switch u .Type {
1134
1187
case "code_interpreter" :
1135
1188
return u .AsCodeInterpreter ()
@@ -1192,6 +1245,16 @@ type ToolCallDeltaUnion struct {
1192
1245
} `json:"-"`
1193
1246
}
1194
1247
1248
+ // anyToolCallDelta is implemented by each variant of [ToolCallDeltaUnion] to add
1249
+ // type safety for the return type of [ToolCallDeltaUnion.AsAny]
1250
+ type anyToolCallDelta interface {
1251
+ implToolCallDeltaUnion ()
1252
+ }
1253
+
1254
+ func (CodeInterpreterToolCallDelta ) implToolCallDeltaUnion () {}
1255
+ func (FileSearchToolCallDelta ) implToolCallDeltaUnion () {}
1256
+ func (FunctionToolCallDelta ) implToolCallDeltaUnion () {}
1257
+
1195
1258
// Use the following switch statement to find the correct variant
1196
1259
//
1197
1260
// switch variant := ToolCallDeltaUnion.AsAny().(type) {
@@ -1201,7 +1264,7 @@ type ToolCallDeltaUnion struct {
1201
1264
// default:
1202
1265
// fmt.Errorf("no variant present")
1203
1266
// }
1204
- func (u ToolCallDeltaUnion ) AsAny () any {
1267
+ func (u ToolCallDeltaUnion ) AsAny () anyToolCallDelta {
1205
1268
switch u .Type {
1206
1269
case "code_interpreter" :
1207
1270
return u .AsCodeInterpreter ()
0 commit comments