Skip to content

Commit c5d50db

Browse files
chore: use @!method instead of @!parse for virtual method type definitions
1 parent 3fb0e0f commit c5d50db

File tree

367 files changed

+4185
-7968
lines changed

Some content is hidden

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

367 files changed

+4185
-7968
lines changed

.yardopts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
--type-name-tag generic:Generic
12
--markup markdown
23
--markup-provider redcarpet
34
--exclude /rbi

lib/openai/internal/type/base_model.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,8 @@ def deconstruct_keys(keys)
339339
end
340340

341341
class << self
342+
# @api private
343+
#
342344
# @param model [OpenAI::Internal::Type::BaseModel]
343345
#
344346
# @return [Hash{Symbol=>Object}]

lib/openai/internal/type/enum.rb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,7 @@ module Enum
4646
# All of the valid Symbol values for this enum.
4747
#
4848
# @return [Array<NilClass, Boolean, Integer, Float, Symbol>]
49-
def values = (@values ||= constants.map { const_get(_1) })
50-
51-
# @api private
52-
#
53-
# Guard against thread safety issues by instantiating `@values`.
54-
private def finalize! = values
49+
def values = constants.map { const_get(_1) }
5550

5651
# @param other [Object]
5752
#

lib/openai/models/all_models.rb

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ module ResponsesOnlyModel
1919
COMPUTER_USE_PREVIEW = :"computer-use-preview"
2020
COMPUTER_USE_PREVIEW_2025_03_11 = :"computer-use-preview-2025-03-11"
2121

22-
finalize!
23-
24-
# @!parse
25-
# # @return [Array<Symbol>]
26-
# def self.values; end
22+
# @!method self.values
23+
# @return [Array<Symbol>]
2724
end
2825

29-
# @!parse
30-
# # @return [Array(String, Symbol, OpenAI::Models::ChatModel, Symbol, OpenAI::Models::AllModels::ResponsesOnlyModel)]
31-
# def self.variants; end
26+
# @!method self.variants
27+
# @return [Array(String, Symbol, OpenAI::Models::ChatModel, Symbol, OpenAI::Models::AllModels::ResponsesOnlyModel)]
3228
end
3329
end
3430
end

lib/openai/models/audio/speech_create_params.rb

Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,14 @@ class SpeechCreateParams < OpenAI::Internal::Type::BaseModel
6464
# # @return [Float]
6565
# attr_writer :speed
6666

67-
# @!parse
68-
# # @param input [String]
69-
# # @param model [String, Symbol, OpenAI::Models::Audio::SpeechModel]
70-
# # @param voice [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice]
71-
# # @param instructions [String]
72-
# # @param response_format [Symbol, OpenAI::Models::Audio::SpeechCreateParams::ResponseFormat]
73-
# # @param speed [Float]
74-
# # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
75-
# #
76-
# def initialize(input:, model:, voice:, instructions: nil, response_format: nil, speed: nil, request_options: {}, **) = super
77-
78-
# def initialize: (Hash | OpenAI::Internal::Type::BaseModel) -> void
67+
# @!method initialize(input:, model:, voice:, instructions: nil, response_format: nil, speed: nil, request_options: {})
68+
# @param input [String]
69+
# @param model [String, Symbol, OpenAI::Models::Audio::SpeechModel]
70+
# @param voice [String, Symbol, OpenAI::Models::Audio::SpeechCreateParams::Voice]
71+
# @param instructions [String]
72+
# @param response_format [Symbol, OpenAI::Models::Audio::SpeechCreateParams::ResponseFormat]
73+
# @param speed [Float]
74+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
7975

8076
# One of the available [TTS models](https://platform.openai.com/docs/models#tts):
8177
# `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.
@@ -87,9 +83,8 @@ module Model
8783
# One of the available [TTS models](https://platform.openai.com/docs/models#tts): `tts-1`, `tts-1-hd` or `gpt-4o-mini-tts`.
8884
variant enum: -> { OpenAI::Models::Audio::SpeechModel }
8985

90-
# @!parse
91-
# # @return [Array(String, Symbol, OpenAI::Models::Audio::SpeechModel)]
92-
# def self.variants; end
86+
# @!method self.variants
87+
# @return [Array(String, Symbol, OpenAI::Models::Audio::SpeechModel)]
9388
end
9489

9590
# The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
@@ -123,9 +118,8 @@ module Voice
123118

124119
variant const: -> { OpenAI::Models::Audio::SpeechCreateParams::Voice::VERSE }
125120

126-
# @!parse
127-
# # @return [Array(String, Symbol)]
128-
# def self.variants; end
121+
# @!method self.variants
122+
# @return [Array(String, Symbol)]
129123

130124
# @!group
131125

@@ -156,11 +150,8 @@ module ResponseFormat
156150
WAV = :wav
157151
PCM = :pcm
158152

159-
finalize!
160-
161-
# @!parse
162-
# # @return [Array<Symbol>]
163-
# def self.values; end
153+
# @!method self.values
154+
# @return [Array<Symbol>]
164155
end
165156
end
166157
end

lib/openai/models/audio/speech_model.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,8 @@ module SpeechModel
1010
TTS_1_HD = :"tts-1-hd"
1111
GPT_4O_MINI_TTS = :"gpt-4o-mini-tts"
1212

13-
finalize!
14-
15-
# @!parse
16-
# # @return [Array<Symbol>]
17-
# def self.values; end
13+
# @!method self.values
14+
# @return [Array<Symbol>]
1815
end
1916
end
2017
end

lib/openai/models/audio/transcription.rb

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,12 @@ class Transcription < OpenAI::Internal::Type::BaseModel
2222
# # @return [Array<OpenAI::Models::Audio::Transcription::Logprob>]
2323
# attr_writer :logprobs
2424

