Skip to content

Commit 16ec2e3

Browse files
chore: simplify yard annotations by removing most @!parse directives
1 parent b5fba2e commit 16ec2e3

File tree

177 files changed

+530
-2362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

177 files changed

+530
-2362
lines changed

lib/openai/internal/type/request_parameters.rb

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ module RequestParameters
1212

1313
# @param mod [Module]
1414
def self.included(mod)
15-
return unless mod <= OpenAI::Internal::Type::BaseModel
15+
raise ArgumentError.new(mod) unless mod <= OpenAI::Internal::Type::BaseModel
1616

17-
mod.extend(OpenAI::Internal::Type::RequestParameters::Converter)
1817
mod.optional(:request_options, OpenAI::RequestOptions)
1918
end
2019

lib/openai/models/audio/speech_create_params.rb

+4-17
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ module Models
55
module Audio
66
# @see OpenAI::Resources::Audio::Speech#create
77
class SpeechCreateParams < OpenAI::Internal::Type::BaseModel
8-
# @!parse
9-
# extend OpenAI::Internal::Type::RequestParameters::Converter
8+
extend OpenAI::Internal::Type::RequestParameters::Converter
109
include OpenAI::Internal::Type::RequestParameters
1110

1211
# @!attribute input
@@ -31,39 +30,27 @@ class SpeechCreateParams < OpenAI::Internal::Type::BaseModel
3130
# @return [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice]
3231
required :voice, union: -> { OpenAI::Models::Audio::SpeechCreateParams::Voice }
3332

34-
# @!attribute [r] instructions
33+
# @!attribute instructions
3534
# Control the voice of your generated audio with additional instructions. Does not
3635
# work with `tts-1` or `tts-1-hd`.
3736
#
3837
# @return [String, nil]
3938
optional :instructions, String
4039

41-
# @!parse
42-
# # @return [String]
43-
# attr_writer :instructions
44-
45-
# @!attribute [r] response_format
40+
# @!attribute response_format
4641
# The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
4742
# `wav`, and `pcm`.
4843
#
4944
# @return [Symbol, OpenAI::Models::Audio::SpeechCreateParams::ResponseFormat, nil]
5045
optional :response_format, enum: -> { OpenAI::Models::Audio::SpeechCreateParams::ResponseFormat }
5146

52-
# @!parse
53-
# # @return [Symbol, OpenAI::Models::Audio::SpeechCreateParams::ResponseFormat]
54-
# attr_writer :response_format
55-
56-
# @!attribute [r] speed
47+
# @!attribute speed
5748
# The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
5849
# the default.
5950
#
6051
# @return [Float, nil]
6152
optional :speed, Float
6253

63-
# @!parse
64-
# # @return [Float]
65-
# attr_writer :speed
66-
6754
# @!method initialize(input:, model:, voice:, instructions: nil, response_format: nil, speed: nil, request_options: {})
6855
# @param input [String]
6956
# @param model [String, Symbol, OpenAI::Models::Audio::SpeechModel]

lib/openai/models/audio/transcription.rb

+4-20
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,14 @@ class Transcription < OpenAI::Internal::Type::BaseModel
1010
# @return [String]
1111
required :text, String
1212

13-
# @!attribute [r] logprobs
13+
# @!attribute logprobs
1414
# The log probabilities of the tokens in the transcription. Only returned with the
1515
# models `gpt-4o-transcribe` and `gpt-4o-mini-transcribe` if `logprobs` is added
1616
# to the `include` array.
1717
#
1818
# @return [Array<OpenAI::Models::Audio::Transcription::Logprob>, nil]
1919
optional :logprobs, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Models::Audio::Transcription::Logprob] }
2020

21-
# @!parse
22-
# # @return [Array<OpenAI::Models::Audio::Transcription::Logprob>]
23-
# attr_writer :logprobs
24-
2521
# @!method initialize(text:, logprobs: nil)
2622
# Represents a transcription response returned by model, based on the provided
2723
# input.
@@ -30,36 +26,24 @@ class Transcription < OpenAI::Internal::Type::BaseModel
3026
# @param logprobs [Array<OpenAI::Models::Audio::Transcription::Logprob>]
3127

