Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions rbi/lib/openai/base_model.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,11 @@ module OpenAI

abstract!

Value = type_template(:out)

class << self
# All of the valid Symbol values for this enum.
sig { overridable.returns(T::Array[T.any(NilClass, T::Boolean, Integer, Float, Symbol)]) }
sig { overridable.returns(T::Array[Value]) }
def values
end

Expand Down Expand Up @@ -220,6 +222,8 @@ module OpenAI

abstract!

Variants = type_template(:out)

class << self
# @api private
#
Expand All @@ -229,12 +233,12 @@ module OpenAI
end

# @api private
sig { returns(T::Array[[T.nilable(Symbol), T.anything]]) }
sig { returns(T::Array[[T.nilable(Symbol), Variants]]) }
protected def derefed_variants
end

# All of the specified variants for this union.
sig { overridable.returns(T::Array[T.anything]) }
sig { overridable.returns(T::Array[Variants]) }
def variants
end

Expand Down Expand Up @@ -306,6 +310,8 @@ module OpenAI
abstract!
final!

Elem = type_member(:out)

sig(:final) { params(other: T.anything).returns(T::Boolean) }
def ===(other)
end
Expand Down Expand Up @@ -342,7 +348,7 @@ module OpenAI
end

# @api private
sig(:final) { returns(OpenAI::Converter::Input) }
sig(:final) { returns(Elem) }
protected def item_type
end

Expand All @@ -369,6 +375,8 @@ module OpenAI
abstract!
final!

Elem = type_member(:out)

sig(:final) { params(other: T.anything).returns(T::Boolean) }
def ===(other)
end
Expand Down Expand Up @@ -405,7 +413,7 @@ module OpenAI
end

# @api private
sig(:final) { returns(OpenAI::Converter::Input) }
sig(:final) { returns(Elem) }
protected def item_type
end

Expand Down
22 changes: 5 additions & 17 deletions rbi/lib/openai/models/audio/speech_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,7 @@ module OpenAI
class Model < OpenAI::Union
abstract!

class << self
sig { override.returns([String, Symbol]) }
def variants
end
end
Variants = type_template(:out) { {fixed: T.any(String, Symbol)} }
end

# The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
Expand All @@ -107,6 +103,8 @@ module OpenAI
class Voice < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

ALLOY = :alloy
ASH = :ash
CORAL = :coral
Expand All @@ -116,31 +114,21 @@ module OpenAI
NOVA = :nova
SAGE = :sage
SHIMMER = :shimmer

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end

# The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
# `wav`, and `pcm`.
class ResponseFormat < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

MP3 = :mp3
OPUS = :opus
AAC = :aac
FLAC = :flac
WAV = :wav
PCM = :pcm

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end
end
end
Expand Down
8 changes: 2 additions & 6 deletions rbi/lib/openai/models/audio/speech_model.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ module OpenAI
class SpeechModel < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

TTS_1 = :"tts-1"
TTS_1_HD = :"tts-1-hd"

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end
end
end
Expand Down
14 changes: 3 additions & 11 deletions rbi/lib/openai/models/audio/transcription_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -134,24 +134,16 @@ module OpenAI
class Model < OpenAI::Union
abstract!

class << self
sig { override.returns([String, Symbol]) }
def variants
end
end
Variants = type_template(:out) { {fixed: T.any(String, Symbol)} }
end

class TimestampGranularity < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

WORD = :word
SEGMENT = :segment

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@ module OpenAI
class TranscriptionCreateResponse < OpenAI::Union
abstract!

class << self
sig { override.returns([OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose]) }
def variants
end
end
Variants = type_template(:out) { {fixed: T.any(OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose)} }
end
end
end
Expand Down
6 changes: 1 addition & 5 deletions rbi/lib/openai/models/audio/translation_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,7 @@ module OpenAI
class Model < OpenAI::Union
abstract!

class << self
sig { override.returns([String, Symbol]) }
def variants
end
end
Variants = type_template(:out) { {fixed: T.any(String, Symbol)} }
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@ module OpenAI
class TranslationCreateResponse < OpenAI::Union
abstract!

