File tree Expand file tree Collapse file tree 10 files changed +10
-72
lines changed Expand file tree Collapse file tree 10 files changed +10
-72
lines changed Original file line number Diff line number Diff line change 1
1
# OpenAI Ruby API library
2
2
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.
4
4
5
5
## Documentation
6
6
@@ -202,4 +202,4 @@ This package considers improvements to the (non-runtime) `*.rbi` and `*.rbs` typ
202
202
203
203
## Requirements
204
204
205
- Ruby 3.0 .0 or higher.
205
+ Ruby 3.1 .0 or higher.
Original file line number Diff line number Diff line change @@ -11,18 +11,6 @@ module Internal
11
11
# cursor_page.auto_paging_each do |completion|
12
12
# puts(completion)
13
13
# 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
26
14
class CursorPage
27
15
include OpenAI ::Internal ::Type ::BasePage
28
16
Original file line number Diff line number Diff line change @@ -11,18 +11,6 @@ module Internal
11
11
# page.auto_paging_each do |model|
12
12
# puts(model)
13
13
# 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
26
14
class Page
27
15
include OpenAI ::Internal ::Type ::BasePage
28
16
Original file line number Diff line number Diff line change @@ -6,17 +6,6 @@ module Internal
6
6
# stream.each do |event|
7
7
# puts(event)
8
8
# 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
20
9
class Stream
21
10
include OpenAI ::Internal ::Type ::BaseStream
22
11
Original file line number Diff line number Diff line change 3
3
module OpenAI
4
4
module Internal
5
5
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.
27
7
module BasePage
28
8
# rubocop:disable Lint/UnusedMethodArgument
29
9
Original file line number Diff line number Diff line change 3
3
module OpenAI
4
4
module Internal
5
5
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.
10
7
#
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
21
9
module BaseStream
22
10
include Enumerable
23
11
Original file line number Diff line number Diff line change @@ -6,5 +6,7 @@ module OpenAI
6
6
# Due to the current WIP status of Shapes support in Sorbet, types referencing
7
7
# this alias might be refined in the future.
8
8
AnyHash = T . type_alias { T ::Hash [ Symbol , T . anything ] }
9
+
10
+ OMIT = T . let ( T . anything , T . anything )
9
11
end
10
12
end
Original file line number Diff line number Diff line change 3
3
module OpenAI
4
4
module Internal
5
5
module Type
6
+ # This module provides a base implementation for paginated responses in the SDK.
6
7
module BasePage
7
8
Elem = type_member ( :out )
8
9
Original file line number Diff line number Diff line change 3
3
module OpenAI
4
4
module Internal
5
5
module Type
6
+ # This module provides a base implementation for streaming responses in the SDK.
6
7
module BaseStream
7
8
include Enumerable
8
9
Original file line number Diff line number Diff line change 1
1
module OpenAI
2
2
module Internal
3
+ OMIT: top
3
4
end
4
5
end
You can’t perform that action at this time.
0 commit comments