sig/ directory. RBS is Ruby’s standard type signature format, supported by multiple type checkers including Steep.
What is RBS?
RBS is Ruby’s official type signature language. It provides a way to describe the structure of Ruby programs with type definitions in separate.rbs files.
RBS Files Location
The SDK includes RBS signatures in thesig/ directory of the gem:
Using RBS with Steep
Steep is the primary type checker for RBS. Here’s how to set it up:Type-Safe Code Examples
With RBS signatures, type checkers can verify your OpenAI API usage:Type Errors Caught by Steep
Steep will catch common errors:Editor Integration
Many editors support RBS through language servers:VS Code
Install the Ruby LSP extension, which supports RBS type checking.RubyMine
RubyMine has built-in support for RBS type signatures.Vim/Neovim
Use the ruby-lsp with your LSP client of choice.RBS vs RBI (Sorbet)
The OpenAI Ruby SDK provides both RBS and RBI (Sorbet) type definitions:RBS
Ruby’s standard format
- Used by Steep
- Official Ruby signature format
- Located in
sig/directory - Community standard
RBI (Sorbet)
Sorbet’s format
- Used by Sorbet
- Runtime type checking option
- Located in
rbi/directory - Tagged symbols for enums
- Use RBS with Steep or other RBS-compatible tools
- Use RBI with Sorbet
Generating RBS for Your Code
If you’re building applications with the OpenAI SDK, you can generate RBS signatures for your own code using typeprof:Type Definition Updates
The OpenAI Ruby SDK considers improvements to
*.rbs and *.rbi type definitions to be non-breaking changes according to SemVer. Type signatures may be refined in patch releases to improve accuracy.Related Resources
Sorbet Types
Sorbet RBI type definitions
BaseModel
BaseModel conveniences
RBS Documentation
Official RBS documentation
Steep Documentation
Steep type checker docs