@@ -5,29 +5,40 @@ module OpenAI
55 cls . define_sorbet_constant! ( :OrHash ) { T . type_alias { T . any ( cls , OpenAI ::Internal ::AnyHash ) } }
66 end
77
8- [
9- * OpenAI :: Internal :: Type :: Enum . included_modules ,
10- * OpenAI ::Internal ::Type ::Union . included_modules
11- ] . each do |cls |
12- cls . constants . each do | name |
13- case cls . const_get ( name )
14- in true | false
15- cls . define_sorbet_constant! ( :TaggedBoolean ) { T . type_alias { T . all ( T ::Boolean , cls ) } }
16- cls . define_sorbet_constant! ( :OrBoolean ) { T . type_alias { T :: Boolean } }
17- in Integer
18- cls . define_sorbet_constant! ( :TaggedInteger ) { T . type_alias { T . all ( Integer , cls ) } }
19- cls . define_sorbet_constant! ( :OrInteger ) { T . type_alias { Integer } }
20- in Float
21- cls . define_sorbet_constant! ( :TaggedFloat ) { T . type_alias { T . all ( Float , cls ) } }
22- cls . define_sorbet_constant! ( :OrFloat ) { T . type_alias { Float } }
23- in Symbol
24- cls . define_sorbet_constant! ( :TaggedSymbol ) { T . type_alias { T . all ( Symbol , cls ) } }
25- cls . define_sorbet_constant! ( :OrSymbol ) { T . type_alias { T . any ( Symbol , String ) } }
26- else
8+ OpenAI :: Internal :: Util . walk_namespaces ( OpenAI :: Models ) . each do | mod |
9+ case mod
10+ in OpenAI ::Internal ::Type ::Enum | OpenAI :: Internal :: Type :: Union
11+ mod . constants . each do |name |
12+ case mod . const_get ( name )
13+ in true | false
14+ mod . define_sorbet_constant! ( :TaggedBoolean ) { T . type_alias { T . all ( T :: Boolean , mod ) } }
15+ mod . define_sorbet_constant! ( :OrBoolean ) { T . type_alias { T ::Boolean } }
16+ in Integer
17+ mod . define_sorbet_constant! ( :TaggedInteger ) { T . type_alias { T . all ( Integer , mod ) } }
18+ mod . define_sorbet_constant! ( :OrInteger ) { T . type_alias { Integer } }
19+ in Float
20+ mod . define_sorbet_constant! ( :TaggedFloat ) { T . type_alias { T . all ( Float , mod ) } }
21+ mod . define_sorbet_constant! ( :OrFloat ) { T . type_alias { Float } }
22+ in Symbol
23+ mod . define_sorbet_constant! ( :TaggedSymbol ) { T . type_alias { T . all ( Symbol , mod ) } }
24+ mod . define_sorbet_constant! ( :OrSymbol ) { T . type_alias { T . any ( Symbol , String ) } }
25+ else
26+ end
2727 end
28+ else
2829 end
2930 end
3031
32+ OpenAI ::Internal ::Util . walk_namespaces ( OpenAI ::Models )
33+ . lazy
34+ . grep ( OpenAI ::Internal ::Type ::Union )
35+ . each do |mod |
36+ const = :Variants
37+ next if mod . sorbet_constant_defined? ( const )
38+
39+ mod . define_sorbet_constant! ( const ) { T . type_alias { mod . to_sorbet_type } }
40+ end
41+
3142 AllModels = OpenAI ::Models ::AllModels
3243
3344 Audio = OpenAI ::Models ::Audio
0 commit comments