3228
class Logprob < OpenAI::Internal::Type::BaseModel
33-
# @!attribute [r] token
29+
# @!attribute token
3430
# The token in the transcription.
3531
#
3632
# @return [String, nil]
3733
optional :token, String
3834

39-
# @!parse
40-
# # @return [String]
41-
# attr_writer :token
42-
43-
# @!attribute [r] bytes
35+
# @!attribute bytes
4436
# The bytes of the token.
4537
#
4638
# @return [Array<Float>, nil]
4739
optional :bytes, OpenAI::Internal::Type::ArrayOf[Float]
4840

49-
# @!parse
50-
# # @return [Array<Float>]
51-
# attr_writer :bytes
52-
53-
# @!attribute [r] logprob
41+
# @!attribute logprob
5442
# The log probability of the token.
5543
#
5644
# @return [Float, nil]
5745
optional :logprob, Float
5846

59-
# @!parse
60-
# # @return [Float]
61-
# attr_writer :logprob
62-
6347
# @!method initialize(token: nil, bytes: nil, logprob: nil)
6448
# @param token [String]
6549
# @param bytes [Array<Float>]

lib/openai/models/audio/transcription_create_params.rb

+7-32
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ module Audio
77
#
88
# @see OpenAI::Resources::Audio::Transcriptions#create_streaming
99
class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
10-
# @!parse
11-
# extend OpenAI::Internal::Type::RequestParameters::Converter
10+
extend OpenAI::Internal::Type::RequestParameters::Converter
1211
include OpenAI::Internal::Type::RequestParameters
1312

1413
# @!attribute file
@@ -26,7 +25,7 @@ class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
2625
# @return [String, Symbol, OpenAI::Models::AudioModel]
2726
required :model, union: -> { OpenAI::Models::Audio::TranscriptionCreateParams::Model }
2827

29-
# @!attribute [r] include
28+
# @!attribute include
3029
# Additional information to include in the transcription response. `logprobs` will
3130
# return the log probabilities of the tokens in the response to understand the
3231
# model's confidence in the transcription. `logprobs` only works with
@@ -37,23 +36,15 @@ class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
3736
optional :include,
3837
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Models::Audio::TranscriptionInclude] }
3938

40-
# @!parse
41-
# # @return [Array<Symbol, OpenAI::Models::Audio::TranscriptionInclude>]
42-
# attr_writer :include
43-
44-
# @!attribute [r] language
39+
# @!attribute language
4540
# The language of the input audio. Supplying the input language in
4641
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
4742
# format will improve accuracy and latency.
4843
#
4944
# @return [String, nil]
5045
optional :language, String
5146

52-
# @!parse
53-
# # @return [String]
54-
# attr_writer :language
55-
56-
# @!attribute [r] prompt
47+
# @!attribute prompt
5748
# An optional text to guide the model's style or continue a previous audio
5849
# segment. The
5950
# [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
@@ -62,23 +53,15 @@ class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
6253
# @return [String, nil]
6354
optional :prompt, String
6455

65-
# @!parse
66-
# # @return [String]
67-
# attr_writer :prompt
68-
69-
# @!attribute [r] response_format
56+
# @!attribute response_format
7057
# The format of the output, in one of these options: `json`, `text`, `srt`,
7158
# `verbose_json`, or `vtt`. For `gpt-4o-transcribe` and `gpt-4o-mini-transcribe`,
7259
# the only supported format is `json`.
7360
#
7461
# @return [Symbol, OpenAI::Models::AudioResponseFormat, nil]
7562
optional :response_format, enum: -> { OpenAI::Models::AudioResponseFormat }
7663

77-
# @!parse
78-
# # @return [Symbol, OpenAI::Models::AudioResponseFormat]
79-
# attr_writer :response_format
80-
81-
# @!attribute [r] temperature
64+
# @!attribute temperature
8265
# The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
8366
# output more random, while lower values like 0.2 will make it more focused and
8467
# deterministic. If set to 0, the model will use
@@ -88,11 +71,7 @@ class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
8871
# @return [Float, nil]
8972
optional :temperature, Float
9073

