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 @@ -235,6 +235,10 @@ Style/RegexpLiteral:
Style/SafeNavigation:
Enabled: false

Style/SignalException:
Exclude:
- Rakefile

# We use these sparingly, where we anticipate future branches for the
# inner conditional.
Style/SoleNestedConditional:
Expand Down
1 change: 1 addition & 0 deletions .yardopts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
--markup markdown
--markup-provider redcarpet
--exclude /rbi
--exclude /sig
19 changes: 13 additions & 6 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,6 @@ source "https://rubygems.org"
gemspec

group :development do
gem "async"
gem "minitest"
gem "minitest-focus"
gem "minitest-hooks"
gem "minitest-proveit"
gem "minitest-rg"
gem "rake"
gem "rbs"
gem "rubocop"
Expand All @@ -20,6 +14,19 @@ group :development do
# TODO: using a fork for now, the prettier below has a bug
gem "syntax_tree-rbs", github: "stainless-api/syntax_tree-rbs", branch: "main"
gem "tapioca"
end

group :development, :test do
gem "async"
gem "minitest"
gem "minitest-focus"
gem "minitest-hooks"
gem "minitest-proveit"
gem "minitest-rg"
end

group :development, :docs do
gem "redcarpet"
gem "webrick"
gem "yard"
end
72 changes: 40 additions & 32 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ GEM
minitest (>= 5.1)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
ast (2.4.2)
async (2.23.0)
ast (2.4.3)
async (2.23.1)
console (~> 1.29)
fiber-annotation
io-event (~> 1.9)
Expand All @@ -41,11 +41,11 @@ GEM
bigdecimal (3.1.9)
concurrent-ruby (1.3.5)
connection_pool (2.5.0)
console (1.29.3)
console (1.30.2)
fiber-annotation
fiber-local (~> 1.1)
json
csv (3.3.2)
csv (3.3.3)
drb (2.2.1)
erubi (1.13.1)
ffi (1.17.1)
Expand All @@ -56,16 +56,16 @@ GEM
fileutils (1.7.3)
i18n (1.14.7)
concurrent-ruby (~> 1.0)
io-event (1.9.0)
json (2.10.1)
io-event (1.10.0)
json (2.10.2)
language_server-protocol (3.17.0.4)
lint_roller (1.1.0)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.6)
metrics (0.12.1)
minitest (5.25.4)
logger (1.7.0)
metrics (0.12.2)
minitest (5.25.5)
minitest-focus (1.4.0)
minitest (>= 4, < 6)
minitest-hooks (1.5.2)
Expand All @@ -74,68 +74,73 @@ GEM
minitest (> 5, < 7)
minitest-rg (5.3.0)
minitest (~> 5.0)
mutex_m (0.3.0)
netrc (0.11.0)
parallel (1.26.3)
parser (3.3.7.1)
parser (3.3.7.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
prism (1.3.0)
prism (1.4.0)
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rbi (0.2.4)
rbi (0.3.1)
prism (~> 1.0)
rbs (>= 3.4.4)
sorbet-runtime (>= 0.5.9204)
rbs (3.8.1)
rbs (3.9.2)
logger
redcarpet (3.6.1)
regexp_parser (2.10.0)
rubocop (1.73.2)
rubocop (1.75.1)
json (~> 2.3)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.1.0)
parallel (~> 1.10)
parser (>= 3.3.0.2)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 2.9.3, < 3.0)
rubocop-ast (>= 1.38.0, < 2.0)
rubocop-ast (>= 1.43.0, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 4.0)
rubocop-ast (1.38.1)
parser (>= 3.3.1.0)
rubocop-ast (1.43.0)
parser (>= 3.3.7.2)
prism (~> 1.4)
ruby-progressbar (1.13.0)
securerandom (0.4.1)
sorbet (0.5.11888)
sorbet-static (= 0.5.11888)
sorbet-runtime (0.5.11888)
sorbet-static (0.5.11888-x86_64-linux)
sorbet-static-and-runtime (0.5.11888)
sorbet (= 0.5.11888)
sorbet-runtime (= 0.5.11888)
spoom (1.5.4)
sorbet (0.5.11966)
sorbet-static (= 0.5.11966)
sorbet-runtime (0.5.11966)
sorbet-static (0.5.11966-x86_64-linux)
sorbet-static-and-runtime (0.5.11966)
sorbet (= 0.5.11966)
sorbet-runtime (= 0.5.11966)
spoom (1.6.1)
erubi (>= 1.10.0)
prism (>= 0.28.0)
rbi (>= 0.2.3)
sorbet-static-and-runtime (>= 0.5.10187)
thor (>= 0.19.2)
steep (1.9.4)
steep (1.10.0)
activesupport (>= 5.1)
concurrent-ruby (>= 1.1.10)
csv (>= 3.0.9)
fileutils (>= 1.1.0)
json (>= 2.1.0)
language_server-protocol (>= 3.15, < 4.0)
language_server-protocol (>= 3.17.0.4, < 4.0)
listen (~> 3.0)
logger (>= 1.3.0)
mutex_m (>= 0.3.0)
parser (>= 3.1)
rainbow (>= 2.2.2, < 4.0)
rbs (~> 3.8)
rbs (~> 3.9)
securerandom (>= 0.1)
strscan (>= 1.0.0)
terminal-table (>= 2, < 4)
terminal-table (>= 2, < 5)
uri (>= 0.12.0)
strscan (3.1.2)
syntax_tree (6.2.0)
Expand All @@ -150,13 +155,15 @@ GEM
spoom (>= 1.2.0)
thor (>= 1.2.0)
yard-sorbet
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
terminal-table (4.0.0)
unicode-display_width (>= 1.1.1, < 4)
thor (1.3.2)
traces (0.15.2)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.6.0)
unicode-display_width (3.1.4)
unicode-emoji (~> 4.0, >= 4.0.4)
unicode-emoji (4.0.4)
uri (1.0.3)
webrick (1.9.1)
yard (0.9.37)
Expand All @@ -177,6 +184,7 @@ DEPENDENCIES
openai!
rake
rbs
redcarpet
rubocop
sorbet
steep
Expand Down
6 changes: 6 additions & 0 deletions lib/openai/type/converter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

