openai 0.100.0 → 0.101.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +14 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/models/audio/speech_create_params.rb +3 -6
  6. data/lib/openai/models/audio/voice.rb +4 -9
  7. data/lib/openai/models/audio/voice_create_params.rb +3 -100
  8. data/lib/openai/models/beta/beta_response_tool_search_output_item_param.rb +1166 -3
  9. data/lib/openai/models/beta/beta_tool_search_output_namespace_tool.rb +176 -0
  10. data/lib/openai/models/chat/chat_completion_audio_param.rb +3 -3
  11. data/lib/openai/models/decision.rb +313 -0
  12. data/lib/openai/models/decision_create_params.rb +233 -0
  13. data/lib/openai/models/decision_input_image.rb +53 -0
  14. data/lib/openai/models/decision_input_message.rb +60 -0
  15. data/lib/openai/models/decision_input_part.rb +20 -0
  16. data/lib/openai/models/decision_input_text.rb +21 -0
  17. data/lib/openai/models/realtime/realtime_audio_config_output.rb +3 -6
  18. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +3 -6
  19. data/lib/openai/models/responses/response_tool_search_output_item_param.rb +1166 -3
  20. data/lib/openai/models/responses/tool_search_output_namespace_tool.rb +174 -0
  21. data/lib/openai/models.rb +12 -0
  22. data/lib/openai/resources/audio/speech.rb +1 -2
  23. data/lib/openai/resources/audio/voices.rb +10 -10
  24. data/lib/openai/resources/decisions.rb +59 -0
  25. data/lib/openai/version.rb +1 -1
  26. data/lib/openai.rb +9 -0
  27. data/rbi/openai/client.rbi +3 -0
  28. data/rbi/openai/models/audio/speech_create_params.rbi +3 -6
  29. data/rbi/openai/models/audio/voice.rbi +4 -9
  30. data/rbi/openai/models/audio/voice_create_params.rbi +4 -149
  31. data/rbi/openai/models/beta/beta_response_tool_search_output_item_param.rbi +1893 -18
  32. data/rbi/openai/models/beta/beta_tool_search_output_namespace_tool.rbi +272 -0
  33. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +3 -3
  34. data/rbi/openai/models/decision.rbi +586 -0
  35. data/rbi/openai/models/decision_create_params.rbi +435 -0
  36. data/rbi/openai/models/decision_input_image.rbi +81 -0
  37. data/rbi/openai/models/decision_input_message.rbi +96 -0
  38. data/rbi/openai/models/decision_input_part.rbi +24 -0
  39. data/rbi/openai/models/decision_input_text.rbi +49 -0
  40. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +3 -6
  41. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +3 -6
  42. data/rbi/openai/models/responses/response_tool_search_output_item_param.rbi +1901 -18
  43. data/rbi/openai/models/responses/tool_search_output_namespace_tool.rbi +272 -0
  44. data/rbi/openai/models.rbi +12 -0
  45. data/rbi/openai/resources/audio/speech.rbi +1 -2
  46. data/rbi/openai/resources/audio/voices.rbi +10 -13
  47. data/rbi/openai/resources/decisions.rbi +57 -0
  48. data/sig/openai/client.rbs +2 -0
  49. data/sig/openai/models/audio/speech_create_params.rbs +2 -4
  50. data/sig/openai/models/audio/voice.rbs +3 -6
  51. data/sig/openai/models/audio/voice_create_params.rbs +1 -90
  52. data/sig/openai/models/beta/beta_response_tool_search_output_item_param.rbs +993 -4
  53. data/sig/openai/models/beta/beta_tool_search_output_namespace_tool.rbs +162 -0
  54. data/sig/openai/models/chat/chat_completion_audio_param.rbs +2 -2
  55. data/sig/openai/models/decision.rbs +296 -0
  56. data/sig/openai/models/decision_create_params.rbs +227 -0
  57. data/sig/openai/models/decision_input_image.rbs +51 -0
  58. data/sig/openai/models/decision_input_message.rbs +57 -0
  59. data/sig/openai/models/decision_input_part.rbs +12 -0
  60. data/sig/openai/models/decision_input_text.rbs +15 -0
  61. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +3 -6
  62. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +3 -6
  63. data/sig/openai/models/responses/response_tool_search_output_item_param.rbs +993 -4
  64. data/sig/openai/models/responses/tool_search_output_namespace_tool.rbs +160 -0
  65. data/sig/openai/models.rbs +12 -0
  66. data/sig/openai/resources/decisions.rbs +15 -0
  67. metadata +28 -1
