Skip to content

Commit ffd2b95

Browse files
fix: yard example tag formatting (#53)
1 parent 9973da2 commit ffd2b95

File tree

10 files changed

+121
-157
lines changed

10 files changed

+121
-157
lines changed

lib/openai/base_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ def initialize(
220220
#
221221
# @option opts [Hash{String=>String, nil}, nil] :extra_headers
222222
#
223-
# @option opts [Hash{Symbol=>Object}, nil] :extra_body
223+
# @option opts [Object, nil] :extra_body
224224
#
225225
# @option opts [Integer, nil] :max_retries
226226
#

lib/openai/base_model.rb

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -288,33 +288,29 @@ def try_strict_coerce(value)
288288
# values safely.
289289
#
290290
# @example
291-
# ```ruby
292-
# # `chat_model` is a `OpenAI::Models::ChatModel`
293-
# case chat_model
294-
# when OpenAI::Models::ChatModel::O3_MINI
295-
# # ...
296-
# when OpenAI::Models::ChatModel::O3_MINI_2025_01_31
297-
# # ...
298-
# when OpenAI::Models::ChatModel::O1
299-
# # ...
300-
# else
301-
# puts(chat_model)
302-
# end
303-
# ```
291+
# # `chat_model` is a `OpenAI::Models::ChatModel`
292+
# case chat_model
293+
# when OpenAI::Models::ChatModel::O3_MINI
294+
# # ...
295+
# when OpenAI::Models::ChatModel::O3_MINI_2025_01_31
296+
# # ...
297+
# when OpenAI::Models::ChatModel::O1
298+
# # ...
299+
# else
300+
# puts(chat_model)
301+
# end
304302
#
305303
# @example
306-
# ```ruby
307-
# case chat_model
308-
# in :"o3-mini"
309-
# # ...
310-
# in :"o3-mini-2025-01-31"
311-
# # ...
312-
# in :o1
313-
# # ...
314-
# else
315-
# puts(chat_model)
316-
# end
317-
# ```
304+
# case chat_model
305+
# in :"o3-mini"
306+
# # ...
307+
# in :"o3-mini-2025-01-31"
308+
# # ...
309+
# in :o1
310+
# # ...
311+
# else
312+
# puts(chat_model)
313+
# end
318314
module Enum
319315
include OpenAI::Converter
320316

@@ -387,33 +383,29 @@ def try_strict_coerce(value)
387383
# @api private
388384
#
389385
# @example
390-
# ```ruby
391-
# # `chat_completion_content_part` is a `OpenAI::Models::Chat::ChatCompletionContentPart`
392-
# case chat_completion_content_part
393-
# when OpenAI::Models::Chat::ChatCompletionContentPartText
394-
# puts(chat_completion_content_part.text)
395-
# when OpenAI::Models::Chat::ChatCompletionContentPartImage
396-
# puts(chat_completion_content_part.image_url)
397-
# when OpenAI::Models::Chat::ChatCompletionContentPartInputAudio
398-
# puts(chat_completion_content_part.input_audio)
399-
# else
400-
# puts(chat_completion_content_part)
401-
# end
402-
# ```
386+
# # `chat_completion_content_part` is a `OpenAI::Models::Chat::ChatCompletionContentPart`
387+
# case chat_completion_content_part
388+
# when OpenAI::Models::Chat::ChatCompletionContentPartText
389+
# puts(chat_completion_content_part.text)
390+
# when OpenAI::Models::Chat::ChatCompletionContentPartImage
391+
# puts(chat_completion_content_part.image_url)
392+
# when OpenAI::Models::Chat::ChatCompletionContentPartInputAudio
393+
# puts(chat_completion_content_part.input_audio)
394+
# else
395+
# puts(chat_completion_content_part)
396+
# end
403397
#
404398
# @example
405-
# ```ruby
406-
# case chat_completion_content_part
407-
# in {type: :text, text: text}
408-
# puts(text)
409-
# in {type: :image_url, image_url: image_url}
410-
# puts(image_url)
411-
# in {type: :input_audio, input_audio: input_audio}
412-
# puts(input_audio)
413-
# else
414-
# puts(chat_completion_content_part)
415-
# end
416-
# ```
399+
# case chat_completion_content_part
400+
# in {type: :text, text: text}
401+
# puts(text)
402+
# in {type: :image_url, image_url: image_url}
403+
# puts(image_url)
404+
# in {type: :input_audio, input_audio: input_audio}
405+
# puts(input_audio)
406+
# else
407+
# puts(chat_completion_content_part)
408+
# end
417409
module Union
418410
include OpenAI::Converter
419411

@@ -878,14 +870,12 @@ def initialize(type_info, spec = {})
878870
# @abstract
879871
#
880872
# @example
881-
# ```ruby
882-
# # `comparison_filter` is a `OpenAI::Models::ComparisonFilter`
883-
# comparison_filter => {
884-
# key: key,
885-
# type: type,
886-
# value: value
887-
# }
888-
# ```
873+
# # `comparison_filter` is a `OpenAI::Models::ComparisonFilter`
874+
# comparison_filter => {
875+
# key: key,
876+
# type: type,
877+
# value: value
878+
# }
889879
class BaseModel
890880
extend OpenAI::Converter
891881

lib/openai/base_page.rb

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@
22

33
module OpenAI
44
# @example
5-
# ```ruby
6-
# if page.has_next?
7-
# page = page.next_page
8-
# end
9-
# ```
5+
# if page.has_next?
6+
# page = page.next_page
7+
# end
108
#
119
# @example
12-
# ```ruby
13-
# page.auto_paging_each do |completion|
14-
# puts(completion)
15-
# end
16-
# ```
10+
# page.auto_paging_each do |completion|
11+
# puts(completion)
12+
# end
1713
#
1814
# @example
19-
# ```ruby
20-
# completions =
21-
# page
22-
# .to_enum
23-
# .lazy
24-
# .select { _1.object_id.even? }
25-
# .map(&:itself)
26-
# .take(2)
27-
# .to_a
15+
# completions =
16+
# page
17+
# .to_enum
18+
# .lazy
19+
# .select { _1.object_id.even? }
20+
# .map(&:itself)
21+
# .take(2)
22+
# .to_a
2823
#
29-
# completions => Array
30-
# ```
24+
# completions => Array
3125
module BasePage
3226
# rubocop:disable Lint/UnusedMethodArgument
3327

lib/openai/base_stream.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,20 @@
22

33
module OpenAI
44
# @example
5-
# ```ruby
6-
# stream.each do |chunk|
7-
# puts(chunk)
8-
# end
9-
# ```
5+
# stream.each do |chunk|
6+
# puts(chunk)
7+
# end
108
#
119
# @example
12-
# ```ruby
13-
# chunks =
14-
# stream
15-
# .lazy
16-
# .select { _1.object_id.even? }
17-
# .map(&:itself)
18-
# .take(2)
19-
# .to_a
10+
# chunks =
11+
# stream
12+
# .lazy
13+
# .select { _1.object_id.even? }
14+
# .map(&:itself)
15+
# .take(2)
16+
# .to_a
2017
#
21-
# chunks => Array
22-
# ```
18+
# chunks => Array
2319
module BaseStream
2420
include Enumerable
2521

lib/openai/cursor_page.rb

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@
22

33
module OpenAI
44
# @example
5-
# ```ruby
6-
# if cursor_page.has_next?
7-
# cursor_page = cursor_page.next_page
8-
# end
9-
# ```
5+
# if cursor_page.has_next?
6+
# cursor_page = cursor_page.next_page
7+
# end
108
#
119
# @example
12-
# ```ruby
13-
# cursor_page.auto_paging_each do |completion|
14-
# puts(completion)
15-
# end
16-
# ```
10+
# cursor_page.auto_paging_each do |completion|
11+
# puts(completion)
12+
# end
1713
#
1814
# @example
19-
# ```ruby
20-
# completions =
21-
# cursor_page
22-
# .to_enum
23-
# .lazy
24-
# .select { _1.object_id.even? }
25-
# .map(&:itself)
26-
# .take(2)
27-
# .to_a
15+
# completions =
16+
# cursor_page
17+
# .to_enum
18+
# .lazy
19+
# .select { _1.object_id.even? }
20+
# .map(&:itself)
21+
# .take(2)
22+
# .to_a
2823
#
29-
# completions => Array
30-
# ```
24+
# completions => Array
3125
class CursorPage
3226
include OpenAI::BasePage
3327

lib/openai/page.rb

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,26 @@
22

33
module OpenAI
44
# @example
5-
# ```ruby
6-
# if page.has_next?
7-
# page = page.next_page
8-
# end
9-
# ```
5+
# if page.has_next?
6+
# page = page.next_page
7+
# end
108
#
119
# @example
12-
# ```ruby
13-
# page.auto_paging_each do |model|
14-
# puts(model)
15-
# end
16-
# ```
10+
# page.auto_paging_each do |model|
11+
# puts(model)
12+
# end
1713
#
1814
# @example
19-
# ```ruby
20-
# models =
21-
# page
22-
# .to_enum
23-
# .lazy
24-
# .select { _1.object_id.even? }
25-
# .map(&:itself)
26-
# .take(2)
27-
# .to_a
15+
# models =
16+
# page
17+
# .to_enum
18+
# .lazy
19+
# .select { _1.object_id.even? }
20+
# .map(&:itself)
21+
# .take(2)
22+
# .to_a
2823
#
29-
# models => Array
30-
# ```
24+
# models => Array
3125
class Page
3226
include OpenAI::BasePage
3327

lib/openai/request_options.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def self.validate!(opts)
8383
# Extra data to send with the request. These are deep merged into any data
8484
# generated as part of the normal request.
8585
#
86-
# @return [Hash{Symbol=>Object}, nil]
86+
# @return [Object, nil]
8787
optional :extra_body, OpenAI::HashOf[OpenAI::Unknown]
8888

8989
# @!attribute max_retries

lib/openai/stream.rb

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,20 @@
22

33
module OpenAI
44
# @example
5-
# ```ruby
6-
# stream.each do |event|
7-
# puts(event)
8-
# end
9-
# ```
5+
# stream.each do |event|
6+
# puts(event)
7+
# end
108
#
119
# @example
12-
# ```ruby
13-
# events =
14-
# stream
15-
# .lazy
16-
# .select { _1.object_id.even? }
17-
# .map(&:itself)
18-
# .take(2)
19-
# .to_a
10+
# events =
11+
# stream
12+
# .lazy
13+
# .select { _1.object_id.even? }
14+
# .map(&:itself)
15+
# .take(2)
16+
# .to_a
2017
#
21-
# events => Array
22-
# ```
18+
# events => Array
2319
class Stream
2420
include OpenAI::BaseStream
2521

rbi/lib/openai/request_options.rbi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ module OpenAI
7373

7474
# Extra data to send with the request. These are deep merged into any data
7575
# generated as part of the normal request.
76-
sig { returns(T.nilable(T::Hash[Symbol, T.anything])) }
76+
sig { returns(T.nilable(T.anything)) }
7777
def extra_body
7878
end
7979

80-
sig { params(_: T.nilable(T::Hash[Symbol, T.anything])).returns(T.nilable(T::Hash[Symbol, T.anything])) }
80+
sig { params(_: T.nilable(T.anything)).returns(T.nilable(T.anything)) }
8181
def extra_body=(_)
8282
end
8383

sig/openai/request_options.rbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module OpenAI
1717
idempotency_key: String?,
1818
extra_query: ::Hash[String, (::Array[String] | String)?]?,
1919
extra_headers: ::Hash[String, String?]?,
20-
extra_body: ::Hash[Symbol, top]?,
20+
extra_body: top?,
2121
max_retries: Integer?,
2222
timeout: Float?
2323
}
@@ -31,7 +31,7 @@ module OpenAI
3131

3232
attr_accessor extra_headers: ::Hash[String, String?]?
3333

34-
attr_accessor extra_body: ::Hash[Symbol, top]?
34+
attr_accessor extra_body: top?
3535

3636
attr_accessor max_retries: Integer?
3737

0 commit comments

Comments
 (0)