module OpenAI
module Type
# rubocop:disable Metrics/ModuleLength
# @api private
module Converter
# rubocop:disable Lint/UnusedMethodArgument
Expand Down Expand Up @@ -118,6 +119,8 @@ def coerce(
value,
state: {strictness: true, exactness: {yes: 0, no: 0, maybe: 0}, branched: 0}
)
# rubocop:disable Lint/SuppressedException
# rubocop:disable Metrics/BlockNesting
strictness, exactness = state.fetch_values(:strictness, :exactness)

case target
Expand Down Expand Up @@ -194,6 +197,8 @@ def coerce(

exactness[:no] += 1
value
# rubocop:enable Metrics/BlockNesting
# rubocop:enable Lint/SuppressedException
end

# @api private
Expand All @@ -207,5 +212,6 @@ def dump(target, value)
end
end
end
# rubocop:enable Metrics/ModuleLength
end
end
10 changes: 9 additions & 1 deletion rbi/lib/openai/models/audio/speech_create_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,15 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(input:, model:, voice:, instructions: nil, response_format: nil, speed: nil, request_options: {})
def self.new(
input:,
model:,
voice:,
instructions: nil,
response_format: nil,
speed: nil,
request_options: {}
)
end

sig do
Expand Down
13 changes: 12 additions & 1 deletion rbi/lib/openai/models/audio/transcription_segment.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,18 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(id:, avg_logprob:, compression_ratio:, end_:, no_speech_prob:, seek:, start:, temperature:, text:, tokens:)
def self.new(
id:,
avg_logprob:,
compression_ratio:,
end_:,
no_speech_prob:,
seek:,
start:,
temperature:,
text:,
tokens:
)
end

sig do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,14 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(index:, end_index: nil, file_citation: nil, start_index: nil, text: nil, type: :file_citation)
def self.new(
index:,
end_index: nil,
file_citation: nil,
start_index: nil,
text: nil,
type: :file_citation
)
end

sig do
Expand Down
10 changes: 9 additions & 1 deletion rbi/lib/openai/models/beta/threads/runs/step_list_params.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,15 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(thread_id:, after: nil, before: nil, include: nil, limit: nil, order: nil, request_options: {})
def self.new(
thread_id:,
after: nil,
before: nil,
include: nil,
limit: nil,
order: nil,
request_options: {}
)
end

sig do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,15 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(audio: nil, content: nil, function_call: nil, name: nil, refusal: nil, tool_calls: nil, role: :assistant)
def self.new(
audio: nil,
content: nil,
function_call: nil,
name: nil,
refusal: nil,
tool_calls: nil,
role: :assistant
)
end

sig do
Expand Down
10 changes: 9 additions & 1 deletion rbi/lib/openai/models/chat/chat_completion_message.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,15 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(content:, refusal:, annotations: nil, audio: nil, function_call: nil, tool_calls: nil, role: :assistant)
def self.new(
content:,
refusal:,
annotations: nil,
audio: nil,
function_call: nil,
tool_calls: nil,
role: :assistant
)
end

sig do
Expand Down
10 changes: 9 additions & 1 deletion rbi/lib/openai/models/completion.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,15 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(id:, choices:, created:, model:, system_fingerprint: nil, usage: nil, object: :text_completion)
def self.new(
id:,
choices:,
created:,
model:,
system_fingerprint: nil,
usage: nil,
object: :text_completion
)
end

sig do
Expand Down
7 changes: 6 additions & 1 deletion rbi/lib/openai/models/completion_usage.rbi
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,12 @@ module OpenAI
)
.returns(T.attached_class)
end
def self.new(accepted_prediction_tokens: nil, audio_tokens: nil, reasoning_tokens: nil, rejected_prediction_tokens: nil)
def self.new(
accepted_prediction_tokens: nil,
audio_tokens: nil,
reasoning_tokens: nil,
rejected_prediction_tokens: nil
)
end

sig do
Expand Down
Loading