@@ -0,0 +1,174 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Responses
6
+ class ToolSearchOutputNamespaceTool < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute description
8
+ # A description of the namespace shown to the model.
9
+ #
10
+ # @return [String]
11
+ required :description, String
12
+
13
+ # @!attribute name
14
+ # The namespace name used in tool calls (for example, `crm`).
15
+ #
16
+ # @return [String]
17
+ required :name, String
18
+
19
+ # @!attribute tools
20
+ # The function/custom tools loaded inside this namespace.
21
+ #
22
+ # @return [Array<OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool>]
23
+ required(
24
+ :tools,
25
+ -> { OpenAI::Internal::Type::ArrayOf[union: OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool] }
26
+ )
27
+
28
+ # @!attribute type
29
+ # The type of the tool. Always `namespace`.
30
+ #
31
+ # @return [Symbol, :namespace]
32
+ required :type, const: :namespace
33
+
34
+ # @!method initialize(description:, name:, tools:, type: :namespace)
35
+ # Groups function/custom tools under a shared namespace.
36
+ #
37
+ # @param description [String]
38
+ # A description of the namespace shown to the model.
39
+ #
40
+ # @param name [String]
41
+ # The namespace name used in tool calls (for example, `crm`).
42
+ #
43
+ # @param tools [Array<OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool>]
44
+ # The function/custom tools loaded inside this namespace.
45
+ #
46
+ # @param type [Symbol, :namespace]
47
+ # The type of the tool. Always `namespace`.
48
+
49
+ # A function or custom tool loaded into a namespace by tool search.
50
+ module Tool
51
+ extend OpenAI::Internal::Type::Union
52
+
53
+ discriminator :type
54
+
55
+ variant :function, -> { OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function }
56
+
57
+ # A custom tool that processes input using a specified format. Learn more about [custom tools](https://developers.openai.com/api/docs/guides/function-calling#custom-tools)
58
+ variant :custom, -> { OpenAI::Responses::CustomTool }
59
+
60
+ class Function < OpenAI::Internal::Type::BaseModel
61
+ # @!attribute name
62
+ # The name of the loaded function tool.
63
+ #
64
+ # @return [String]
65
+ required :name, String
66
+
67
+ # @!attribute type
68
+ #
69
+ # @return [Symbol, :function]
70
+ required :type, const: :function
71
+
72
+ # @!attribute allowed_callers
73
+ # The tool invocation context(s).
74
+ #
75
+ # @return [Array<Symbol, OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
76
+ optional(
77
+ :allowed_callers,
78
+ -> {
79
+ OpenAI::Internal::Type::ArrayOf[
80
+ enum: OpenAI::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller
81
+ ]
82
+ },
83
+ nil?: true
84
+ )
85
+
86
+ # @!attribute async
87
+ # Whether the tool response can be returned asynchronously versus immediately
88
+ # returned on next response creation.
89
+ #
90
+ # @return [Boolean, nil]
91
+ optional :async, OpenAI::Internal::Type::Boolean
92
+
93
+ # @!attribute defer_loading
94
+ # Whether this function should be deferred and discovered via tool search.
95
+ #
96
+ # @return [Boolean, nil]
97
+ optional :defer_loading, OpenAI::Internal::Type::Boolean
98
+
99
+ # @!attribute description
100
+ #
101
+ # @return [String, nil]
102
+ optional :description, String, nil?: true
103
+
104
+ # @!attribute output_schema
105
+ # A JSON Schema describing the JSON value encoded in string outputs for this
106
+ # function tool. This does not describe content-array outputs.
107
+ #
108
+ # @return [Hash{Symbol=>Object}, nil]
109
+ optional(
110
+ :output_schema,
111
+ OpenAI::Internal::Type::HashOf[OpenAI::Internal::Type::Unknown],
112
+ nil?: true
113
+ )
114
+
115
+ # @!attribute parameters
116
+ #
117
+ # @return [Object, nil]
118
+ optional :parameters, OpenAI::Internal::Type::Unknown, nil?: true
119
+
120
+ # @!attribute strict
121
+ # Whether to enforce strict parameter validation. If omitted, Responses attempts
122
+ # to use strict validation when the schema is compatible, and falls back to
123
+ # non-strict validation otherwise.
124
+ #
125
+ # @return [Boolean, nil]
126
+ optional :strict, OpenAI::Internal::Type::Boolean, nil?: true
127
+
128
+ # @!method initialize(name:, allowed_callers: nil, async: nil, defer_loading: nil, description: nil, output_schema: nil, parameters: nil, strict: nil, type: :function)
129
+ # @param name [String]
130
+ # The name of the loaded function tool.
131
+ #
132
+ # @param allowed_callers [Array<Symbol, OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function::AllowedCaller>, nil]
133
+ # The tool invocation context(s).
134
+ #
135
+ # @param async [Boolean]
136
+ # Whether the tool response can be returned asynchronously versus immediately
137
+ # returned on next response creation.
138
+ #
139
+ # @param defer_loading [Boolean]
140
+ # Whether this function should be deferred and discovered via tool search.
141
+ #
142
+ # @param description [String, nil]
143
+ #
144
+ # @param output_schema [Hash{Symbol=>Object}, nil]
145
+ # A JSON Schema describing the JSON value encoded in string outputs for this
146
+ # function tool. This does not describe content-array outputs.
147
+ #
148
+ # @param parameters [Object, nil]
149
+ #
150
+ # @param strict [Boolean, nil]
151
+ # Whether to enforce strict parameter validation. If omitted, Responses attempts
152
+ # to use strict validation when the schema is compatible, and falls back to
153
+ # non-strict validation otherwise.
154
+ #
155
+ # @param type [Symbol, :function]
156
+
157
+ module AllowedCaller
158
+ extend OpenAI::Internal::Type::Enum
159
+
160
+ DIRECT = :direct
161
+ PROGRAMMATIC = :programmatic
162
+
163
+ # @!method self.values
164
+ # @return [Array<Symbol>]
165
+ end
166
+ end
167
+
168
+ # @!method self.variants
169
+ # @return [Array(OpenAI::Models::Responses::ToolSearchOutputNamespaceTool::Tool::Function, OpenAI::Models::Responses::CustomTool)]
170
+ end
171
+ end
172
+ end
173
+ end
174
+ end
data/lib/openai/models.rb CHANGED
@@ -113,6 +113,18 @@ module OpenAI
113
113
 
