openai 0.98.0 → 0.99.0

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 (138) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +1 -1
  4. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +16 -3
  5. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +16 -3
  6. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +16 -3
  7. data/lib/openai/models/admin/organization/usage_completions_response.rb +16 -3
  8. data/lib/openai/models/admin/organization/usage_costs_response.rb +16 -3
  9. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +16 -3
  10. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +16 -3
  11. data/lib/openai/models/admin/organization/usage_images_response.rb +16 -3
  12. data/lib/openai/models/admin/organization/usage_moderations_response.rb +16 -3
  13. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +16 -3
  14. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +16 -3
  15. data/lib/openai/models/all_models.rb +42 -0
  16. data/lib/openai/models/audio/speech_create_params.rb +6 -0
  17. data/lib/openai/models/audio/voice.rb +75 -0
  18. data/lib/openai/models/audio/voice_create_params.rb +217 -0
  19. data/lib/openai/models/beta/agent_create_params.rb +0 -3
  20. data/lib/openai/models/beta/agent_update_params.rb +0 -3
  21. data/lib/openai/models/beta/agents/session_create_params.rb +0 -3
  22. data/lib/openai/models/beta/agents/session_update_params.rb +0 -3
  23. data/lib/openai/models/beta/beta_response.rb +220 -0
  24. data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
  25. data/lib/openai/models/beta/beta_tool.rb +3 -9
  26. data/lib/openai/models/beta/response_compact_params.rb +220 -0
  27. data/lib/openai/models/beta/response_create_params.rb +220 -0
  28. data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
  29. data/lib/openai/models/chat_model.rb +178 -0
  30. data/lib/openai/models/image.rb +14 -14
  31. data/lib/openai/models/image_create_variation_params.rb +7 -7
  32. data/lib/openai/models/image_edit_params.rb +76 -87
  33. data/lib/openai/models/image_generate_params.rb +51 -62
  34. data/lib/openai/models/image_model.rb +5 -3
  35. data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
  36. data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
  37. data/lib/openai/models/responses/response_compact_params.rb +220 -0
  38. data/lib/openai/models/responses/tool.rb +3 -9
  39. data/lib/openai/models/responses_model.rb +42 -0
  40. data/lib/openai/models/webhooks/agent_session_action_required_webhook_event.rb +109 -0
  41. data/lib/openai/models/webhooks/agent_session_created_webhook_event.rb +106 -0
  42. data/lib/openai/models/webhooks/agent_session_failed_webhook_event.rb +86 -0
  43. data/lib/openai/models/webhooks/agent_session_idle_webhook_event.rb +86 -0
  44. data/lib/openai/models/webhooks/agent_session_in_progress_webhook_event.rb +86 -0
  45. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +18 -2
  46. data/lib/openai/models/webhooks/webhook_create_params.rb +5 -0
  47. data/lib/openai/models/webhooks/webhook_test_params.rb +5 -0
  48. data/lib/openai/models/webhooks/webhook_update_params.rb +5 -0
  49. data/lib/openai/resources/audio/speech.rb +2 -0
  50. data/lib/openai/resources/audio/voices.rb +53 -0
  51. data/lib/openai/resources/audio.rb +5 -0
  52. data/lib/openai/resources/images.rb +71 -103
  53. data/lib/openai/resources/webhooks.rb +1 -1
  54. data/lib/openai/version.rb +1 -1
  55. data/lib/openai.rb +8 -0
  56. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +19 -2
  57. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +19 -2
  58. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +19 -2
  59. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +19 -2
  60. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +19 -2
  61. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +19 -2
  62. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +19 -2
  63. data/rbi/openai/models/admin/organization/usage_images_response.rbi +19 -2
  64. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +19 -2
  65. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +19 -2
  66. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +19 -2
  67. data/rbi/openai/models/audio/speech_create_params.rbi +6 -0
  68. data/rbi/openai/models/audio/voice.rbi +111 -0
  69. data/rbi/openai/models/audio/voice_create_params.rbi +321 -0
  70. data/rbi/openai/models/beta/agent_create_params.rbi +0 -3
  71. data/rbi/openai/models/beta/agent_update_params.rbi +0 -3
  72. data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -3
  73. data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -3
  74. data/rbi/openai/models/beta/beta_tool.rbi +3 -9
  75. data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
  76. data/rbi/openai/models/image.rbi +14 -14
  77. data/rbi/openai/models/image_create_variation_params.rbi +6 -6
  78. data/rbi/openai/models/image_edit_params.rbi +61 -82
  79. data/rbi/openai/models/image_generate_params.rbi +30 -61
  80. data/rbi/openai/models/image_model.rbi +3 -3
  81. data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +9 -6
  82. data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +9 -6
  83. data/rbi/openai/models/responses/tool.rbi +3 -9
  84. data/rbi/openai/models/webhooks/agent_session_action_required_webhook_event.rbi +222 -0
  85. data/rbi/openai/models/webhooks/agent_session_created_webhook_event.rbi +202 -0
  86. data/rbi/openai/models/webhooks/agent_session_failed_webhook_event.rbi +151 -0
  87. data/rbi/openai/models/webhooks/agent_session_idle_webhook_event.rbi +151 -0
  88. data/rbi/openai/models/webhooks/agent_session_in_progress_webhook_event.rbi +151 -0
  89. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +7 -1
  90. data/rbi/openai/models/webhooks/webhook_create_params.rbi +20 -0
  91. data/rbi/openai/models/webhooks/webhook_test_params.rbi +20 -0
  92. data/rbi/openai/models/webhooks/webhook_update_params.rbi +20 -0
  93. data/rbi/openai/resources/audio/speech.rbi +2 -0
  94. data/rbi/openai/resources/audio/voices.rbi +49 -0
  95. data/rbi/openai/resources/audio.rbi +4 -0
  96. data/rbi/openai/resources/images.rbi +69 -103
  97. data/rbi/openai/resources/webhooks.rbi +5 -0
  98. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +20 -3
  99. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +20 -3
  100. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +20 -3
  101. data/sig/openai/models/admin/organization/usage_completions_response.rbs +20 -3
  102. data/sig/openai/models/admin/organization/usage_costs_response.rbs +20 -3
  103. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +20 -3
  104. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +20 -3
  105. data/sig/openai/models/admin/organization/usage_images_response.rbs +20 -3
  106. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +20 -3
  107. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +20 -3
  108. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +20 -3
  109. data/sig/openai/models/audio/speech_create_params.rbs +4 -0
  110. data/sig/openai/models/audio/voice.rbs +70 -0
  111. data/sig/openai/models/audio/voice_create_params.rbs +203 -0
  112. data/sig/openai/models/beta/agent_create_params.rbs +1 -5
  113. data/sig/openai/models/beta/agent_update_params.rbs +1 -5
  114. data/sig/openai/models/beta/agents/session_create_params.rbs +1 -5
  115. data/sig/openai/models/beta/agents/session_update_params.rbs +1 -5
  116. data/sig/openai/models/beta/beta_tool.rbs +3 -9
  117. data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
  118. data/sig/openai/models/image.rbs +21 -21
  119. data/sig/openai/models/image_create_variation_params.rbs +4 -4
  120. data/sig/openai/models/image_edit_params.rbs +46 -60
  121. data/sig/openai/models/image_generate_params.rbs +23 -45
  122. data/sig/openai/models/image_model.rbs +6 -6
  123. data/sig/openai/models/realtime/realtime_audio_config_output.rbs +9 -6
  124. data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +9 -6
  125. data/sig/openai/models/responses/tool.rbs +3 -9
  126. data/sig/openai/models/webhooks/agent_session_action_required_webhook_event.rbs +114 -0
  127. data/sig/openai/models/webhooks/agent_session_created_webhook_event.rbs +115 -0
  128. data/sig/openai/models/webhooks/agent_session_failed_webhook_event.rbs +89 -0
  129. data/sig/openai/models/webhooks/agent_session_idle_webhook_event.rbs +89 -0
  130. data/sig/openai/models/webhooks/agent_session_in_progress_webhook_event.rbs +89 -0
  131. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +6 -1
  132. data/sig/openai/models/webhooks/webhook_create_params.rbs +10 -0
  133. data/sig/openai/models/webhooks/webhook_test_params.rbs +10 -0
  134. data/sig/openai/models/webhooks/webhook_update_params.rbs +10 -0
  135. data/sig/openai/resources/audio/voices.rbs +14 -0
  136. data/sig/openai/resources/audio.rbs +2 -0
  137. data/sig/openai/resources/webhooks.rbs +6 -1
  138. metadata +25 -1