91-
# @!parse
92-
# # @return [Float]
93-
# attr_writer :temperature
94-
95-
# @!attribute [r] timestamp_granularities
74+
# @!attribute timestamp_granularities
9675
# The timestamp granularities to populate for this transcription.
9776
# `response_format` must be set `verbose_json` to use timestamp granularities.
9877
# Either or both of these options are supported: `word`, or `segment`. Note: There
@@ -103,10 +82,6 @@ class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
10382
optional :timestamp_granularities,
10483
-> { OpenAI::Internal::Type::ArrayOf[enum: OpenAI::Models::Audio::TranscriptionCreateParams::TimestampGranularity] }
10584

106-
# @!parse
107-
# # @return [Array<Symbol, OpenAI::Models::Audio::TranscriptionCreateParams::TimestampGranularity>]
108-
# attr_writer :timestamp_granularities
109-
11085
# @!method initialize(file:, model:, include: nil, language: nil, prompt: nil, response_format: nil, temperature: nil, timestamp_granularities: nil, request_options: {})
11186
# @param file [Pathname, StringIO]
11287
# @param model [String, Symbol, OpenAI::Models::AudioModel]

lib/openai/models/audio/transcription_text_delta_event.rb

+4-20
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TranscriptionTextDeltaEvent < OpenAI::Internal::Type::BaseModel
1616
# @return [Symbol, :"transcript.text.delta"]
1717
required :type, const: :"transcript.text.delta"
1818

19-
# @!attribute [r] logprobs
19+
# @!attribute logprobs
2020
# The log probabilities of the delta. Only included if you
2121
# [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
2222
# with the `include[]` parameter set to `logprobs`.
@@ -25,10 +25,6 @@ class TranscriptionTextDeltaEvent < OpenAI::Internal::Type::BaseModel
2525
optional :logprobs,
2626
-> { OpenAI::Internal::Type::ArrayOf[OpenAI::Models::Audio::TranscriptionTextDeltaEvent::Logprob] }
2727

28-
# @!parse
29-
# # @return [Array<OpenAI::Models::Audio::TranscriptionTextDeltaEvent::Logprob>]
30-
# attr_writer :logprobs
31-
3228
# @!method initialize(delta:, logprobs: nil, type: :"transcript.text.delta")
3329
# Emitted when there is an additional text delta. This is also the first event
3430
# emitted when the transcription starts. Only emitted when you
@@ -40,36 +36,24 @@ class TranscriptionTextDeltaEvent < OpenAI::Internal::Type::BaseModel
4036
# @param type [Symbol, :"transcript.text.delta"]
4137

4238
class Logprob < OpenAI::Internal::Type::BaseModel
43-
# @!attribute [r] token
39+
# @!attribute token
4440
# The token that was used to generate the log probability.
4541
#
4642
# @return [String, nil]
4743
optional :token, String
4844

49-
# @!parse
50-
# # @return [String]
51-
# attr_writer :token
52-
53-
# @!attribute [r] bytes
45+
# @!attribute bytes
5446
# The bytes that were used to generate the log probability.
5547
#
5648
# @return [Array<Object>, nil]
5749
optional :bytes, OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
5850

59-
# @!parse
60-
# # @return [Array<Object>]
61-
# attr_writer :bytes
62-
63-
# @!attribute [r] logprob
51+
# @!attribute logprob
6452
# The log probability of the token.
6553
#
6654
# @return [Float, nil]
6755
optional :logprob, Float
6856

69-
# @!parse
70-
# # @return [Float]
71-
# attr_writer :logprob
72-
7357
# @!method initialize(token: nil, bytes: nil, logprob: nil)
7458
# @param token [String]
7559
# @param bytes [Array<Object>]

lib/openai/models/audio/transcription_text_done_event.rb