114
114
  CustomToolInputFormat = OpenAI::Models::CustomToolInputFormat
115
115
 
116
+ Decision = OpenAI::Models::Decision
117
+
118
+ DecisionCreateParams = OpenAI::Models::DecisionCreateParams
119
+
120
+ DecisionInputImage = OpenAI::Models::DecisionInputImage
121
+
122
+ DecisionInputMessage = OpenAI::Models::DecisionInputMessage
123
+
124
+ DecisionInputPart = OpenAI::Models::DecisionInputPart
125
+
126
+ DecisionInputText = OpenAI::Models::DecisionInputText
127
+
116
128
  DeletedSkill = OpenAI::Models::DeletedSkill
117
129
 
118
130
  Embedding = OpenAI::Models::Embedding
@@ -26,8 +26,7 @@ module OpenAI
26
26
  # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
27
27
  # voices are available in the
28
28
  # [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
29
- # Custom voices must be created from audio samples. Voices created from text
30
- # prompts are supported only in Live.
29
+ # Custom voices must be created from audio samples.
31
30
  #
32
31
  # @param instructions [String]
33
32
  # Control the voice of your generated audio with additional instructions. Does not
@@ -5,21 +5,21 @@ module OpenAI
5
5
  class Audio
6
6
  # Turn audio into text or text into audio.
7
7
  class Voices
8
- # Creates a voice from a text prompt or from a consent recording and an audio
9
- # sample.
8
+ # Create a custom voice you can use for audio output (for example, in
9
+ # Text-to-Speech and the Realtime API). This requires an audio sample and a
10
+ # previously uploaded consent recording.
10
11
  #
