Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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.
12 changes: 0 additions & 12 deletions lib/openai/internal/cursor_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 0 additions & 12 deletions lib/openai/internal/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 0 additions & 11 deletions lib/openai/internal/stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
22 changes: 1 addition & 21 deletions lib/openai/internal/type/base_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 2 additions & 14 deletions lib/openai/internal/type/base_stream.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions rbi/lib/openai/internal.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions rbi/lib/openai/internal/type/base_page.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions rbi/lib/openai/internal/type/base_stream.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions sig/openai/internal.rbs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module OpenAI
module Internal
OMIT: top
end
end