diff --git a/README.md b/README.md index fa326448..3a2e94a6 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # OpenAI Ruby API library -The OpenAI Ruby library provides convenient access to the OpenAI REST API from any Ruby 3.0.0+ application. +The OpenAI Ruby library provides convenient access to the OpenAI REST API from any Ruby 3.1.0+ application. ## Documentation @@ -202,4 +202,4 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ ## Requirements -Ruby 3.0.0 or higher. +Ruby 3.1.0 or higher. diff --git a/lib/openai/internal/cursor_page.rb b/lib/openai/internal/cursor_page.rb index ba3b1b74..90625f49 100644 --- a/lib/openai/internal/cursor_page.rb +++ b/lib/openai/internal/cursor_page.rb @@ -11,18 +11,6 @@ module Internal # cursor_page.auto_paging_each do |completion| # puts(completion) # end - # - # @example - # completions = - # cursor_page - # .to_enum - # .lazy - # .select { _1.object_id.even? } - # .map(&:itself) - # .take(2) - # .to_a - # - # completions => Array class CursorPage include OpenAI::Internal::Type::BasePage diff --git a/lib/openai/internal/page.rb b/lib/openai/internal/page.rb index 867cd496..3fd199ef 100644 --- a/lib/openai/internal/page.rb +++ b/lib/openai/internal/page.rb @@ -11,18 +11,6 @@ module Internal # page.auto_paging_each do |model| # puts(model) # end - # - # @example - # models = - # page - # .to_enum - # .lazy - # .select { _1.object_id.even? } - # .map(&:itself) - # .take(2) - # .to_a - # - # models => Array class Page include OpenAI::Internal::Type::BasePage diff --git a/lib/openai/internal/stream.rb b/lib/openai/internal/stream.rb index 3c9e0748..bef131b1 100644 --- a/lib/openai/internal/stream.rb +++ b/lib/openai/internal/stream.rb @@ -6,17 +6,6 @@ module Internal # stream.each do |event| # puts(event) # end - # - # @example - # events = - # stream - # .lazy - # .select { _1.object_id.even? } - # .map(&:itself) - # .take(2) - # .to_a - # - # events => Array class Stream include OpenAI::Internal::Type::BaseStream diff --git a/lib/openai/internal/type/base_page.rb b/lib/openai/internal/type/base_page.rb index 63882c48..a530d34b 100644 --- a/lib/openai/internal/type/base_page.rb +++ b/lib/openai/internal/type/base_page.rb @@ -3,27 +3,7 @@ module OpenAI module Internal module Type - # @example - # if page.has_next? - # page = page.next_page - # end - # - # @example - # page.auto_paging_each do |completion| - # puts(completion) - # end - # - # @example - # completions = - # page - # .to_enum - # .lazy - # .select { _1.object_id.even? } - # .map(&:itself) - # .take(2) - # .to_a - # - # completions => Array + # This module provides a base implementation for paginated responses in the SDK. module BasePage # rubocop:disable Lint/UnusedMethodArgument diff --git a/lib/openai/internal/type/base_stream.rb b/lib/openai/internal/type/base_stream.rb index 064878ba..53bbcecb 100644 --- a/lib/openai/internal/type/base_stream.rb +++ b/lib/openai/internal/type/base_stream.rb @@ -3,21 +3,9 @@ module OpenAI module Internal module Type - # @example - # stream.each do |chunk| - # puts(chunk) - # end + # This module provides a base implementation for streaming responses in the SDK. # - # @example - # chunks = - # stream - # .lazy - # .select { _1.object_id.even? } - # .map(&:itself) - # .take(2) - # .to_a - # - # chunks => Array + # @see https://rubyapi.org/3.1/o/enumerable module BaseStream include Enumerable diff --git a/rbi/lib/openai/internal.rbi b/rbi/lib/openai/internal.rbi index ff17c5f5..42138966 100644 --- a/rbi/lib/openai/internal.rbi +++ b/rbi/lib/openai/internal.rbi @@ -6,5 +6,7 @@ module OpenAI # Due to the current WIP status of Shapes support in Sorbet, types referencing # this alias might be refined in the future. AnyHash = T.type_alias { T::Hash[Symbol, T.anything] } + + OMIT = T.let(T.anything, T.anything) end end diff --git a/rbi/lib/openai/internal/type/base_page.rbi b/rbi/lib/openai/internal/type/base_page.rbi index 1125a5c8..b40068ca 100644 --- a/rbi/lib/openai/internal/type/base_page.rbi +++ b/rbi/lib/openai/internal/type/base_page.rbi @@ -3,6 +3,7 @@ module OpenAI module Internal module Type + # This module provides a base implementation for paginated responses in the SDK. module BasePage Elem = type_member(:out) diff --git a/rbi/lib/openai/internal/type/base_stream.rbi b/rbi/lib/openai/internal/type/base_stream.rbi index 10e8da7e..1e0940f8 100644 --- a/rbi/lib/openai/internal/type/base_stream.rbi +++ b/rbi/lib/openai/internal/type/base_stream.rbi @@ -3,6 +3,7 @@ module OpenAI module Internal module Type + # This module provides a base implementation for streaming responses in the SDK. module BaseStream include Enumerable diff --git a/sig/openai/internal.rbs b/sig/openai/internal.rbs index ff72a6b0..1da6dd75 100644 --- a/sig/openai/internal.rbs +++ b/sig/openai/internal.rbs @@ -1,4 +1,5 @@ module OpenAI module Internal + OMIT: top end end