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
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ AllCops:
SuggestExtensions: false
TargetRubyVersion: 3.1.0

# Whether MFA is required or not should be left to the token configuration
Gemspec/RequireMFA:
Enabled: false

# Don't require this extra line break, it can be excessive.
Layout/EmptyLineAfterGuardClause:
Enabled: false
Expand Down
4 changes: 4 additions & 0 deletions lib/openai/base_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module OpenAI
# completions => Array
# ```
module BasePage
# rubocop:disable Lint/UnusedMethodArgument

# @return [Boolean]
def next_page? = (raise NotImplementedError)

Expand Down Expand Up @@ -56,5 +58,7 @@ def initialize(client:, req:, headers:, page_data:)
@req = req
super()
end

# rubocop:enable Lint/UnusedMethodArgument
end
end
2 changes: 2 additions & 0 deletions lib/openai/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ def string_io(&blk)
end

class << self
# rubocop:disable Naming/MethodParameterName
# @api private
#
# @param y [Enumerator::Yielder]
Expand Down Expand Up @@ -489,6 +490,7 @@ class << self
end
y << "\r\n"
end
# rubocop:enable Naming/MethodParameterName

# @api private
#
Expand Down
2 changes: 1 addition & 1 deletion openai.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ Gem::Specification.new do |s|
s.homepage = "https://gemdocs.org/gems/openai"
s.metadata["homepage_uri"] = s.homepage
s.metadata["source_code_uri"] = "https://github.com/openai/openai-ruby"
s.metadata["rubygems_mfa_required"] = "false"
s.metadata["rubygems_mfa_required"] = false.to_s
end
36 changes: 32 additions & 4 deletions rbi/lib/openai/base_model.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,20 @@ module OpenAI

Elem = type_member(:out)

sig(:final) do
params(
type_info: T.any(
T::Hash[Symbol, T.anything],
T.proc.returns(OpenAI::Converter::Input),
OpenAI::Converter::Input
),
spec: T::Hash[Symbol, T.anything]
)
.returns(T.attached_class)
end
def self.[](type_info, spec = {})
end

sig(:final) { params(other: T.anything).returns(T::Boolean) }
def ===(other)
end
Expand Down Expand Up @@ -360,9 +374,9 @@ module OpenAI
),
spec: T::Hash[Symbol, T.anything]
)
.returns(T.attached_class)
.void
end
def self.new(type_info, spec = {})
def initialize(type_info, spec = {})
end
end

Expand All @@ -377,6 +391,20 @@ module OpenAI

Elem = type_member(:out)

sig(:final) do
params(
type_info: T.any(
T::Hash[Symbol, T.anything],
T.proc.returns(OpenAI::Converter::Input),
OpenAI::Converter::Input
),
spec: T::Hash[Symbol, T.anything]
)
.returns(T.attached_class)
end
def self.[](type_info, spec = {})
end

sig(:final) { params(other: T.anything).returns(T::Boolean) }
def ===(other)
end
Expand Down Expand Up @@ -427,9 +455,9 @@ module OpenAI
),
spec: T::Hash[Symbol, T.anything]
)
.returns(T.attached_class)
.void
end
def self.new(type_info, spec = {})
def initialize(type_info, spec = {})
end
end

Expand Down
4 changes: 4 additions & 0 deletions rbi/lib/openai/cursor_page.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ module OpenAI
sig { params(_: T::Boolean).returns(T::Boolean) }
def has_more=(_)
end

sig { returns(String) }
def inspect
end
end
end
4 changes: 4 additions & 0 deletions rbi/lib/openai/page.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,9 @@ module OpenAI
sig { params(_: String).returns(String) }
def object=(_)
end

sig { returns(String) }
def inspect
end
end
end
14 changes: 14 additions & 0 deletions sig/openai/base_model.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@ module OpenAI
class ArrayOf[Elem]
include OpenAI::Converter

def self.[]: (
::Hash[Symbol, top]
| ^-> OpenAI::Converter::input
| OpenAI::Converter::input type_info,
?::Hash[Symbol, top] spec
) -> instance

def ===: (top other) -> bool

def ==: (top other) -> bool
Expand All @@ -146,6 +153,13 @@ module OpenAI
class HashOf[Elem]
include OpenAI::Converter

def self.[]: (
::Hash[Symbol, top]
| ^-> OpenAI::Converter::input
| OpenAI::Converter::input type_info,
?::Hash[Symbol, top] spec
) -> instance

def ===: (top other) -> bool

def ==: (top other) -> bool
Expand Down
2 changes: 2 additions & 0 deletions sig/openai/cursor_page.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ module OpenAI
attr_accessor data: ::Array[Elem]?

attr_accessor has_more: bool

def inspect: -> String
end
end
2 changes: 2 additions & 0 deletions sig/openai/page.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,7 @@ module OpenAI
attr_accessor data: ::Array[Elem]?

attr_accessor object: String

def inspect: -> String
end
end