Skip to content

Commit bb610d1

Browse files
chore: ensure doc strings for rbi method arguments (#13)
1 parent 9c2017d commit bb610d1

35 files changed

+2003
-73
lines changed

lib/openai/base_model.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,8 +876,6 @@ def initialize(type_info, spec = {})
876876
end
877877
end
878878

879-
# @api private
880-
#
881879
# @abstract
882880
#
883881
# @example
@@ -903,6 +901,8 @@ def known_fields
903901
@known_fields ||= (self < OpenAI::BaseModel ? superclass.known_fields.dup : {})
904902
end
905903

904+
# @api private
905+
#
906906
# @return [Hash{Symbol=>Hash{Symbol=>Object}}]
907907
def fields
908908
known_fields.transform_values do |field|

lib/openai/base_page.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22

33
module OpenAI
4-
# @api private
5-
#
64
# @abstract
75
#
86
# @example

lib/openai/base_stream.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22

33
module OpenAI
4-
# @api private
5-
#
64
# @example
75
# ```ruby
86
# stream.for_each do |message|

lib/openai/stream.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# frozen_string_literal: true
22

33
module OpenAI
4-
# @api private
5-
#
64
# @example
75
# ```ruby
86
# stream.for_each do |message|

rbi/lib/openai/base_model.rbi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,7 @@ module OpenAI
438438
def known_fields
439439
end
440440

441+
# @api private
441442
sig do
442443
returns(T::Hash[Symbol, T.all(OpenAI::BaseModel::KnownFieldShape, {type: OpenAI::Converter::Input})])
443444
end

rbi/lib/openai/base_page.rbi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# typed: strong
22

33
module OpenAI
4-
# @api private
54
module BasePage
65
abstract!
76

rbi/lib/openai/base_stream.rbi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# typed: strong
22

33
module OpenAI
4-
# @api private
54
module BaseStream
65
Message = type_member(:in)
76
Elem = type_member(:out)

rbi/lib/openai/client.rbi

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,10 +98,15 @@ module OpenAI
9898
.returns(T.attached_class)
9999
end
100100
def self.new(
101+
# Override the default base URL for the API, e.g., `"https://api.example.com/v2/"`
101102
base_url: nil,
103+
# Defaults to `ENV["OPENAI_API_KEY"]`
102104
api_key: ENV["OPENAI_API_KEY"],
105+
# Defaults to `ENV["OPENAI_ORG_ID"]`
103106
organization: ENV["OPENAI_ORG_ID"],
107+
# Defaults to `ENV["OPENAI_PROJECT_ID"]`
104108
project: ENV["OPENAI_PROJECT_ID"],
109+
# Max number of retries to attempt after a failed retryable request.
105110
max_retries: DEFAULT_MAX_RETRIES,
106111
timeout: DEFAULT_TIMEOUT_IN_SECONDS,
107112
initial_retry_delay: DEFAULT_INITIAL_RETRY_DELAY,

rbi/lib/openai/resources/audio/speech.rbi

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,25 @@ module OpenAI
1616
)
1717
.returns(T.anything)
1818
end
19-
def create(input:, model:, voice:, response_format: nil, speed: nil, request_options: {})
19+
def create(
20+
# The text to generate audio for. The maximum length is 4096 characters.
21+
input:,
22+
# One of the available [TTS models](https://platform.openai.com/docs/models#tts):
23+
# `tts-1` or `tts-1-hd`
24+
model:,
25+
# The voice to use when generating the audio. Supported voices are `alloy`, `ash`,
26+
# `coral`, `echo`, `fable`, `onyx`, `nova`, `sage` and `shimmer`. Previews of the
27+
# voices are available in the
28+
# [Text to speech guide](https://platform.openai.com/docs/guides/text-to-speech#voice-options).
29+
voice:,
30+
# The format to audio in. Supported formats are `mp3`, `opus`, `aac`, `flac`,
31+
# `wav`, and `pcm`.
32+
response_format: nil,
33+
# The speed of the generated audio. Select a value from `0.25` to `4.0`. `1.0` is
34+
# the default.
35+
speed: nil,
36+
request_options: {}
37+
)
2038
end
2139

2240
sig { params(client: OpenAI::Client).returns(T.attached_class) }

rbi/lib/openai/resources/audio/transcriptions.rbi

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,35 @@ module OpenAI
1919
.returns(T.any(OpenAI::Models::Audio::Transcription, OpenAI::Models::Audio::TranscriptionVerbose))
2020
end
2121
def create(
22+
# The audio file object (not file name) to transcribe, in one of these formats:
23+
# flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
2224
file:,
25+
# ID of the model to use. Only `whisper-1` (which is powered by our open source
26+
# Whisper V2 model) is currently available.
2327
model:,
28+
# The language of the input audio. Supplying the input language in
29+
# [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) (e.g. `en`)
30+
# format will improve accuracy and latency.
2431
language: nil,
32+
# An optional text to guide the model's style or continue a previous audio
33+
# segment. The
34+
# [prompt](https://platform.openai.com/docs/guides/speech-to-text#prompting)
35+
# should match the audio language.
2536
prompt: nil,
37+
# The format of the output, in one of these options: `json`, `text`, `srt`,
38+
# `verbose_json`, or `vtt`.
2639
response_format: nil,
40+
# The sampling temperature, between 0 and 1. Higher values like 0.8 will make the
41+
# output more random, while lower values like 0.2 will make it more focused and
42+
# deterministic. If set to 0, the model will use
43+
# [log probability](https://en.wikipedia.org/wiki/Log_probability) to
44+
# automatically increase the temperature until certain thresholds are hit.
2745
temperature: nil,
46+
# The timestamp granularities to populate for this transcription.
47+
# `response_format` must be set `verbose_json` to use timestamp granularities.
48+
# Either or both of these options are supported: `word`, or `segment`. Note: There
49+
# is no additional latency for segment timestamps, but generating word timestamps
50+
# incurs additional latency.
2851
timestamp_granularities: nil,
2952
request_options: {}
3053
)

0 commit comments

Comments
 (0)