+4-20
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TranscriptionTextDoneEvent < OpenAI::Internal::Type::BaseModel
1616
# @return [Symbol, :"transcript.text.done"]
1717
required :type, const: :"transcript.text.done"
1818

19-
# @!attribute [r] logprobs
19+
# @!attribute logprobs
2020
# The log probabilities of the individual tokens in the transcription. Only
2121
# included if you
2222
# [create a transcription](https://platform.openai.com/docs/api-reference/audio/create-transcription)
@@ -26,10 +26,6 @@ class TranscriptionTextDoneEvent < OpenAI::Internal::Type::BaseModel
2626
optional :logprobs,
2727
-> { OpenAI::Internal::Type::ArrayOf[OpenAI::Models::Audio::TranscriptionTextDoneEvent::Logprob] }
2828

29-
# @!parse
30-
# # @return [Array<OpenAI::Models::Audio::TranscriptionTextDoneEvent::Logprob>]
31-
# attr_writer :logprobs
32-
3329
# @!method initialize(text:, logprobs: nil, type: :"transcript.text.done")
3430
# Emitted when the transcription is complete. Contains the complete transcription
3531
# text. Only emitted when you
@@ -41,36 +37,24 @@ class TranscriptionTextDoneEvent < OpenAI::Internal::Type::BaseModel
4137
# @param type [Symbol, :"transcript.text.done"]
4238

4339
class Logprob < OpenAI::Internal::Type::BaseModel
44-
# @!attribute [r] token
40+
# @!attribute token
4541
# The token that was used to generate the log probability.
4642
#
4743
# @return [String, nil]
4844
optional :token, String
4945

50-
# @!parse
51-
# # @return [String]
52-
# attr_writer :token
53-
54-
# @!attribute [r] bytes
46+
# @!attribute bytes
5547
# The bytes that were used to generate the log probability.
5648
#
5749
# @return [Array<Object>, nil]
5850
optional :bytes, OpenAI::Internal::Type::ArrayOf[OpenAI::Internal::Type::Unknown]
5951

60-
# @!parse
61-
# # @return [Array<Object>]
62-
# attr_writer :bytes
63-
64-
# @!attribute [r] logprob
52+
# @!attribute logprob
6553
# The log probability of the token.
6654
#
6755
# @return [Float, nil]
6856
optional :logprob, Float
6957

70-
# @!parse
71-
# # @return [Float]
72-
# attr_writer :logprob
73-
7458
# @!method initialize(token: nil, bytes: nil, logprob: nil)
7559
# @param token [String]
7660
# @param bytes [Array<Object>]

lib/openai/models/audio/transcription_verbose.rb

+2-10
Original file line numberDiff line numberDiff line change
@@ -22,26 +22,18 @@ class TranscriptionVerbose < OpenAI::Internal::Type::BaseModel
2222
# @return [String]
2323
required :text, String
2424

25-
# @!attribute [r] segments
25+
# @!attribute segments
2626
# Segments of the transcribed text and their corresponding details.
2727
#
2828
# @return [Array<OpenAI::Models::Audio::TranscriptionSegment>, nil]
2929
optional :segments, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Models::Audio::TranscriptionSegment] }
3030

31-
# @!parse
32-
# # @return [Array<OpenAI::Models::Audio::TranscriptionSegment>]
33-
# attr_writer :segments
34-
35-
# @!attribute [r] words
31+
# @!attribute words
3632
# Extracted words and their corresponding timestamps.
3733
#
3834
# @return [Array<OpenAI::Models::Audio::TranscriptionWord>, nil]
3935
optional :words, -> { OpenAI::Internal::Type::ArrayOf[OpenAI::Models::Audio::TranscriptionWord] }
4036

41-
# @!parse
42-
# # @return [Array<OpenAI::Models::Audio::TranscriptionWord>]
43-
# attr_writer :words
44-
4537
# @!method initialize(duration:, language:, text:, segments: nil, words: nil)
4638
# Represents a verbose json transcription response returned by model, based on the
4739
# provided input.

0 commit comments

Comments
 (0)