11
- # For prompt-based creation, send `type: "prompt"` with a `name` and `prompt` as
12
- # JSON or multipart form data. For creation from an audio sample, send
13
- # `type: "audio_sample"` with a `name`, `audio_sample`, and `consent` recording ID
14
- # as multipart form data. The type defaults to `audio_sample` when omitted.
12
+ # Send `name`, `audio_sample`, and the `consent` recording ID as multipart form
13
+ # data. The optional `type` defaults to `audio_sample`.
15
14
  #
16
- # Returns the saved voice's metadata. Voices created from text prompts are
17
- # supported only in Live, not in Realtime or the speech endpoint. The response
18
- # does not include preview audio.
15
+ # Returns the saved voice's metadata. See the
16
+ # [custom voices guide](https://developers.openai.com/api/docs/guides/text-to-speech#custom-voices)
17
+ # for requirements and best practices. Custom voices are limited to eligible
18
+ # customers.
19
19
  #
20
20
  # @overload create(body:, request_options: {})
21
21
  #
22
- # @param body [OpenAI::Models::Audio::VoiceCreateParams::Body::AudioSample, OpenAI::Models::Audio::VoiceCreateParams::Body::Prompt]
22
+ # @param body [OpenAI::Models::Audio::VoiceCreateParams::Body::AudioSample]
23
23
  # Creates a voice from a consent recording and an audio sample. Requires
24
24
  # multipart/form-data.
25
25
  #
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Resources
5
+ class Decisions
6
+ # Evaluate ordered classification and scoring questions against shared input.
7
+ # Answers are returned in question order.
8
+ #
9
+ # Supply input as a string or user messages containing text and inline images.
10
+ # Only user messages with `input_text` and `input_image` parts are supported;
11
+ # non-user roles, function calls, files, audio, and item references are not
12
+ # supported. Images require a data URL, not an external URL or file ID. At most
13
+ # 128 images are allowed across the request.
14
+ #
15
+ # Each question can return a refusal instead of a scored answer. A refusal has
16
+ # type `refusal` and the corresponding question name, or null if unnamed.
17
+ #
18
+ # @overload create(input:, model:, questions:, safety_identifier: nil, request_options: {})
19
+ #
20
+ # @param input [String, Array<OpenAI::Models::DecisionInputMessage>]
21
+ # Shared evidence, as a string or an array of user messages containing text and
22
+ # inline images. Non-user roles, function calls, function-call outputs, files,
23
+ # audio, and item references are not supported. At most 128 image parts are
24
+ # allowed across all messages in one request.
25
+ #
26
+ # @param model [String]
27
+ #
28
+ # @param questions [Array<OpenAI::Models::DecisionCreateParams::Question::Predicate, OpenAI::Models::DecisionCreateParams::Question::Choice, OpenAI::Models::DecisionCreateParams::Question::Score>]
29
+ #
30
+ # @param safety_identifier [String, nil]
31
+ # Opaque caller-provided end-user identifier, scoped by the verified org. Match
32
+ # Responses' limit; this is never the authenticated user identity.
33
+ #
34
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
35
+ #
36
+ # @return [OpenAI::Models::Decision]
37
+ #
38
+ # @see OpenAI::Models::DecisionCreateParams
39
+ def create(params)
40
+ parsed, options = OpenAI::DecisionCreateParams.dump_request(params)
41
+ @client.request(
42
+ method: :post,
43
+ path: "decisions",
44
+ body: parsed,
45
+ model: OpenAI::Decision,
46
+ security: {bearer_auth: true},
47
+ options: options
48
+ )
49
+ end
50
+
51
+ # @api private
52
+ #
53
+ # @param client [OpenAI::Client]
54
+ def initialize(client:)
55
+ @client = client
56
+ end
57
+ end
58
+ end
59
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OpenAI
4
- VERSION = "0.100.0"
4
+ VERSION = "0.101.1"
5
5
  end
data/lib/openai.rb CHANGED
@@ -719,6 +719,7 @@ require_relative "openai/models/beta/beta_tool_choice_mcp"
719
719
  require_relative "openai/models/beta/beta_tool_choice_options"
720
720
  require_relative "openai/models/beta/beta_tool_choice_shell"
721
721
  require_relative "openai/models/beta/beta_tool_choice_types"