class << self
sig { override.returns([OpenAI::Models::Audio::Translation, OpenAI::Models::Audio::TranslationVerbose]) }
def variants
end
end
Variants = type_template(:out) { {fixed: T.any(OpenAI::Models::Audio::Translation, OpenAI::Models::Audio::TranslationVerbose)} }
end
end
end
Expand Down
8 changes: 2 additions & 6 deletions rbi/lib/openai/models/audio_model.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ module OpenAI
class AudioModel < OpenAI::Enum
abstract!

WHISPER_1 = :"whisper-1"
Value = type_template(:out) { {fixed: Symbol} }

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
WHISPER_1 = :"whisper-1"
end
end
end
8 changes: 2 additions & 6 deletions rbi/lib/openai/models/audio_response_format.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@ module OpenAI
class AudioResponseFormat < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

JSON = :json
TEXT = :text
SRT = :srt
VERBOSE_JSON = :verbose_json
VTT = :vtt

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end
end
end
8 changes: 2 additions & 6 deletions rbi/lib/openai/models/batch.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,8 @@ module OpenAI
class Status < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

VALIDATING = :validating
FAILED = :failed
IN_PROGRESS = :in_progress
Expand All @@ -277,12 +279,6 @@ module OpenAI
EXPIRED = :expired
CANCELLING = :cancelling
CANCELLED = :cancelled

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end

class Errors < OpenAI::BaseModel
Expand Down
16 changes: 4 additions & 12 deletions rbi/lib/openai/models/batch_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,9 @@ module OpenAI
class CompletionWindow < OpenAI::Enum
abstract!

NUMBER_24H = :"24h"
Value = type_template(:out) { {fixed: Symbol} }

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
NUMBER_24H = :"24h"
end

# The endpoint to be used for all requests in the batch. Currently
Expand All @@ -108,15 +104,11 @@ module OpenAI
class Endpoint < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

V1_CHAT_COMPLETIONS = :"/v1/chat/completions"
V1_EMBEDDINGS = :"/v1/embeddings"
V1_COMPLETIONS = :"/v1/completions"

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end
end
end
Expand Down
26 changes: 10 additions & 16 deletions rbi/lib/openai/models/beta/assistant_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,7 @@ module OpenAI
class Model < OpenAI::Union
abstract!

class << self
sig { override.returns([String, Symbol]) }
def variants
end
end
Variants = type_template(:out) { {fixed: T.any(String, Symbol)} }
end

class ToolResources < OpenAI::BaseModel
Expand Down Expand Up @@ -530,6 +526,15 @@ module OpenAI
class ChunkingStrategy < OpenAI::Union
abstract!

Variants = type_template(:out) do
{
fixed: T.any(
OpenAI::Models::Beta::AssistantCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Auto,
OpenAI::Models::Beta::AssistantCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static
)
}
end

class Auto < OpenAI::BaseModel
# Always `auto`.
sig { returns(Symbol) }
Expand Down Expand Up @@ -638,17 +643,6 @@ module OpenAI
end
end
end

class << self
sig do
override
.returns(
[OpenAI::Models::Beta::AssistantCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Auto, OpenAI::Models::Beta::AssistantCreateParams::ToolResources::FileSearch::VectorStore::ChunkingStrategy::Static]
)
end
def variants
end
end
end
end
end
Expand Down
8 changes: 2 additions & 6 deletions rbi/lib/openai/models/beta/assistant_list_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,10 @@ module OpenAI
class Order < OpenAI::Enum
abstract!

Value = type_template(:out) { {fixed: Symbol} }

ASC = :asc
DESC = :desc

class << self
sig { override.returns(T::Array[Symbol]) }
def values
end
end
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ module OpenAI
class AssistantResponseFormatOption < OpenAI::Union
abstract!

class << self
sig do
override
.returns(
[Symbol, OpenAI::Models::ResponseFormatText, OpenAI::Models::ResponseFormatJSONObject, OpenAI::Models::ResponseFormatJSONSchema]
)
end
def variants
end
Variants = type_template(:out) do
{
fixed: T.any(
Symbol,
OpenAI::Models::ResponseFormatText,
OpenAI::Models::ResponseFormatJSONObject,
OpenAI::Models::ResponseFormatJSONSchema
)
}
end
end
end
Expand Down
Loading