openai 0.88.0 → 0.89.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 (239) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +12 -0
  3. data/README.md +1 -1
  4. data/lib/openai/client.rb +4 -0
  5. data/lib/openai/models/beta/beta_response_input_item.rb +91 -1
  6. data/lib/openai/models/beta/beta_response_item.rb +93 -1
  7. data/lib/openai/models/beta/beta_response_output_item.rb +91 -1
  8. data/lib/openai/models/conversations/conversation_item.rb +91 -1
  9. data/lib/openai/models/live/audio_format.rb +109 -0
  10. data/lib/openai/models/live/built_in_voice.rb +38 -0
  11. data/lib/openai/models/live/client_config.rb +22 -0
  12. data/lib/openai/models/live/client_delegation.rb +22 -0
  13. data/lib/openai/models/live/client_event.rb +54 -0
  14. data/lib/openai/models/live/commentary_append_event.rb +59 -0
  15. data/lib/openai/models/live/commentary_appended_event.rb +65 -0
  16. data/lib/openai/models/live/custom_voice.rb +17 -0
  17. data/lib/openai/models/live/data_channel_config.rb +81 -0
  18. data/lib/openai/models/live/delegation_created_event.rb +140 -0
  19. data/lib/openai/models/live/error.rb +60 -0
  20. data/lib/openai/models/live/error_event.rb +52 -0
  21. data/lib/openai/models/live/fork_client_event.rb +53 -0
  22. data/lib/openai/models/live/fork_server_event.rb +295 -0
  23. data/lib/openai/models/live/fork_session_config.rb +107 -0
  24. data/lib/openai/models/live/fork_session_start_event.rb +48 -0
  25. data/lib/openai/models/live/function_tool.rb +60 -0
  26. data/lib/openai/models/live/info_event.rb +60 -0
  27. data/lib/openai/models/live/initial_item.rb +419 -0
  28. data/lib/openai/models/live/input_audio_append_event.rb +50 -0
  29. data/lib/openai/models/live/input_audio_mute_event.rb +33 -0
  30. data/lib/openai/models/live/input_audio_muted_event.rb +42 -0
  31. data/lib/openai/models/live/input_audio_unmute_event.rb +33 -0
  32. data/lib/openai/models/live/input_audio_unmuted_event.rb +42 -0
  33. data/lib/openai/models/live/input_transcript_delta_event.rb +76 -0
  34. data/lib/openai/models/live/instructions_append_event.rb +57 -0
  35. data/lib/openai/models/live/instructions_appended_event.rb +65 -0
  36. data/lib/openai/models/live/live_create_params.rb +57 -0
  37. data/lib/openai/models/live/live_create_response.rb +77 -0
  38. data/lib/openai/models/live/media_session_config.rb +227 -0
  39. data/lib/openai/models/live/media_session_fork_config.rb +75 -0
  40. data/lib/openai/models/live/output_audio_delta_event.rb +58 -0
  41. data/lib/openai/models/live/output_transcript_delta_event.rb +76 -0
  42. data/lib/openai/models/live/response_create_event.rb +33 -0
  43. data/lib/openai/models/live/response_event.rb +67 -0
  44. data/lib/openai/models/live/response_item_create_event.rb +44 -0
  45. data/lib/openai/models/live/responses_delegation_config.rb +332 -0
  46. data/lib/openai/models/live/responses_delegation_update_config.rb +332 -0
  47. data/lib/openai/models/live/server_event.rb +295 -0
  48. data/lib/openai/models/live/server_event_selector.rb +32 -0
  49. data/lib/openai/models/live/session_accept_params.rb +257 -0
  50. data/lib/openai/models/live/session_close_event.rb +33 -0
  51. data/lib/openai/models/live/session_closed_event.rb +113 -0
  52. data/lib/openai/models/live/session_config.rb +236 -0
  53. data/lib/openai/models/live/session_download_recording_params.rb +27 -0
  54. data/lib/openai/models/live/session_fork_params.rb +66 -0
  55. data/lib/openai/models/live/session_fork_response.rb +77 -0
  56. data/lib/openai/models/live/session_hangup_params.rb +22 -0
  57. data/lib/openai/models/live/session_refer_params.rb +34 -0
  58. data/lib/openai/models/live/session_reject_params.rb +32 -0
  59. data/lib/openai/models/live/session_resource.rb +268 -0
  60. data/lib/openai/models/live/session_start_event.rb +46 -0
  61. data/lib/openai/models/live/session_started_event.rb +51 -0
  62. data/lib/openai/models/live/session_update_config.rb +69 -0
  63. data/lib/openai/models/live/session_update_event.rb +46 -0
  64. data/lib/openai/models/live/session_updated_event.rb +51 -0
  65. data/lib/openai/models/live/session_usage.rb +24 -0
  66. data/lib/openai/models/live/session_usage_updated_event.rb +81 -0
  67. data/lib/openai/models/live/thinking_append_event.rb +59 -0
  68. data/lib/openai/models/live/thinking_appended_event.rb +65 -0
  69. data/lib/openai/models/responses/response_input_item.rb +91 -1
  70. data/lib/openai/models/responses/response_item.rb +93 -1
  71. data/lib/openai/models/responses/response_output_item.rb +91 -1
  72. data/lib/openai/models/webhooks/live_call_incoming_webhook_event.rb +12 -7
  73. data/lib/openai/models/webhooks/live_transport_incoming_webhook_event.rb +137 -0
  74. data/lib/openai/models/webhooks/realtime_call_incoming_webhook_event.rb +4 -4
  75. data/lib/openai/models/webhooks/unwrap_webhook_event.rb +9 -2
  76. data/lib/openai/models.rb +2 -0
  77. data/lib/openai/resources/live/forks.rb +16 -0
  78. data/lib/openai/resources/live/sessions.rb +180 -0
  79. data/lib/openai/resources/live/sideband.rb +16 -0
  80. data/lib/openai/resources/live.rb +54 -0
  81. data/lib/openai/resources/webhooks.rb +1 -1
  82. data/lib/openai/version.rb +1 -1
  83. data/lib/openai.rb +65 -0
  84. data/rbi/openai/client.rbi +3 -0
  85. data/rbi/openai/models/beta/beta_response_input_item.rbi +109 -0
  86. data/rbi/openai/models/beta/beta_response_item.rbi +105 -0
  87. data/rbi/openai/models/beta/beta_response_output_item.rbi +119 -0
  88. data/rbi/openai/models/conversations/conversation_item.rbi +133 -0
  89. data/rbi/openai/models/live/audio_format.rbi +185 -0
  90. data/rbi/openai/models/live/built_in_voice.rbi +46 -0
  91. data/rbi/openai/models/live/client_config.rbi +54 -0
  92. data/rbi/openai/models/live/client_delegation.rbi +51 -0
  93. data/rbi/openai/models/live/client_event.rbi +41 -0
  94. data/rbi/openai/models/live/commentary_append_event.rbi +88 -0
  95. data/rbi/openai/models/live/commentary_appended_event.rbi +97 -0
  96. data/rbi/openai/models/live/custom_voice.rbi +46 -0
  97. data/rbi/openai/models/live/data_channel_config.rbi +119 -0
  98. data/rbi/openai/models/live/delegation_created_event.rbi +207 -0
  99. data/rbi/openai/models/live/error.rbi +95 -0
  100. data/rbi/openai/models/live/error_event.rbi +87 -0
  101. data/rbi/openai/models/live/fork_client_event.rbi +40 -0
  102. data/rbi/openai/models/live/fork_server_event.rbi +436 -0
  103. data/rbi/openai/models/live/fork_session_config.rbi +234 -0
  104. data/rbi/openai/models/live/fork_session_start_event.rbi +80 -0
  105. data/rbi/openai/models/live/function_tool.rbi +95 -0
  106. data/rbi/openai/models/live/info_event.rbi +92 -0
  107. data/rbi/openai/models/live/initial_item.rbi +661 -0
  108. data/rbi/openai/models/live/input_audio_append_event.rbi +79 -0
  109. data/rbi/openai/models/live/input_audio_mute_event.rbi +62 -0
  110. data/rbi/openai/models/live/input_audio_muted_event.rbi +74 -0
  111. data/rbi/openai/models/live/input_audio_unmute_event.rbi +62 -0
  112. data/rbi/openai/models/live/input_audio_unmuted_event.rbi +74 -0
  113. data/rbi/openai/models/live/input_transcript_delta_event.rbi +115 -0
  114. data/rbi/openai/models/live/instructions_append_event.rbi +86 -0
  115. data/rbi/openai/models/live/instructions_appended_event.rbi +97 -0
  116. data/rbi/openai/models/live/live_create_params.rbi +121 -0
  117. data/rbi/openai/models/live/live_create_response.rbi +160 -0
  118. data/rbi/openai/models/live/media_session_config.rbi +390 -0
  119. data/rbi/openai/models/live/media_session_fork_config.rbi +143 -0
  120. data/rbi/openai/models/live/output_audio_delta_event.rbi +93 -0
  121. data/rbi/openai/models/live/output_transcript_delta_event.rbi +115 -0
  122. data/rbi/openai/models/live/response_create_event.rbi +62 -0
  123. data/rbi/openai/models/live/response_event.rbi +105 -0
  124. data/rbi/openai/models/live/response_item_create_event.rbi +183 -0
  125. data/rbi/openai/models/live/responses_delegation_config.rbi +562 -0
  126. data/rbi/openai/models/live/responses_delegation_update_config.rbi +585 -0
  127. data/rbi/openai/models/live/server_event.rbi +436 -0
  128. data/rbi/openai/models/live/server_event_selector.rbi +64 -0
  129. data/rbi/openai/models/live/session_accept_params.rbi +451 -0
  130. data/rbi/openai/models/live/session_close_event.rbi +62 -0
  131. data/rbi/openai/models/live/session_closed_event.rbi +148 -0
  132. data/rbi/openai/models/live/session_config.rbi +427 -0
  133. data/rbi/openai/models/live/session_download_recording_params.rbi +57 -0
  134. data/rbi/openai/models/live/session_fork_params.rbi +131 -0
  135. data/rbi/openai/models/live/session_fork_response.rbi +160 -0
  136. data/rbi/openai/models/live/session_hangup_params.rbi +53 -0
  137. data/rbi/openai/models/live/session_refer_params.rbi +64 -0
  138. data/rbi/openai/models/live/session_reject_params.rbi +62 -0
  139. data/rbi/openai/models/live/session_resource.rbi +461 -0
  140. data/rbi/openai/models/live/session_start_event.rbi +78 -0
  141. data/rbi/openai/models/live/session_started_event.rbi +86 -0
  142. data/rbi/openai/models/live/session_update_config.rbi +134 -0
  143. data/rbi/openai/models/live/session_update_event.rbi +78 -0
  144. data/rbi/openai/models/live/session_updated_event.rbi +86 -0
  145. data/rbi/openai/models/live/session_usage.rbi +53 -0
  146. data/rbi/openai/models/live/session_usage_updated_event.rbi +148 -0
  147. data/rbi/openai/models/live/thinking_append_event.rbi +88 -0
  148. data/rbi/openai/models/live/thinking_appended_event.rbi +97 -0
  149. data/rbi/openai/models/responses/response_input_item.rbi +113 -0
  150. data/rbi/openai/models/responses/response_item.rbi +105 -0
  151. data/rbi/openai/models/responses/response_output_item.rbi +125 -0
  152. data/rbi/openai/models/webhooks/live_call_incoming_webhook_event.rbi +11 -7
  153. data/rbi/openai/models/webhooks/live_transport_incoming_webhook_event.rbi +226 -0
  154. data/rbi/openai/models/webhooks/realtime_call_incoming_webhook_event.rbi +4 -4
  155. data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +1 -0
  156. data/rbi/openai/models.rbi +2 -0
  157. data/rbi/openai/resources/live/forks.rbi +19 -0
  158. data/rbi/openai/resources/live/sessions.rbi +110 -0
  159. data/rbi/openai/resources/live/sideband.rbi +19 -0
  160. data/rbi/openai/resources/live.rbi +43 -0
  161. data/rbi/openai/resources/responses.rbi +75 -38
  162. data/rbi/openai/resources/webhooks.rbi +1 -0
  163. data/sig/openai/client.rbs +2 -0
  164. data/sig/openai/models/beta/beta_response_input_item.rbs +56 -0
  165. data/sig/openai/models/beta/beta_response_item.rbs +56 -0
  166. data/sig/openai/models/beta/beta_response_output_item.rbs +56 -0
  167. data/sig/openai/models/conversations/conversation_item.rbs +56 -0
  168. data/sig/openai/models/live/audio_format.rbs +73 -0
  169. data/sig/openai/models/live/built_in_voice.rbs +58 -0
  170. data/sig/openai/models/live/client_config.rbs +15 -0
  171. data/sig/openai/models/live/client_delegation.rbs +15 -0
  172. data/sig/openai/models/live/client_event.rbs +24 -0
  173. data/sig/openai/models/live/commentary_append_event.rbs +37 -0
  174. data/sig/openai/models/live/commentary_appended_event.rbs +44 -0
  175. data/sig/openai/models/live/custom_voice.rbs +15 -0
  176. data/sig/openai/models/live/data_channel_config.rbs +56 -0
  177. data/sig/openai/models/live/delegation_created_event.rbs +89 -0
  178. data/sig/openai/models/live/error.rbs +46 -0
  179. data/sig/openai/models/live/error_event.rbs +39 -0
  180. data/sig/openai/models/live/fork_client_event.rbs +24 -0
  181. data/sig/openai/models/live/fork_server_event.rbs +212 -0
  182. data/sig/openai/models/live/fork_session_config.rbs +89 -0
  183. data/sig/openai/models/live/fork_session_start_event.rbs +32 -0
  184. data/sig/openai/models/live/function_tool.rbs +42 -0
  185. data/sig/openai/models/live/info_event.rbs +44 -0
  186. data/sig/openai/models/live/initial_item.rbs +332 -0
  187. data/sig/openai/models/live/input_audio_append_event.rbs +32 -0
  188. data/sig/openai/models/live/input_audio_mute_event.rbs +24 -0
  189. data/sig/openai/models/live/input_audio_muted_event.rbs +34 -0
  190. data/sig/openai/models/live/input_audio_unmute_event.rbs +24 -0
  191. data/sig/openai/models/live/input_audio_unmuted_event.rbs +34 -0
  192. data/sig/openai/models/live/input_transcript_delta_event.rbs +49 -0
  193. data/sig/openai/models/live/instructions_append_event.rbs +37 -0
  194. data/sig/openai/models/live/instructions_appended_event.rbs +44 -0
  195. data/sig/openai/models/live/live_create_params.rbs +45 -0
  196. data/sig/openai/models/live/live_create_response.rbs +49 -0
  197. data/sig/openai/models/live/media_session_config.rbs +157 -0
  198. data/sig/openai/models/live/media_session_fork_config.rbs +66 -0
  199. data/sig/openai/models/live/output_audio_delta_event.rbs +41 -0
  200. data/sig/openai/models/live/output_transcript_delta_event.rbs +49 -0
  201. data/sig/openai/models/live/response_create_event.rbs +18 -0
  202. data/sig/openai/models/live/response_event.rbs +44 -0
  203. data/sig/openai/models/live/response_item_create_event.rbs +32 -0
  204. data/sig/openai/models/live/responses_delegation_config.rbs +244 -0
  205. data/sig/openai/models/live/responses_delegation_update_config.rbs +246 -0
  206. data/sig/openai/models/live/server_event.rbs +212 -0
  207. data/sig/openai/models/live/server_event_selector.rbs +19 -0
  208. data/sig/openai/models/live/session_accept_params.rbs +185 -0
  209. data/sig/openai/models/live/session_close_event.rbs +17 -0
  210. data/sig/openai/models/live/session_closed_event.rbs +68 -0
  211. data/sig/openai/models/live/session_config.rbs +168 -0
  212. data/sig/openai/models/live/session_download_recording_params.rbs +25 -0
  213. data/sig/openai/models/live/session_fork_params.rbs +54 -0
  214. data/sig/openai/models/live/session_fork_response.rbs +49 -0
  215. data/sig/openai/models/live/session_hangup_params.rbs +25 -0
  216. data/sig/openai/models/live/session_refer_params.rbs +33 -0
  217. data/sig/openai/models/live/session_reject_params.rbs +33 -0
  218. data/sig/openai/models/live/session_resource.rbs +183 -0
  219. data/sig/openai/models/live/session_start_event.rbs +32 -0
  220. data/sig/openai/models/live/session_started_event.rbs +39 -0
  221. data/sig/openai/models/live/session_update_config.rbs +56 -0
  222. data/sig/openai/models/live/session_update_event.rbs +32 -0
  223. data/sig/openai/models/live/session_updated_event.rbs +39 -0
  224. data/sig/openai/models/live/session_usage.rbs +15 -0
  225. data/sig/openai/models/live/session_usage_updated_event.rbs +58 -0
  226. data/sig/openai/models/live/thinking_append_event.rbs +37 -0
  227. data/sig/openai/models/live/thinking_appended_event.rbs +44 -0
  228. data/sig/openai/models/responses/response_input_item.rbs +56 -0
  229. data/sig/openai/models/responses/response_item.rbs +56 -0
  230. data/sig/openai/models/responses/response_output_item.rbs +56 -0
  231. data/sig/openai/models/webhooks/live_transport_incoming_webhook_event.rbs +95 -0
  232. data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +1 -0
  233. data/sig/openai/models.rbs +2 -0
  234. data/sig/openai/resources/live/forks.rbs +9 -0
  235. data/sig/openai/resources/live/sessions.rbs +44 -0
  236. data/sig/openai/resources/live/sideband.rbs +9 -0
  237. data/sig/openai/resources/live.rbs +19 -0
  238. data/sig/openai/resources/webhooks.rbs +1 -0
  239. metadata +196 -1