25-
# @!parse
26-
# # Represents a transcription response returned by model, based on the provided
27-
# # input.
28-
# #
29-
# # @param text [String]
30-
# # @param logprobs [Array<OpenAI::Models::Audio::Transcription::Logprob>]
31-
# #
32-
# def initialize(text:, logprobs: nil, **) = super
33-
34-
# def initialize: (Hash | OpenAI::Internal::Type::BaseModel) -> void
25+
# @!method initialize(text:, logprobs: nil)
26+
# Represents a transcription response returned by model, based on the provided
27+
# input.
28+
#
29+
# @param text [String]
30+
# @param logprobs [Array<OpenAI::Models::Audio::Transcription::Logprob>]
3531

3632
class Logprob < OpenAI::Internal::Type::BaseModel
3733
# @!attribute [r] token
@@ -64,14 +60,10 @@ class Logprob < OpenAI::Internal::Type::BaseModel
6460
# # @return [Float]
6561
# attr_writer :logprob
6662

67-
# @!parse
68-
# # @param token [String]
69-
# # @param bytes [Array<Float>]
70-
# # @param logprob [Float]
71-
# #
72-
# def initialize(token: nil, bytes: nil, logprob: nil, **) = super
73-
74-
# def initialize: (Hash | OpenAI::Internal::Type::BaseModel) -> void
63+
# @!method initialize(token: nil, bytes: nil, logprob: nil)
64+
# @param token [String]
65+
# @param bytes [Array<Float>]
66+
# @param logprob [Float]
7567
end
7668
end
7769
end

lib/openai/models/audio/transcription_create_params.rb

Lines changed: 14 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -107,33 +107,16 @@ class TranscriptionCreateParams < OpenAI::Internal::Type::BaseModel
107107
# # @return [Array<Symbol, OpenAI::Models::Audio::TranscriptionCreateParams::TimestampGranularity>]
108108
# attr_writer :timestamp_granularities
109109

110-
# @!parse
111-
# # @param file [Pathname, StringIO]
112-
# # @param model [String, Symbol, OpenAI::Models::AudioModel]
113-
# # @param include [Array<Symbol, OpenAI::Models::Audio::TranscriptionInclude>]
114-
# # @param language [String]
115-
# # @param prompt [String]
116-
# # @param response_format [Symbol, OpenAI::Models::AudioResponseFormat]
117-
# # @param temperature [Float]
118-
# # @param timestamp_granularities [Array<Symbol, OpenAI::Models::Audio::TranscriptionCreateParams::TimestampGranularity>]
119-
# # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
120-
# #
121-
# def initialize(
122-
# file:,
123-
# model:,
124-
# include: nil,
125-
# language: nil,
126-
# prompt: nil,
127-
# response_format: nil,
128-
# temperature: nil,
129-
# timestamp_granularities: nil,
130-
# request_options: {},
131-
# **
132-
# )
133-
# super
134-
# end
135-
136-
# def initialize: (Hash | OpenAI::Internal::Type::BaseModel) -> void
110+
# @!method initialize(file:, model:, include: nil, language: nil, prompt: nil, response_format: nil, temperature: nil, timestamp_granularities: nil, request_options: {})
111+
# @param file [Pathname, StringIO]
112+
# @param model [String, Symbol, OpenAI::Models::AudioModel]
113+
# @param include [Array<Symbol, OpenAI::Models::Audio::TranscriptionInclude>]
114+
# @param language [String]
115+
# @param prompt [String]
116+
# @param response_format [Symbol, OpenAI::Models::AudioResponseFormat]
117+
# @param temperature [Float]
118+
# @param timestamp_granularities [Array<Symbol, OpenAI::Models::Audio::TranscriptionCreateParams::TimestampGranularity>]
119+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
137120

138121
# ID of the model to use. The options are `gpt-4o-transcribe`,
139122
# `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source
@@ -146,9 +129,8 @@ module Model
146129
# ID of the model to use. The options are `gpt-4o-transcribe`, `gpt-4o-mini-transcribe`, and `whisper-1` (which is powered by our open source Whisper V2 model).
147130
variant enum: -> { OpenAI::Models::AudioModel }
148131

149-
# @!parse
150-
# # @return [Array(String, Symbol, OpenAI::Models::AudioModel)]
151-
# def self.variants; end
132+
# @!method self.variants
133+
# @return [Array(String, Symbol, OpenAI::Models::AudioModel)]
152134
end
153135

154136
module TimestampGranularity
@@ -157,11 +139,8 @@ module TimestampGranularity
157139
WORD = :word
158140
SEGMENT = :segment
159141

160-
finalize!
161-
162-
# @!parse
163-
# # @return [Array<Symbol>]
164-
# def self.values; end
142+
# @!method self.values
143+
# @return [Array<Symbol>]
165144
end
166145
end
167146
end

lib/openai/models/audio/transcription_create_response.rb

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ module TranscriptionCreateResponse
1818
# Represents a verbose json transcription response returned by model, based on the provided input.
1919
variant -> { OpenAI::Models::Audio::TranscriptionVerbose }
2020

21-
# @!parse
22-
# # @return [Array(OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose)]
23-
# def self.variants; end
21+
# @!method self.variants
22+
# @return [Array(OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose)]
2423
end
2524
end
2625
end

lib/openai/models/audio/transcription_include.rb

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,8 @@ module TranscriptionInclude
88

99
LOGPROBS = :logprobs
1010

11-
finalize!
12-
13-
# @!parse
14-
# # @return [Array<Symbol>]
15-
# def self.values; end
11+
# @!method self.values
12+
# @return [Array<Symbol>]
1613
end
1714
end
1815
end

0 commit comments

Comments
 (0)