722
+ require_relative "openai/models/beta/beta_tool_search_output_namespace_tool"
722
723
  require_relative "openai/models/beta/beta_tool_search_tool"
723
724
  require_relative "openai/models/beta/beta_web_search_preview_tool"
724
725
  require_relative "openai/models/beta/beta_web_search_tool"
@@ -954,6 +955,12 @@ require_relative "openai/models/conversations/summary_text_content"
954
955
  require_relative "openai/models/conversations/text_content"
955
956
  require_relative "openai/models/create_embedding_response"
956
957
  require_relative "openai/models/custom_tool_input_format"
958
+ require_relative "openai/models/decision"
959
+ require_relative "openai/models/decision_create_params"
960
+ require_relative "openai/models/decision_input_image"
961
+ require_relative "openai/models/decision_input_message"
962
+ require_relative "openai/models/decision_input_part"
963
+ require_relative "openai/models/decision_input_text"
957
964
  require_relative "openai/models/deleted_skill"
958
965
  require_relative "openai/models/embedding"
959
966
  require_relative "openai/models/embedding_create_params"
@@ -1364,6 +1371,7 @@ require_relative "openai/models/responses/tool_choice_mcp"
1364
1371
  require_relative "openai/models/responses/tool_choice_options"
1365
1372
  require_relative "openai/models/responses/tool_choice_shell"
1366
1373
  require_relative "openai/models/responses/tool_choice_types"
1374
+ require_relative "openai/models/responses/tool_search_output_namespace_tool"
1367
1375
  require_relative "openai/models/responses/tool_search_tool"
1368
1376
  require_relative "openai/models/responses/web_search_preview_tool"
1369
1377
  require_relative "openai/models/responses/web_search_tool"
@@ -1559,6 +1567,7 @@ require_relative "openai/resources/containers/files/content"
1559
1567
  require_relative "openai/resources/content_provenance_checks"
1560
1568
  require_relative "openai/resources/conversations"
1561
1569
  require_relative "openai/resources/conversations/items"
1570
+ require_relative "openai/resources/decisions"
1562
1571
  require_relative "openai/resources/embeddings"
1563
1572
  require_relative "openai/resources/evals"
1564
1573
  require_relative "openai/resources/evals/runs"
@@ -29,6 +29,9 @@ module OpenAI
29
29
  sig { returns(T.nilable(String)) }
30
30
  attr_reader :webhook_secret
31
31
 
32
+ sig { returns(OpenAI::Resources::Decisions) }
33
+ attr_reader :decisions
34
+
32
35
  # Given a prompt, the model will return one or more predicted completions, and can
33
36
  # also return the probabilities of alternative tokens at each position.
34
37
  sig { returns(OpenAI::Resources::Completions) }
@@ -33,8 +33,7 @@ module OpenAI
33
33
  # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
34
34
  # voices are available in the
35
35
  # [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