@@ -0,0 +1,151 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Webhooks
7
+
8
+ class AgentSessionInProgressWebhookEvent < OpenAI::Internal::Type::BaseModel
9
+
10
+ OrHash = T.type_alias do
11
+ T.any(
12
+ OpenAI::Webhooks::AgentSessionInProgressWebhookEvent,
13
+ OpenAI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The unique ID of the event.
18
+ sig { returns(String) }
19
+ attr_accessor :id
20
+
21
+ # The Unix timestamp, in seconds, when the event was created.
22
+ sig { returns(Integer) }
23
+ attr_accessor :created_at
24
+
25
+ sig { returns(OpenAI::Webhooks::AgentSessionInProgressWebhookEvent::Data) }
26
+ attr_reader :data
27
+
28
+ sig { params(data: OpenAI::Webhooks::AgentSessionInProgressWebhookEvent::Data::OrHash).void }
29
+ attr_writer :data
30
+
31
+ # The object type. Always `event`.
32
+ sig { returns(Symbol) }
33
+ attr_accessor :object
34
+
35
+ # The event type. Always `agent.session.in_progress`.
36
+ sig { returns(Symbol) }
37
+ attr_accessor :type
38
+
39
+ # Sent when an agent session enters the in-progress state.
40
+ sig do
41
+ params(
42
+
43
+ id: String,
44
+
45
+ created_at: Integer,
46
+
47
+ data: OpenAI::Webhooks::AgentSessionInProgressWebhookEvent::Data::OrHash,
48
+
49
+ object: Symbol,
50
+
51
+ type: Symbol
52
+ )
53
+ .returns(T.attached_class)
54
+ end
55
+ def self.new(
56
+
57
+ # The unique ID of the event.
58
+ id:,
59
+
60
+ # The Unix timestamp, in seconds, when the event was created.
61
+ created_at:,
62
+
63
+ data:,
64
+
65
+ # The object type. Always `event`.
66
+ object: :event,
67
+
68
+ # The event type. Always `agent.session.in_progress`.
69
+
70
+ type: :"agent.session.in_progress"
71
+ )
72
+ end
73
+
74
+ sig do
75
+ override.returns(
76
+ {
77
+ id: String,
78
+ created_at: Integer,
79
+ data: OpenAI::Webhooks::AgentSessionInProgressWebhookEvent::Data,
80
+ object: Symbol,
81
+ type: Symbol
82
+ }
83
+ )
84
+ end
85
+ def to_hash
86
+ end
87
+
88
+ class Data < OpenAI::Internal::Type::BaseModel
89
+ OrHash = T.type_alias do
90
+ T.any(
91
+ OpenAI::Webhooks::AgentSessionInProgressWebhookEvent::Data,
92
+ OpenAI::Internal::AnyHash
93
+ )
94
+ end
95
+
96
+ # The ID of the session.
97
+ sig { returns(String) }
98
+ attr_accessor :id
99
+
100
+ # The environment type: `none`, `openai_hosted`, or `self_hosted`.
101
+ sig { returns(String) }
102
+ attr_accessor :environment_type
103
+
104
+ # The ID of the environment, when one exists.
105
+ sig { returns(T.nilable(String)) }
106
+ attr_reader :environment_id
107
+
108
+ sig { params(environment_id: String).void }
109
+ attr_writer :environment_id
110
+
111
+ sig do
112
+ params(
113
+
114
+ id: String,
115
+
116
+ environment_type: String,
117
+
118
+ environment_id: String
119
+ )
120
+ .returns(T.attached_class)
121
+ end
122
+ def self.new(
123
+
124
+ # The ID of the session.
125
+ id:,
126
+
127
+ # The environment type: `none`, `openai_hosted`, or `self_hosted`.
128
+ environment_type:,
129
+
130
+ # The ID of the environment, when one exists.
131
+
132
+ environment_id: nil
133
+ )
134
+ end
135
+
136
+ sig do
137
+ override.returns(
138
+ {id: String, environment_type: String, environment_id: String}
139
+ )
140
+ end
141
+ def to_hash
142
+ end
143
+
144
+ end
145
+
146
+ end
147
+
148
+ end
149
+
150
+ end
151
+ end
@@ -5,12 +5,18 @@ module OpenAI
5
5
 
6
6
  module Webhooks
7
7
 
8
- # Sent when a batch API request has been cancelled.
8
+ # Sent when an agent session requires an action. Retrieve the session for action
9
+ # details.
9
10
  module UnwrapWebhookEvent
10
11
  extend OpenAI::Internal::Type::Union
11
12
 
12
13
  Variants = T.type_alias do
13
14
  T.any(
15
+ OpenAI::Webhooks::AgentSessionActionRequiredWebhookEvent,
16
+ OpenAI::Webhooks::AgentSessionCreatedWebhookEvent,
17
+ OpenAI::Webhooks::AgentSessionFailedWebhookEvent,
18
+ OpenAI::Webhooks::AgentSessionIdleWebhookEvent,
19
+ OpenAI::Webhooks::AgentSessionInProgressWebhookEvent,
14
20
  OpenAI::Webhooks::BatchCancelledWebhookEvent,
15
21
  OpenAI::Webhooks::BatchCompletedWebhookEvent,
16
22
  OpenAI::Webhooks::BatchExpiredWebhookEvent,
@@ -121,6 +121,26 @@ module OpenAI
121
121
  )
122
122
  VIDEO_COMPLETED = T.let(:"video.completed", OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol)
123
123
  VIDEO_FAILED = T.let(:"video.failed", OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol)
124
+ AGENT_SESSION_CREATED = T.let(
125
+ :"agent.session.created",
126
+ OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol
127
+ )
128
+ AGENT_SESSION_ACTION_REQUIRED = T.let(
129
+ :"agent.session.action_required",
130
+ OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol
131
+ )
132
+ AGENT_SESSION_IN_PROGRESS = T.let(
133
+ :"agent.session.in_progress",
134
+ OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol
135
+ )
136
+ AGENT_SESSION_IDLE = T.let(
137
+ :"agent.session.idle",
138
+ OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol
139
+ )
140
+ AGENT_SESSION_FAILED = T.let(
141
+ :"agent.session.failed",
142
+ OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol
143
+ )
124
144
  SAFETY_ALERT_CREATED = T.let(
125
145
  :"safety.alert.created",
126
146
  OpenAI::Webhooks::WebhookCreateParams::EventType::TaggedSymbol
@@ -106,6 +106,26 @@ module OpenAI
106
106
  )
107
107
  VIDEO_COMPLETED = T.let(:"video.completed", OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol)
108
108
  VIDEO_FAILED = T.let(:"video.failed", OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol)
109
+ AGENT_SESSION_CREATED = T.let(
110
+ :"agent.session.created",
111
+ OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol
112
+ )
113
+ AGENT_SESSION_ACTION_REQUIRED = T.let(
114
+ :"agent.session.action_required",
115
+ OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol
116
+ )
117
+ AGENT_SESSION_IN_PROGRESS = T.let(
118
+ :"agent.session.in_progress",
119
+ OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol
120
+ )
121
+ AGENT_SESSION_IDLE = T.let(
122
+ :"agent.session.idle",
123
+ OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol
124
+ )
125
+ AGENT_SESSION_FAILED = T.let(
126
+ :"agent.session.failed",
127
+ OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol
128
+ )
109
129
  SAFETY_ALERT_CREATED = T.let(
110
130
  :"safety.alert.created",
111
131
  OpenAI::Webhooks::WebhookTestParams::EventType::TaggedSymbol
@@ -138,6 +138,26 @@ module OpenAI
138
138
  )
139
139
  VIDEO_COMPLETED = T.let(:"video.completed", OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol)
140
140
  VIDEO_FAILED = T.let(:"video.failed", OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol)
141
+ AGENT_SESSION_CREATED = T.let(
142
+ :"agent.session.created",
143
+ OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol
144
+ )
145
+ AGENT_SESSION_ACTION_REQUIRED = T.let(
146
+ :"agent.session.action_required",
147
+ OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol
148
+ )
149
+ AGENT_SESSION_IN_PROGRESS = T.let(
150
+ :"agent.session.in_progress",
151
+ OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol
152
+ )
153
+ AGENT_SESSION_IDLE = T.let(
154
+ :"agent.session.idle",
155
+ OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol
156
+ )
157
+ AGENT_SESSION_FAILED = T.let(
158
+ :"agent.session.failed",
159
+ OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol
160
+ )
141
161
  SAFETY_ALERT_CREATED = T.let(
142
162
  :"safety.alert.created",
143
163
  OpenAI::Webhooks::WebhookUpdateParams::EventType::TaggedSymbol
@@ -41,6 +41,8 @@ module OpenAI
41
41
  # object with an `id`, for example `{ "id": "voice_1234" }`. Previews of the
42
42
  # voices are available in the
43
43
  # [Text to speech guide](https://developers.openai.com/api/docs/guides/text-to-speech#voice-options).
44
+ # Custom voices must be created from audio samples. Voices created from text
45
+ # prompts are supported only in Live.
44
46
  voice:,
45
47
  # Control the voice of your generated audio with additional instructions. Does not
46
48
  # work with `tts-1` or `tts-1-hd`.
@@ -0,0 +1,49 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+
6
+ class Audio
7
+
8
+ # Turn audio into text or text into audio.
9
+ class Voices
10
+
11
+ # Creates a voice from a text prompt or from a consent recording and an audio
12
+ # sample.
13
+ #
14
+ # For prompt-based creation, send `type: "prompt"` with a `name` and `prompt` as
15
+ # JSON or multipart form data. For creation from an audio sample, send
16
+ # `type: "audio_sample"` with a `name`, `audio_sample`, and `consent` recording ID
17
+ # as multipart form data. The type defaults to `audio_sample` when omitted.
18
+ #
19
+ # Returns the saved voice's metadata. Voices created from text prompts are
20
+ # supported only in Live, not in Realtime or the speech endpoint. The response
21
+ # does not include preview audio.
22
+ sig {
23
+ params(
24
+ body: T.any(
25
+ OpenAI::Audio::VoiceCreateParams::Body::AudioSample::OrHash,
26
+ OpenAI::Audio::VoiceCreateParams::Body::Prompt::OrHash
27
+ ),
28
+ request_options: OpenAI::RequestOptions::OrHash
29
+ )
30
+ .returns(OpenAI::Audio::Voice)
31
+ }
32
+ def create(
33
+ # Creates a voice from a consent recording and an audio sample. Requires
34
+ # multipart/form-data.
35
+ body:,
36
+ request_options: {}
37
+ )
38
+ end
39
+
40
+ # @api private
41
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
42
+ def self.new(client:)
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ end
49
+ end
@@ -17,6 +17,10 @@ module OpenAI
17
17
  sig { returns(OpenAI::Resources::Audio::Speech) }
18
18
  attr_reader :speech
19
19
 
20
+ # Turn audio into text or text into audio.
21
+ sig { returns(OpenAI::Resources::Audio::Voices) }
22
+ attr_reader :voices
23
+
20
24
  # @api private
21
25
  sig { params(client: OpenAI::Client).returns(T.attached_class) }
22
26
  def self.new(client:)