Carried over from #126 and originally requested by @agarcher.
Applications can define structured-output schemas by subclassing OpenAI::BaseModel, but the SDK does not ship a supported Tapioca compiler (or equivalent) that generates RBI definitions for those application-defined models. The generated SDK RBI also exposes fields such as message.parsed and response output parsed as T.anything.
The OpenAI::EnumOf#to_sorbet_type bug was separately fixed in #151; this issue tracks the remaining end-to-end typing experience.
Desired behavior
- Provide a supported way to generate useful RBI definitions for application-defined
OpenAI::BaseModel subclasses.
- Cover fields declared with
required, optional, OpenAI::ArrayOf, OpenAI::EnumOf, nested models, and nilability.
- Ideally preserve the supplied structured-output model type through
parsed; at minimum, make a documented T.cast/assertion type-safe by generating the schema class's accessors.
- Keep compatibility with the SDK's policy of not requiring
sorbet-runtime.
- Add documentation and a representative Tapioca/Sorbet test.
Source discussion and prototype compiler: #126.
Carried over from #126 and originally requested by @agarcher.
Applications can define structured-output schemas by subclassing
OpenAI::BaseModel, but the SDK does not ship a supported Tapioca compiler (or equivalent) that generates RBI definitions for those application-defined models. The generated SDK RBI also exposes fields such asmessage.parsedand response outputparsedasT.anything.The
OpenAI::EnumOf#to_sorbet_typebug was separately fixed in #151; this issue tracks the remaining end-to-end typing experience.Desired behavior
OpenAI::BaseModelsubclasses.required,optional,OpenAI::ArrayOf,OpenAI::EnumOf, nested models, and nilability.parsed; at minimum, make a documentedT.cast/assertion type-safe by generating the schema class's accessors.sorbet-runtime.Source discussion and prototype compiler: #126.