36
- # Custom voices must be created from audio samples. Voices created from text
37
- # prompts are supported only in Live.
36
+ # Custom voices must be created from audio samples.
38
37
  sig {
39
38
  returns(
40
39
  T.any(
@@ -119,8 +118,7 @@ module OpenAI
119
118
  # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
120
119
  # voices are available in the
121
120
  # [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
122
- # Custom voices must be created from audio samples. Voices created from text
123
- # prompts are supported only in Live.
121
+ # Custom voices must be created from audio samples.
124
122
  voice:,
125
123
 
126
124
  # Control the voice of your generated audio with additional instructions. Does not
@@ -184,8 +182,7 @@ module OpenAI
184
182
  # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
185
183
  # voices are available in the
186
184
  # [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
187
- # Custom voices must be created from audio samples. Voices created from text
188
- # prompts are supported only in Live.
185
+ # Custom voices must be created from audio samples.
189
186
  module Voice
190
187
  extend OpenAI::Internal::Type::Union
191
188
 
@@ -30,13 +30,11 @@ module OpenAI
30
30
  sig { returns(Symbol) }
31
31
  attr_accessor :object
32
32
 
33
- # How the voice was created. Voices created from text prompts are supported only
34
- # in Live.
33
+ # How the voice was created.
35
34
  sig { returns(OpenAI::Audio::Voice::Type::TaggedSymbol) }
36
35
  attr_accessor :type
37
36
 
38
- # A custom voice that can be used for audio output. Voices created from text
39
- # prompts are supported only in Live.
37
+ # A custom voice that can be used for audio output.
40
38
  sig do
41
39
  params(
42
40
 
@@ -63,8 +61,7 @@ module OpenAI
63
61
  # The name of the voice.
64
62
  name:,
65
63
 
66
- # How the voice was created. Voices created from text prompts are supported only
67
- # in Live.
64
+ # How the voice was created.
68
65
  type:,
69
66
 
70
67
  # The object type, which is always `audio.voice`.
@@ -87,8 +84,7 @@ module OpenAI
87
84
  def to_hash
88
85
  end
89
86
 
90
- # How the voice was created. Voices created from text prompts are supported only
91
- # in Live.
87
+ # How the voice was created.
92
88
  module Type
93
89
  extend OpenAI::Internal::Type::Enum
94
90
 
@@ -96,7 +92,6 @@ module OpenAI
96
92
  OrSymbol = T.type_alias { T.any(Symbol, String) }
97
93
 
98
94
  AUDIO_SAMPLE = T.let(:audio_sample, OpenAI::Audio::Voice::Type::TaggedSymbol)
99
- PROMPT = T.let(:prompt, OpenAI::Audio::Voice::Type::TaggedSymbol)
100
95
 
101
96
  sig { override.returns(T::Array[OpenAI::Audio::Voice::Type::TaggedSymbol]) }
102
97
  def self.values
@@ -19,20 +19,13 @@ module OpenAI
19
19
 
20
20
  # Creates a voice from a consent recording and an audio sample. Requires
21
21
  # multipart/form-data.
22
- sig {
23
- returns(
24
- T.any(OpenAI::Audio::VoiceCreateParams::Body::AudioSample, OpenAI::Audio::VoiceCreateParams::Body::Prompt)
25
- )
26
- }
22
+ sig { returns(OpenAI::Audio::VoiceCreateParams::Body::AudioSample) }
27
23
  attr_accessor :body
28
24
 
29
25
  sig do
30
26
  params(
31
27
 
32
- body: T.any(
33
- OpenAI::Audio::VoiceCreateParams::Body::AudioSample::OrHash,
34
- OpenAI::Audio::VoiceCreateParams::Body::Prompt::OrHash
35
- ),
28
+ body: OpenAI::Audio::VoiceCreateParams::Body::AudioSample::OrHash,
36
29
 
37
30
  request_options: OpenAI::RequestOptions::OrHash
38
31
  )
@@ -50,13 +43,7 @@ module OpenAI
50
43
 
51
44
  sig do
52
45
  override.returns(
53
- {
54
- body: T.any(
55
- OpenAI::Audio::VoiceCreateParams::Body::AudioSample,
56
- OpenAI::Audio::VoiceCreateParams::Body::Prompt
57
- ),
58
- request_options: OpenAI::RequestOptions
59
- }
46
+ {body: OpenAI::Audio::VoiceCreateParams::Body::AudioSample, request_options: OpenAI::RequestOptions}
60
47
  )
61
48
  end
62
49
  def to_hash
@@ -67,9 +54,7 @@ module OpenAI
67
54
  module Body
68
55
  extend OpenAI::Internal::Type::Union
69
56
 
70
- Variants = T.type_alias {
71
- T.any(OpenAI::Audio::VoiceCreateParams::Body::AudioSample, OpenAI::Audio::VoiceCreateParams::Body::Prompt)
72
- }
57
+ Variants = T.type_alias { OpenAI::Audio::VoiceCreateParams::Body::AudioSample }
73
58
 
74
59
  class AudioSample < OpenAI::Internal::Type::BaseModel
75
60
  OrHash = T.type_alias do
@@ -177,136 +162,6 @@ module OpenAI
177
162
  end
178
163
  end
179
164
 
180
- class Prompt < OpenAI::Internal::Type::BaseModel
181
- OrHash = T.type_alias do
182
- T.any(
183
- OpenAI::Audio::VoiceCreateParams::Body::Prompt,
184
- OpenAI::Internal::AnyHash
185
- )
186
- end
187
-
188
- # The name of the new voice.
189
- sig { returns(String) }
190
- attr_accessor :name
191
-
192
- # A description of the desired voice. Must not contain only whitespace.
193
- sig { returns(String) }
194
- attr_accessor :prompt
195
-
196
- # Set to `prompt` to create a voice from a text description.
197
- sig { returns(OpenAI::Audio::VoiceCreateParams::Body::Prompt::Type::OrSymbol) }
198
- attr_accessor :type
199
-
200
- # The voice creation model to use. Defaults to `auto`.
201
- sig { returns(T.nilable(T.any(String, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::OrSymbol))) }
202
- attr_reader :model
203
-
204
- sig { params(model: T.any(String, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::OrSymbol)).void }
205
- attr_writer :model
206
-
207
- # Optional text for the voice to speak during creation. If omitted, a script is
208
- # generated from the prompt. Must not be blank after trimming whitespace; scripts
209
- # that are too short are rejected.
210
- sig { returns(T.nilable(String)) }
211
- attr_reader :script_hint
212
-
213
- sig { params(script_hint: String).void }
214
- attr_writer :script_hint
215
-
216
- # Creates a synthetic voice from a text description. Supports application/json or
217
- # multipart/form-data.
218
- sig do
219
- params(
220
-
221
- name: String,
222
-
223
- prompt: String,
224
-
225
- type: OpenAI::Audio::VoiceCreateParams::Body::Prompt::Type::OrSymbol,
226
-
227
- model: T.any(String, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::OrSymbol),
228
-
229
- script_hint: String
230
- )
231
- .returns(T.attached_class)
232
- end
233
- def self.new(
234
-
235
- # The name of the new voice.
236
- name:,
237
-
238
- # A description of the desired voice. Must not contain only whitespace.
239
- prompt:,
240
-
241
- # Set to `prompt` to create a voice from a text description.
242
- type:,
243
-
244
- # The voice creation model to use. Defaults to `auto`.
245
- model: nil,
246
-
247
- # Optional text for the voice to speak during creation. If omitted, a script is
248
- # generated from the prompt. Must not be blank after trimming whitespace; scripts
249
- # that are too short are rejected.
250
-
251
- script_hint: nil
252
- )
253
- end
254
-
255
- sig do
256
- override.returns(
257
- {
258
- name: String,
259
- prompt: String,
260
- type: OpenAI::Audio::VoiceCreateParams::Body::Prompt::Type::OrSymbol,
261
- model: T.any(String, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::OrSymbol),
262
- script_hint: String
263
- }
264
- )
265
- end
266
- def to_hash
267
- end
268
-
269
- # Set to `prompt` to create a voice from a text description.
270
- module Type
271
- extend OpenAI::Internal::Type::Enum
272
-
273
- TaggedSymbol = T.type_alias { T.all(Symbol, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Type) }
274
- OrSymbol = T.type_alias { T.any(Symbol, String) }
275
-
276
- PROMPT = T.let(:prompt, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Type::TaggedSymbol)
277
-
278
- sig { override.returns(T::Array[OpenAI::Audio::VoiceCreateParams::Body::Prompt::Type::TaggedSymbol]) }
279
- def self.values
280
- end
281
- end
282
-
283
- # The voice creation model to use. Defaults to `auto`.
284
- module Model
285
- extend OpenAI::Internal::Type::Union
286
-
287
- Variants = T.type_alias {
288
- T.any(String, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::TaggedSymbol)
289
- }
290
-
291
- sig { override.returns(T::Array[OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::Variants]) }
292
- def self.variants
293
- end
294
-
295
- TaggedSymbol = T.type_alias do
296
- T.all(Symbol, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model)
297
- end
298
-
299
- OrSymbol = T.type_alias { T.any(Symbol, String) }
300
-
301
- AUTO = T.let(:auto, OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::TaggedSymbol)
302
- MODEL_2026_10_01 = T.let(
303
- :"2026-10-01",
304
- OpenAI::Audio::VoiceCreateParams::Body::Prompt::Model::TaggedSymbol
305
- )
306
-
307
- end
308
- end
309
-
310
165
  sig { override.returns(T::Array[OpenAI::Audio::VoiceCreateParams::Body::Variants]) }
311
166
  def self.variants
312
167
  end