diff --git a/.rubocop.yml b/.rubocop.yml index e0a360b6..e612c952 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -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 diff --git a/lib/openai/base_page.rb b/lib/openai/base_page.rb index c8a9058a..3892c2bc 100644 --- a/lib/openai/base_page.rb +++ b/lib/openai/base_page.rb @@ -28,6 +28,8 @@ module OpenAI # completions => Array # ``` module BasePage + # rubocop:disable Lint/UnusedMethodArgument + # @return [Boolean] def next_page? = (raise NotImplementedError) @@ -56,5 +58,7 @@ def initialize(client:, req:, headers:, page_data:) @req = req super() end + + # rubocop:enable Lint/UnusedMethodArgument end end diff --git a/lib/openai/util.rb b/lib/openai/util.rb index ef208d81..552fc640 100644 --- a/lib/openai/util.rb +++ b/lib/openai/util.rb @@ -452,6 +452,7 @@ def string_io(&blk) end class << self + # rubocop:disable Naming/MethodParameterName # @api private # # @param y [Enumerator::Yielder] @@ -489,6 +490,7 @@ class << self end y << "\r\n" end + # rubocop:enable Naming/MethodParameterName # @api private # diff --git a/openai.gemspec b/openai.gemspec index e9cdbc7b..60a53a67 100644 --- a/openai.gemspec +++ b/openai.gemspec @@ -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 diff --git a/rbi/lib/openai/base_model.rbi b/rbi/lib/openai/base_model.rbi index 11854971..4b5b673d 100644 --- a/rbi/lib/openai/base_model.rbi +++ b/rbi/lib/openai/base_model.rbi @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/rbi/lib/openai/cursor_page.rbi b/rbi/lib/openai/cursor_page.rbi index c40bab43..261ed7d6 100644 --- a/rbi/lib/openai/cursor_page.rbi +++ b/rbi/lib/openai/cursor_page.rbi @@ -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 diff --git a/rbi/lib/openai/page.rbi b/rbi/lib/openai/page.rbi index a738bab8..41e78793 100644 --- a/rbi/lib/openai/page.rbi +++ b/rbi/lib/openai/page.rbi @@ -21,5 +21,9 @@ module OpenAI sig { params(_: String).returns(String) } def object=(_) end + + sig { returns(String) } + def inspect + end end end diff --git a/sig/openai/base_model.rbs b/sig/openai/base_model.rbs index d9267814..581a545f 100644 --- a/sig/openai/base_model.rbs +++ b/sig/openai/base_model.rbs @@ -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 @@ -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 diff --git a/sig/openai/cursor_page.rbs b/sig/openai/cursor_page.rbs index 5aa7c659..4bf87e3a 100644 --- a/sig/openai/cursor_page.rbs +++ b/sig/openai/cursor_page.rbs @@ -5,5 +5,7 @@ module OpenAI attr_accessor data: ::Array[Elem]? attr_accessor has_more: bool + + def inspect: -> String end end diff --git a/sig/openai/page.rbs b/sig/openai/page.rbs index 420e2716..0159e75d 100644 --- a/sig/openai/page.rbs +++ b/sig/openai/page.rbs @@ -5,5 +5,7 @@ module OpenAI attr_accessor data: ::Array[Elem]? attr_accessor object: String + + def inspect: -> String end end