@@ -0,0 +1,109 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ # Audio encoding and sample rate for audio sent and received over a Live WebSocket
7
+ # connection. WebRTC and SIP negotiate their media format separately.
8
+ module AudioFormat
9
+ extend OpenAI::Internal::Type::Union
10
+
11
+ discriminator :type
12
+
13
+ # Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection.
14
+ variant :"audio/pcm", -> { OpenAI::Live::AudioFormat::AudioPCM }
15
+
16
+ # Raw, mono G.711 μ-law audio for a Live WebSocket connection.
17
+ variant :"audio/pcmu", -> { OpenAI::Live::AudioFormat::AudioPCMU }
18
+
19
+ # Raw, mono G.711 A-law audio for a Live WebSocket connection.
20
+ variant :"audio/pcma", -> { OpenAI::Live::AudioFormat::AudioPCMA }
21
+
22
+ class AudioPCM < OpenAI::Internal::Type::BaseModel
23
+ # @!attribute rate
24
+ # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz.
25
+ #
26
+ # @return [Integer, OpenAI::Models::Live::AudioFormat::AudioPCM::Rate]
27
+ required :rate, enum: -> { OpenAI::Live::AudioFormat::AudioPCM::Rate }
28
+
29
+ # @!attribute type
30
+ # The audio encoding. Always `audio/pcm`.
31
+ #
32
+ # @return [Symbol, :"audio/pcm"]
33
+ required :type, const: :"audio/pcm"
34
+
35
+ # @!method initialize(rate:, type: :"audio/pcm")
36
+ # Raw, mono 16-bit little-endian PCM audio for a Live WebSocket connection.
37
+ #
38
+ # @param rate [Integer, OpenAI::Models::Live::AudioFormat::AudioPCM::Rate]
39
+ # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz.
40
+ #
41
+ # @param type [Symbol, :"audio/pcm"]
42
+ # The audio encoding. Always `audio/pcm`.
43
+
44
+ # Audio sample rate in hertz. Live WebSocket PCM audio supports 16000 or 24000 Hz.
45
+ #
46
+ # @see OpenAI::Models::Live::AudioFormat::AudioPCM#rate
47
+ module Rate
48
+ extend OpenAI::Internal::Type::Enum
49
+
50
+ RATE_16000 = 16_000
51
+ RATE_24000 = 24_000
52
+
53
+ # @!method self.values
54
+ # @return [Array<Integer>]
55
+ end
56
+ end
57
+
58
+ class AudioPCMU < OpenAI::Internal::Type::BaseModel
59
+ # @!attribute rate
60
+ # Audio sample rate in hertz. G.711 audio uses 8000 Hz.
61
+ #
62
+ # @return [Integer]
63
+ required :rate, Integer
64
+
65
+ # @!attribute type
66
+ # The audio encoding. Always `audio/pcmu`.
67
+ #
68
+ # @return [Symbol, :"audio/pcmu"]
69
+ required :type, const: :"audio/pcmu"
70
+
71
+ # @!method initialize(rate:, type: :"audio/pcmu")
72
+ # Raw, mono G.711 μ-law audio for a Live WebSocket connection.
73
+ #
74
+ # @param rate [Integer]
75
+ # Audio sample rate in hertz. G.711 audio uses 8000 Hz.
76
+ #
77
+ # @param type [Symbol, :"audio/pcmu"]
78
+ # The audio encoding. Always `audio/pcmu`.
79
+ end
80
+
81
+ class AudioPCMA < OpenAI::Internal::Type::BaseModel
82
+ # @!attribute rate
83
+ # Audio sample rate in hertz. G.711 audio uses 8000 Hz.
84
+ #
85
+ # @return [Integer]
86
+ required :rate, Integer
87
+
88
+ # @!attribute type
89
+ # The audio encoding. Always `audio/pcma`.
90
+ #
91
+ # @return [Symbol, :"audio/pcma"]
92
+ required :type, const: :"audio/pcma"
93
+
94
+ # @!method initialize(rate:, type: :"audio/pcma")
95
+ # Raw, mono G.711 A-law audio for a Live WebSocket connection.
96
+ #
97
+ # @param rate [Integer]
98
+ # Audio sample rate in hertz. G.711 audio uses 8000 Hz.
99
+ #
100
+ # @param type [Symbol, :"audio/pcma"]
101
+ # The audio encoding. Always `audio/pcma`.
102
+ end
103
+
104
+ # @!method self.variants
105
+ # @return [Array(OpenAI::Models::Live::AudioFormat::AudioPCM, OpenAI::Models::Live::AudioFormat::AudioPCMU, OpenAI::Models::Live::AudioFormat::AudioPCMA)]
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ # A built-in voice available for Live speech.
7
+ module BuiltInVoice
8
+ extend OpenAI::Internal::Type::Enum
9
+
10
+ ALLOY = :alloy
11
+ ASH = :ash
12
+ BALLAD = :ballad
13
+ BEACON = :beacon
14
+ BOSSA = :bossa
15
+ CEDAR = :cedar
16
+ CINDER = :cinder
17
+ CORAL = :coral
18
+ DELTA = :delta
19
+ ECHO = :echo
20
+ GLEAM = :gleam
21
+ MARIN = :marin
22
+ MERIDIAN = :meridian
23
+ QUARTZ = :quartz
24
+ RIPPLE = :ripple
25
+ SAGE = :sage
26
+ SHIMMER = :shimmer
27
+ STONE = :stone
28
+ TEMPO = :tempo
29
+ VERSE = :verse
30
+ VESPER = :vesper
31
+ WILLOW = :willow
32
+
33
+ # @!method self.values
34
+ # @return [Array<Symbol>]
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class ClientConfig < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute data_channel
8
+ # Client and server event permissions for the WebRTC frontend data channel.
9
+ #
10
+ # @return [OpenAI::Models::Live::DataChannelConfig]
11
+ required :data_channel, -> { OpenAI::Live::DataChannelConfig }
12
+
13
+ # @!method initialize(data_channel:)
14
+ # Startup-only capabilities for an untrusted frontend attached to a unified WebRTC
15
+ # session. Trusted sideband connections are unaffected.
16
+ #
17
+ # @param data_channel [OpenAI::Models::Live::DataChannelConfig]
18
+ # Client and server event permissions for the WebRTC frontend data channel.
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class ClientDelegation < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute type
8
+ # The delegation owner. Always `client` for tasks handled by your application.
9
+ #
10
+ # @return [Symbol, :client]
11
+ required :type, const: :client
12
+
13
+ # @!method initialize(type: :client)
14
+ # Delegate tasks to your application. The Live session emits delegation events
15
+ # that your backend handles.
16
+ #
17
+ # @param type [Symbol, :client]
18
+ # The delegation owner. Always `client` for tasks handled by your application.
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,54 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ # Client events for Live. Initialize a primary WebSocket with session.start and
7
+ # wait for session.started. WebRTC creation already starts the session. Audio
8
+ # append is primary WebSocket-only. See the
9
+ # [Live prompting guide](https://developers.openai.com/api/docs/guides/live-prompting)
10
+ # before writing frontend instructions and delegation policies.
11
+ module ClientEvent
12
+ extend OpenAI::Internal::Type::Union
13
+
14
+ discriminator :type
15
+
16
+ # Start a Live session on a primary WebSocket. Send this event before other commands and wait for `session.started`.
17
+ variant :"session.start", -> { OpenAI::Live::SessionStartEvent }
18
+
19
+ # Update the delegation settings of an active Live session. The server acknowledges accepted changes with `session.updated`.
20
+ variant :"session.update", -> { OpenAI::Live::SessionUpdateEvent }
21
+
22
+ # Send audio to a Live session over its primary WebSocket. WebRTC and SIP sessions send audio over their media transport.
23
+ variant :"session.input_audio.append", -> { OpenAI::Live::InputAudioAppendEvent }
24
+
25
+ # Mute audio input to the Live model without closing the session. The server acknowledges with `session.input_audio.muted`.
26
+ variant :"session.input_audio.mute", -> { OpenAI::Live::InputAudioMuteEvent }
27
+
28
+ # Resume audio input to a Live model after muting it. The server acknowledges with `session.input_audio.unmuted`.
29
+ variant :"session.input_audio.unmute", -> { OpenAI::Live::InputAudioUnmuteEvent }
30
+
31
+ # Append instructions to the Live conversation while it is running, optionally associating them with an existing client delegation.
32
+ variant :"session.instructions.append", -> { OpenAI::Live::InstructionsAppendEvent }
33
+
34
+ # Provide silent reasoning or progress context to the Live model, optionally for an existing client delegation.
35
+ variant :"session.thinking.append", -> { OpenAI::Live::ThinkingAppendEvent }
36
+
37
+ # Provide context the Live model can communicate to the user, optionally for an existing client delegation.
38
+ variant :"session.commentary.append", -> { OpenAI::Live::CommentaryAppendEvent }
39
+
40
+ # Add an input item to the Live session’s Responses backend. Requires Responses delegation; use `response.create` to request a response.
41
+ variant :"response.item.create", -> { OpenAI::Live::ResponseItemCreateEvent }
42
+
43
+ # Request a response from the Live session’s Responses backend, or continue a delegated response waiting for tool results. Requires Responses delegation.
44
+ variant :"response.create", -> { OpenAI::Live::ResponseCreateEvent }
45
+
46
+ # Request that the Live session close. The terminal `session.closed` event contains the close reason and final usage.
47
+ variant :"session.close", -> { OpenAI::Live::SessionCloseEvent }
48
+
49
+ # @!method self.variants
50
+ # @return [Array(OpenAI::Models::Live::SessionStartEvent, OpenAI::Models::Live::SessionUpdateEvent, OpenAI::Models::Live::InputAudioAppendEvent, OpenAI::Models::Live::InputAudioMuteEvent, OpenAI::Models::Live::InputAudioUnmuteEvent, OpenAI::Models::Live::InstructionsAppendEvent, OpenAI::Models::Live::ThinkingAppendEvent, OpenAI::Models::Live::CommentaryAppendEvent, OpenAI::Models::Live::ResponseItemCreateEvent, OpenAI::Models::Live::ResponseCreateEvent, OpenAI::Models::Live::SessionCloseEvent)]
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class CommentaryAppendEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute content
8
+ # Speakable context for the Live model, limited to 500 tokens. Use this for a
9
+ # result the model should communicate; use session.thinking.append for silent
10
+ # context.
11
+ #
12
+ # @return [String]
13
+ required :content, String
14
+
15
+ # @!attribute delegation_id
16
+ # Required, nullable. Set null for general session context, or use the ID from
17
+ # session.delegation.created for an existing client delegation. Non-null IDs are
18
+ # not accepted with Responses delegation.
19
+ #
20
+ # @return [String, nil]
21
+ required :delegation_id, String, nil?: true
22
+
23
+ # @!attribute type
24
+ # The Live client event type. Always `session.commentary.append`.
25
+ #
26
+ # @return [Symbol, :"session.commentary.append"]
27
+ required :type, const: :"session.commentary.append"
28
+
29
+ # @!attribute event_id
30
+ # Optional client identifier for correlating this command with a server event's
31
+ # client_event_id or error.client_event_id.
32
+ #
33
+ # @return [String, nil]
34
+ optional :event_id, String, nil?: true
35
+
36
+ # @!method initialize(content:, delegation_id:, event_id: nil, type: :"session.commentary.append")
37
+ # Provide context the Live model can communicate to the user, optionally for an
38
+ # existing client delegation.
39
+ #
40
+ # @param content [String]
41
+ # Speakable context for the Live model, limited to 500 tokens. Use this for a
42
+ # result the model should communicate; use session.thinking.append for silent
43
+ # context.
44
+ #
45
+ # @param delegation_id [String, nil]
46
+ # Required, nullable. Set null for general session context, or use the ID from
47
+ # session.delegation.created for an existing client delegation. Non-null IDs are
48
+ # not accepted with Responses delegation.
49
+ #
50
+ # @param event_id [String, nil]
51
+ # Optional client identifier for correlating this command with a server event's
52
+ # client_event_id or error.client_event_id.
53
+ #
54
+ # @param type [Symbol, :"session.commentary.append"]
55
+ # The Live client event type. Always `session.commentary.append`.
56
+ end
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class CommentaryAppendedEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute end_ms
8
+ # The end of this event on the Live session timeline, in milliseconds from the
9
+ # beginning of the session. For appended context, this can equal start_ms.
10
+ #
11
+ # @return [Integer]
12
+ required :end_ms, Integer
13
+
14
+ # @!attribute event_id
15
+ # The unique ID of the Live server event.
16
+ #
17
+ # @return [String]
18
+ required :event_id, String
19
+
20
+ # @!attribute start_ms
21
+ # The start of this event on the Live session timeline, in milliseconds from the
22
+ # beginning of the session.
23
+ #
24
+ # @return [Integer]
25
+ required :start_ms, Integer
26
+
27
+ # @!attribute type
28
+ # The event type, always `session.commentary.appended`.
29
+ #
30
+ # @return [Symbol, :"session.commentary.appended"]
31
+ required :type, const: :"session.commentary.appended"
32
+
33
+ # @!attribute client_event_id
34
+ # The event_id of the client command associated with this server event, when
35
+ # supplied.
36
+ #
37
+ # @return [String, nil]
38
+ optional :client_event_id, String
39
+
40
+ # @!method initialize(end_ms:, event_id:, start_ms:, client_event_id: nil, type: :"session.commentary.appended")
41
+ # Returned when a session.commentary.append command is accepted into the Live
42
+ # session timeline. Acknowledges the added commentary without guaranteeing exact
43
+ # wording or completed audio playback.
44
+ #
45
+ # @param end_ms [Integer]
46
+ # The end of this event on the Live session timeline, in milliseconds from the
47
+ # beginning of the session. For appended context, this can equal start_ms.
48
+ #
49
+ # @param event_id [String]
50
+ # The unique ID of the Live server event.
51
+ #
52
+ # @param start_ms [Integer]
53
+ # The start of this event on the Live session timeline, in milliseconds from the
54
+ # beginning of the session.
55
+ #
56
+ # @param client_event_id [String]
57
+ # The event_id of the client command associated with this server event, when
58
+ # supplied.
59
+ #
60
+ # @param type [Symbol, :"session.commentary.appended"]
61
+ # The event type, always `session.commentary.appended`.
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class CustomVoice < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute id
8
+ #
9
+ # @return [String]
10
+ required :id, String
11
+
12
+ # @!method initialize(id:)
13
+ # @param id [String]
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,81 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class DataChannelConfig < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute allowed_client_events
8
+ # Client event types that the frontend data channel may send. Use 'all' to allow
9
+ # every client event; an empty array allows none. Omission preserves the existing
10
+ # allow-all behavior.
11
+ #
12
+ # @return [Symbol, :all, Array<String>, nil]
13
+ optional :allowed_client_events, union: -> { OpenAI::Live::DataChannelConfig::AllowedClientEvents }
14
+
15
+ # @!attribute allowed_server_events
16
+ # Server events that may be sent to the frontend data channel. Use 'all' to allow
17
+ # every server event; an empty array allows none. Omission preserves the existing
18
+ # allow-all behavior. Responses events use an object with type 'response.event'
19
+ # and a response_event selector.
20
+ #
21
+ # @return [Symbol, :all, Array<OpenAI::Models::Live::ServerEventSelector>, nil]
22
+ optional :allowed_server_events, union: -> { OpenAI::Live::DataChannelConfig::AllowedServerEvents }
23
+
24
+ # @!method initialize(allowed_client_events: nil, allowed_server_events: nil)
25
+ # Control which Live events an untrusted WebRTC frontend can send and receive over
26
+ # its data channel. These restrictions do not apply to trusted sideband
27
+ # connections.
28
+ #
29
+ # @param allowed_client_events [Symbol, :all, Array<String>]
30
+ # Client event types that the frontend data channel may send. Use 'all' to allow
31
+ # every client event; an empty array allows none. Omission preserves the existing
32
+ # allow-all behavior.
33
+ #
34
+ # @param allowed_server_events [Symbol, :all, Array<OpenAI::Models::Live::ServerEventSelector>]
35
+ # Server events that may be sent to the frontend data channel. Use 'all' to allow
36
+ # every server event; an empty array allows none. Omission preserves the existing
37
+ # allow-all behavior. Responses events use an object with type 'response.event'
38
+ # and a response_event selector.
39
+
40
+ # Client event types that the frontend data channel may send. Use 'all' to allow
41
+ # every client event; an empty array allows none. Omission preserves the existing
42
+ # allow-all behavior.
43
+ #
44
+ # @see OpenAI::Models::Live::DataChannelConfig#allowed_client_events
45
+ module AllowedClientEvents
46
+ extend OpenAI::Internal::Type::Union
47
+
48
+ variant const: :all
49
+
50
+ variant -> { OpenAI::Models::Live::DataChannelConfig::AllowedClientEvents::StringArray }
51
+
52
+ # @!method self.variants
53
+ # @return [Array(Symbol, :all, Array<String>)]
54
+
55
+ # @type [OpenAI::Internal::Type::Converter]
56
+ StringArray = OpenAI::Internal::Type::ArrayOf[String]
57
+ end
58
+
59
+ # Server events that may be sent to the frontend data channel. Use 'all' to allow
60
+ # every server event; an empty array allows none. Omission preserves the existing
61
+ # allow-all behavior. Responses events use an object with type 'response.event'
62
+ # and a response_event selector.
63
+ #
64
+ # @see OpenAI::Models::Live::DataChannelConfig#allowed_server_events
65
+ module AllowedServerEvents
66
+ extend OpenAI::Internal::Type::Union
67
+
68
+ variant const: :all
69
+
70
+ variant -> { OpenAI::Models::Live::DataChannelConfig::AllowedServerEvents::ServerEventSelectorArray }
71
+
72
+ # @!method self.variants
73
+ # @return [Array(Symbol, :all, Array<OpenAI::Models::Live::ServerEventSelector>)]
74
+
75
+ # @type [OpenAI::Internal::Type::Converter]
76
+ ServerEventSelectorArray = OpenAI::Internal::Type::ArrayOf[-> { OpenAI::Live::ServerEventSelector }]
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,140 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class DelegationCreatedEvent < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute delegation
8
+ # The delegated work identifier and destination. This object contains metadata,
9
+ # not the task text.
10
+ #
11
+ # @return [OpenAI::Models::Live::DelegationCreatedEvent::Delegation]
12
+ required :delegation, -> { OpenAI::Live::DelegationCreatedEvent::Delegation }
13
+
14
+ # @!attribute event_id
15
+ # The unique ID of the Live server event.
16
+ #
17
+ # @return [String]
18
+ required :event_id, String
19
+
20
+ # @!attribute offset_ms
21
+ # The position on the Live session timeline where the delegation was created, in
22
+ # milliseconds from the beginning of the session.
23
+ #
24
+ # @return [Integer]
25
+ required :offset_ms, Integer
26
+
27
+ # @!attribute type
28
+ # The event type, always `session.delegation.created`.
29
+ #
30
+ # @return [Symbol, :"session.delegation.created"]
31
+ required :type, const: :"session.delegation.created"
32
+
33
+ # @!attribute client_event_id
34
+ # The event_id of the client command associated with this server event, when
35
+ # supplied.
36
+ #
37
+ # @return [String, nil]
38
+ optional :client_event_id, String
39
+
40
+ # @!method initialize(delegation:, event_id:, offset_ms:, client_event_id: nil, type: :"session.delegation.created")
41
+ # Returned when the Live model delegates work to your application or a Responses
42
+ # backend. Contains delegation metadata and the position on the session timeline
43
+ # where the work was delegated.
44
+ #
45
+ # @param delegation [OpenAI::Models::Live::DelegationCreatedEvent::Delegation]
46
+ # The delegated work identifier and destination. This object contains metadata,
47
+ # not the task text.
48
+ #
49
+ # @param event_id [String]
50
+ # The unique ID of the Live server event.
51
+ #
52
+ # @param offset_ms [Integer]
53
+ # The position on the Live session timeline where the delegation was created, in
54
+ # milliseconds from the beginning of the session.
55
+ #
56
+ # @param client_event_id [String]
57
+ # The event_id of the client command associated with this server event, when
58
+ # supplied.
59
+ #
60
+ # @param type [Symbol, :"session.delegation.created"]
61
+ # The event type, always `session.delegation.created`.
62
+
63
+ # @see OpenAI::Models::Live::DelegationCreatedEvent#delegation
64
+ class Delegation < OpenAI::Internal::Type::BaseModel
65
+ # @!attribute id
66
+ # The unique ID of the delegation. Use this as delegation_id when replying to
67
+ # client-owned work or correlating Responses events.
68
+ #
69
+ # @return [String]
70
+ required :id, String
71
+
72
+ # @!attribute target
73
+ # Where the Live model delegated the work: `client` for your application, or
74
+ # `responses` for the configured Responses backend.
75
+ #
76
+ # @return [Symbol, OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target]
77
+ required :target, union: -> { OpenAI::Live::DelegationCreatedEvent::Delegation::Target }
78
+
79
+ # @!attribute type
80
+ # The object type, always `delegation`.
81
+ #
82
+ # @return [Symbol, :delegation]
83
+ required :type, const: :delegation
84
+
85
+ # @!attribute response_id
86
+ # The ID of the Responses API response associated with a Responses delegation.
87
+ # Omitted for client delegations.
88
+ #
89
+ # @return [String, nil]
90
+ optional :response_id, String
91
+
92
+ # @!method initialize(id:, target:, response_id: nil, type: :delegation)
93
+ # The delegated work identifier and destination. This object contains metadata,
94
+ # not the task text.
95
+ #
96
+ # @param id [String]
97
+ # The unique ID of the delegation. Use this as delegation_id when replying to
98
+ # client-owned work or correlating Responses events.
99
+ #
100
+ # @param target [Symbol, OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target]
101
+ # Where the Live model delegated the work: `client` for your application, or
102
+ # `responses` for the configured Responses backend.
103
+ #
104
+ # @param response_id [String]
105
+ # The ID of the Responses API response associated with a Responses delegation.
106
+ # Omitted for client delegations.
107
+ #
108
+ # @param type [Symbol, :delegation]
109
+ # The object type, always `delegation`.
110
+
111
+ # Where the Live model delegated the work: `client` for your application, or
112
+ # `responses` for the configured Responses backend.
113
+ #
114
+ # @see OpenAI::Models::Live::DelegationCreatedEvent::Delegation#target
115
+ module Target
116
+ extend OpenAI::Internal::Type::Union
117
+
118
+ variant const: -> { OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target::CLIENT }
119
+
120
+ variant const: -> { OpenAI::Models::Live::DelegationCreatedEvent::Delegation::Target::RESPONSES }
121
+
122
+ # @!method self.variants
123
+ # @return [Array(Symbol)]
124
+
125
+ define_sorbet_constant!(:Variants) do
126
+ T.type_alias { OpenAI::Live::DelegationCreatedEvent::Delegation::Target::TaggedSymbol }
127
+ end
128
+
129
+ # @!group
130
+
131
+ CLIENT = :client
132
+ RESPONSES = :responses
133
+
134
+ # @!endgroup
135
+ end
136
+ end
137
+ end
138
+ end
139
+ end
140
+ end
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Live
6
+ class Error < OpenAI::Internal::Type::BaseModel
7
+ # @!attribute code
8
+ # A machine-readable code identifying the Live error, such as `unknown_parameter`.
9
+ #
10
+ # @return [String]
11
+ required :code, String
12
+
13
+ # @!attribute message
14
+ # A human-readable explanation of the Live error.
15
+ #
16
+ # @return [String]
17
+ required :message, String
18
+
19
+ # @!attribute type
20
+ # The category of error, such as `invalid_request_error` for an invalid Live
21
+ # client command.
22
+ #
23
+ # @return [String]
24
+ required :type, String
25
+
26
+ # @!attribute client_event_id
27
+ # The event_id of the client command that caused the error, when supplied.
28
+ #
29
+ # @return [String, nil]
30
+ optional :client_event_id, String
31
+
32
+ # @!attribute param
33
+ # The parameter that caused the error, when applicable, such as `session.voice`.
34
+ #
35
+ # @return [String, nil]
36
+ optional :param, String
37
+
38
+ # @!method initialize(code:, message:, type:, client_event_id: nil, param: nil)
39
+ # Details of an error encountered by the Live session, including the affected
40
+ # parameter or client command when available.
41
+ #
42
+ # @param code [String]
43
+ # A machine-readable code identifying the Live error, such as `unknown_parameter`.
44
+ #
45
+ # @param message [String]
46
+ # A human-readable explanation of the Live error.
47
+ #
48
+ # @param type [String]
49
+ # The category of error, such as `invalid_request_error` for an invalid Live
50
+ # client command.
51
+ #
52
+ # @param client_event_id [String]
53
+ # The event_id of the client command that caused the error, when supplied.
54
+ #
55
+ # @param param [String]
56
+ # The parameter that caused the error, when applicable, such as `session.voice`.
57
+ end
58
+ end
59
+ end
60
+ end