@@ -232,6 +232,18 @@ type CodeInterpreterToolCallCodeInterpreterOutputUnion struct {
232232 } `json:"-"`
233233}
234234
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+
235247// Use the following switch statement to find the correct variant
236248//
237249// switch variant := CodeInterpreterToolCallCodeInterpreterOutputUnion.AsAny().(type) {
@@ -240,7 +252,7 @@ type CodeInterpreterToolCallCodeInterpreterOutputUnion struct {
240252// default:
241253// fmt.Errorf("no variant present")
242254// }
243- func (u CodeInterpreterToolCallCodeInterpreterOutputUnion ) AsAny () any {
255+ func (u CodeInterpreterToolCallCodeInterpreterOutputUnion ) AsAny () anyCodeInterpreterToolCallCodeInterpreterOutput {
244256 switch u .Type {
245257 case "logs" :
246258 return u .AsLogs ()
@@ -405,6 +417,17 @@ type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion struct {
405417 } `json:"-"`
406418}
407419
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+
408431// Use the following switch statement to find the correct variant
409432//
410433// switch variant := CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion.AsAny().(type) {
@@ -413,7 +436,7 @@ type CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion struct {
413436// default:
414437// fmt.Errorf("no variant present")
415438// }
416- func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion ) AsAny () any {
439+ func (u CodeInterpreterToolCallDeltaCodeInterpreterOutputUnion ) AsAny () anyCodeInterpreterToolCallDeltaCodeInterpreterOutput {
417440 switch u .Type {
418441 case "logs" :
419442 return u .AsLogs ()
@@ -879,6 +902,16 @@ type RunStepStepDetailsUnion struct {
879902 } `json:"-"`
880903}
881904
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+
882915// Use the following switch statement to find the correct variant
883916//
884917// switch variant := RunStepStepDetailsUnion.AsAny().(type) {
@@ -887,7 +920,7 @@ type RunStepStepDetailsUnion struct {
887920// default:
888921// fmt.Errorf("no variant present")
889922// }
890- func (u RunStepStepDetailsUnion ) AsAny () any {
923+ func (u RunStepStepDetailsUnion ) AsAny () anyRunStepStepDetails {
891924 switch u .Type {
892925 case "message_creation" :
893926 return u .AsMessageCreation ()
@@ -988,6 +1021,16 @@ type RunStepDeltaStepDetailsUnion struct {
9881021 } `json:"-"`
9891022}
9901023
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+
9911034// Use the following switch statement to find the correct variant
9921035//
9931036// switch variant := RunStepDeltaStepDetailsUnion.AsAny().(type) {
@@ -996,7 +1039,7 @@ type RunStepDeltaStepDetailsUnion struct {
9961039// default:
9971040// fmt.Errorf("no variant present")
9981041// }
999- func (u RunStepDeltaStepDetailsUnion ) AsAny () any {
1042+ func (u RunStepDeltaStepDetailsUnion ) AsAny () anyRunStepDeltaStepDetails {
10001043 switch u .Type {
10011044 case "message_creation" :
10021045 return u .AsMessageCreation ()
@@ -1120,6 +1163,16 @@ type ToolCallUnion struct {
11201163 } `json:"-"`
11211164}
11221165
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+
11231176// Use the following switch statement to find the correct variant
11241177//
11251178// switch variant := ToolCallUnion.AsAny().(type) {
@@ -1129,7 +1182,7 @@ type ToolCallUnion struct {
11291182// default:
11301183// fmt.Errorf("no variant present")
11311184// }
1132- func (u ToolCallUnion ) AsAny () any {
1185+ func (u ToolCallUnion ) AsAny () anyToolCall {
11331186 switch u .Type {
11341187 case "code_interpreter" :
11351188 return u .AsCodeInterpreter ()
@@ -1192,6 +1245,16 @@ type ToolCallDeltaUnion struct {
11921245 } `json:"-"`
11931246}
11941247
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+
11951258// Use the following switch statement to find the correct variant
11961259//
11971260// switch variant := ToolCallDeltaUnion.AsAny().(type) {
@@ -1201,7 +1264,7 @@ type ToolCallDeltaUnion struct {
12011264// default:
12021265// fmt.Errorf("no variant present")
12031266// }
1204- func (u ToolCallDeltaUnion ) AsAny () any {
1267+ func (u ToolCallDeltaUnion ) AsAny () anyToolCallDelta {
12051268 switch u .Type {
12061269 case "code_interpreter" :
12071270 return u .AsCodeInterpreter ()
0 commit comments