Skip to content

Commit c2518ef

Browse files
feat!: bump min supported ruby version to 3.1 (oldest non-EOL) (#93)
1 parent 074bf15 commit c2518ef

File tree

10 files changed

+10
-72
lines changed

10 files changed

+10
-72
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenAI Ruby API library
22

3-
The OpenAI Ruby library provides convenient access to the OpenAI REST API from any Ruby 3.0.0+ application.
3+
The OpenAI Ruby library provides convenient access to the OpenAI REST API from any Ruby 3.1.0+ application.
44

55
## Documentation
66

@@ -202,4 +202,4 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
202202

203203
## Requirements
204204

205-
Ruby 3.0.0 or higher.
205+
Ruby 3.1.0 or higher.

lib/openai/internal/cursor_page.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ module Internal
1111
# cursor_page.auto_paging_each do |completion|
1212
# puts(completion)
1313
# end
14-
#
15-
# @example
16-
# completions =
17-
# cursor_page
18-
# .to_enum
19-
# .lazy
20-
# .select { _1.object_id.even? }
21-
# .map(&:itself)
22-
# .take(2)
23-
# .to_a
24-
#
25-
# completions => Array
2614
class CursorPage
2715
include OpenAI::Internal::Type::BasePage
2816

lib/openai/internal/page.rb

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,6 @@ module Internal
1111
# page.auto_paging_each do |model|
1212
# puts(model)
1313
# end
14-
#
15-
# @example
16-
# models =
17-
# page
18-
# .to_enum
19-
# .lazy
20-
# .select { _1.object_id.even? }
21-
# .map(&:itself)
22-
# .take(2)
23-
# .to_a
24-
#
25-
# models => Array
2614
class Page
2715
include OpenAI::Internal::Type::BasePage
2816

lib/openai/internal/stream.rb

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@ module Internal
66
# stream.each do |event|
77
# puts(event)
88
# end
9-
#
10-
# @example
11-
# events =
12-
# stream
13-
# .lazy
14-
# .select { _1.object_id.even? }
15-
# .map(&:itself)
16-
# .take(2)
17-
# .to_a
18-
#
19-
# events => Array
209
class Stream
2110
include OpenAI::Internal::Type::BaseStream
2211

lib/openai/internal/type/base_page.rb

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,7 @@
33
module OpenAI
44
module Internal
55
module Type
6-
# @example
7-
# if page.has_next?
8-
# page = page.next_page
9-
# end
10-
#
11-
# @example
12-
# page.auto_paging_each do |completion|
13-
# puts(completion)
14-
# end
15-
#
16-
# @example
17-
# completions =
18-
# page
19-
# .to_enum
20-
# .lazy
21-
# .select { _1.object_id.even? }
22-
# .map(&:itself)
23-
# .take(2)
24-
# .to_a
25-
#
26-
# completions => Array
6+
# This module provides a base implementation for paginated responses in the SDK.
277
module BasePage
288
# rubocop:disable Lint/UnusedMethodArgument
299

lib/openai/internal/type/base_stream.rb

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,9 @@
33
module OpenAI
44
module Internal
55
module Type
6-
# @example
7-
# stream.each do |chunk|
8-
# puts(chunk)
9-
# end
6+
# This module provides a base implementation for streaming responses in the SDK.
107
#
11-
# @example
12-
# chunks =
13-
# stream
14-
# .lazy
15-
# .select { _1.object_id.even? }
16-
# .map(&:itself)
17-
# .take(2)
18-
# .to_a
19-
#
20-
# chunks => Array
8+
# @see https://rubyapi.org/3.1/o/enumerable
219
module BaseStream
2210
include Enumerable
2311

rbi/lib/openai/internal.rbi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ module OpenAI
66
# Due to the current WIP status of Shapes support in Sorbet, types referencing
77
# this alias might be refined in the future.
88
AnyHash = T.type_alias { T::Hash[Symbol, T.anything] }
9+
10+
OMIT = T.let(T.anything, T.anything)
911
end
1012
end

rbi/lib/openai/internal/type/base_page.rbi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module OpenAI
44
module Internal
55
module Type
6+
# This module provides a base implementation for paginated responses in the SDK.
67
module BasePage
78
Elem = type_member(:out)
89

rbi/lib/openai/internal/type/base_stream.rbi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module OpenAI
44
module Internal
55
module Type
6+
# This module provides a base implementation for streaming responses in the SDK.
67
module BaseStream
78
include Enumerable
89

sig/openai/internal.rbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
module OpenAI
22
module Internal
3+
OMIT: top
34
end
45
end

0 commit comments

Comments
 (0)