openai 0.106.0 → 0.108.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 (111) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +74 -0
  3. data/README.md +49 -1
  4. data/examples/chat/tool_runner.rb +33 -0
  5. data/lib/openai/client.rb +2 -2
  6. data/lib/openai/helpers/chat/tool_runner.rb +259 -0
  7. data/lib/openai/helpers/live/websocket.rb +12 -141
  8. data/lib/openai/helpers/local_audio/process.rb +13 -3
  9. data/lib/openai/helpers/models/embedding.rb +42 -0
  10. data/lib/openai/helpers/realtime/connection.rb +22 -5
  11. data/lib/openai/helpers/realtime/recovery.rb +19 -7
  12. data/lib/openai/helpers/realtime/translation.rb +37 -169
  13. data/lib/openai/helpers/realtime/unknown_server_event.rb +5 -12
  14. data/lib/openai/helpers/responses_websocket/connection.rb +56 -35
  15. data/lib/openai/helpers/responses_websocket/incremental.rb +5 -1
  16. data/lib/openai/helpers/responses_websocket/session.rb +11 -4
  17. data/lib/openai/helpers/responses_websocket/unknown_server_event.rb +2 -14
  18. data/lib/openai/helpers/streaming/chat_completion_resource.rb +52 -0
  19. data/lib/openai/helpers/websocket/async_websocket_transport.rb +8 -6
  20. data/lib/openai/helpers/websocket/client_request.rb +1 -1
  21. data/lib/openai/helpers/websocket/connection.rb +21 -10
  22. data/lib/openai/helpers/websocket/connection_manager.rb +2 -1
  23. data/lib/openai/helpers/websocket/protocol.rb +160 -0
  24. data/lib/openai/helpers/websocket/typed_connection.rb +22 -16
  25. data/lib/openai/helpers/websocket/typed_resource.rb +15 -0
  26. data/lib/openai/internal/transport/base_client.rb +1 -1
  27. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +16 -5
  28. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +16 -5
  29. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +16 -5
  30. data/lib/openai/models/admin/organization/usage_completions_response.rb +16 -5
  31. data/lib/openai/models/admin/organization/usage_costs_response.rb +16 -5
  32. data/lib/openai/models/admin/organization/usage_decisions_response.rb +14 -3
  33. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +16 -5
  34. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +16 -5
  35. data/lib/openai/models/admin/organization/usage_images_response.rb +16 -5
  36. data/lib/openai/models/admin/organization/usage_moderations_response.rb +16 -5
  37. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +16 -5
  38. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +16 -5
  39. data/lib/openai/models/audio/voice_consent.rb +58 -0
  40. data/lib/openai/models/audio/voice_consent_create_params.rb +57 -0
  41. data/lib/openai/models/audio/voice_consent_delete_params.rb +22 -0
  42. data/lib/openai/models/audio/voice_consent_deleted.rb +34 -0
  43. data/lib/openai/models/audio/voice_consent_list_params.rb +42 -0
  44. data/lib/openai/models/audio/voice_consent_retrieve_params.rb +22 -0
  45. data/lib/openai/models/audio/voice_consent_update_params.rb +32 -0
  46. data/lib/openai/models/beta/beta_response_input_item.rb +10 -1
  47. data/lib/openai/models/responses/response_input_item.rb +10 -1
  48. data/lib/openai/resources/audio/voice_consents.rb +163 -0
  49. data/lib/openai/resources/audio.rb +5 -0
  50. data/lib/openai/version.rb +1 -1
  51. data/lib/openai.rb +9 -0
  52. data/rbi/openai/client.rbi +1 -8
  53. data/rbi/openai/helpers/chat/tool_runner.rbi +74 -0
  54. data/rbi/openai/helpers/realtime/translation.rbi +0 -5
  55. data/rbi/openai/helpers/realtime/unknown_server_event.rbi +6 -0
  56. data/rbi/openai/helpers/websocket.rbi +44 -6
  57. data/rbi/openai/internal/transport/base_client.rbi +2 -6
  58. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +14 -2
  59. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +14 -2
  60. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +14 -2
  61. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +14 -2
  62. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +14 -2
  63. data/rbi/openai/models/admin/organization/usage_decisions_response.rbi +12 -0
  64. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +14 -2
  65. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +14 -2
  66. data/rbi/openai/models/admin/organization/usage_images_response.rbi +14 -2
  67. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +14 -2
  68. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +14 -2
  69. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +14 -2
  70. data/rbi/openai/models/audio/voice_consent.rbi +86 -0
  71. data/rbi/openai/models/audio/voice_consent_create_params.rbi +92 -0
  72. data/rbi/openai/models/audio/voice_consent_delete_params.rbi +53 -0
  73. data/rbi/openai/models/audio/voice_consent_deleted.rbi +62 -0
  74. data/rbi/openai/models/audio/voice_consent_list_params.rbi +78 -0
  75. data/rbi/openai/models/audio/voice_consent_retrieve_params.rbi +53 -0
  76. data/rbi/openai/models/audio/voice_consent_update_params.rbi +62 -0
  77. data/rbi/openai/models/beta/beta_response_input_item.rbi +14 -1
  78. data/rbi/openai/models/response_format_json_schema.rbi +13 -11
  79. data/rbi/openai/models/responses/response_input_item.rbi +10 -1
  80. data/rbi/openai/resources/audio/voice_consents.rbi +108 -0
  81. data/rbi/openai/resources/audio.rbi +4 -0
  82. data/realtime.md +22 -3
  83. data/sig/openai/client.rbs +1 -1
  84. data/sig/openai/helpers/chat/tool_runner.rbs +48 -0
  85. data/sig/openai/helpers/realtime/translation.rbs +0 -2
  86. data/sig/openai/helpers/realtime/unknown_server_event.rbs +2 -0
  87. data/sig/openai/helpers/websocket.rbs +23 -6
  88. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +15 -5
  89. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +15 -5
  90. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +15 -5
  91. data/sig/openai/models/admin/organization/usage_completions_response.rbs +15 -5
  92. data/sig/openai/models/admin/organization/usage_costs_response.rbs +15 -5
  93. data/sig/openai/models/admin/organization/usage_decisions_response.rbs +11 -1
  94. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +15 -5
  95. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +15 -5
  96. data/sig/openai/models/admin/organization/usage_images_response.rbs +15 -5
  97. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +15 -5
  98. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +15 -5
  99. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +15 -5
  100. data/sig/openai/models/audio/voice_consent.rbs +57 -0
  101. data/sig/openai/models/audio/voice_consent_create_params.rbs +61 -0
  102. data/sig/openai/models/audio/voice_consent_delete_params.rbs +25 -0
  103. data/sig/openai/models/audio/voice_consent_deleted.rbs +31 -0
  104. data/sig/openai/models/audio/voice_consent_list_params.rbs +57 -0
  105. data/sig/openai/models/audio/voice_consent_retrieve_params.rbs +25 -0
  106. data/sig/openai/models/audio/voice_consent_update_params.rbs +36 -0
  107. data/sig/openai/models/beta/beta_response_input_item.rbs +8 -0
  108. data/sig/openai/models/responses/response_input_item.rbs +8 -3
  109. data/sig/openai/resources/audio/voice_consents.rbs +38 -0
  110. data/sig/openai/resources/audio.rbs +2 -0
  111. metadata +31 -1
@@ -232,7 +232,12 @@ module OpenAI
232
232
  attr_writer :input_cache_write_12h_tokens
233
233
 
234
234
  # The aggregated number of input tokens written to the cache with a 30-minute
235
- # retention period.
235
+ # retention period. May be absent or null for older responses.
236
+ sig { returns(T.nilable(Integer)) }
237
+ attr_accessor :input_cache_write_30m_tokens
238
+
239
+ # The aggregated number of input tokens written to the cache across 30-minute and
240
+ # 12-hour retention periods.
236
241
  sig { returns(T.nilable(Integer)) }
237
242
  attr_reader :input_cache_write_tokens
238
243
 
@@ -354,6 +359,8 @@ module OpenAI
354
359
 
355
360
  input_cache_write_12h_tokens: Integer,
356
361
 
362
+ input_cache_write_30m_tokens: T.nilable(Integer),
363
+
357
364
  input_cache_write_tokens: Integer,
358
365
 
359
366
  input_cached_audio_tokens: Integer,
@@ -425,7 +432,11 @@ module OpenAI
425
432
  input_cache_write_12h_tokens: nil,
426
433
 
427
434
  # The aggregated number of input tokens written to the cache with a 30-minute
428
- # retention period.
435
+ # retention period. May be absent or null for older responses.
436
+ input_cache_write_30m_tokens: nil,
437
+
438
+ # The aggregated number of input tokens written to the cache across 30-minute and
439
+ # 12-hour retention periods.
429
440
  input_cache_write_tokens: nil,
430
441
 
431
442
  # The aggregated number of cached audio input tokens used.
@@ -495,6 +506,7 @@ module OpenAI
495
506
  batch: T.nilable(T::Boolean),
496
507
  input_audio_tokens: Integer,
497
508
  input_cache_write_12h_tokens: Integer,
509
+ input_cache_write_30m_tokens: T.nilable(Integer),
498
510
  input_cache_write_tokens: Integer,
499
511
  input_cached_audio_tokens: Integer,
500
512
  input_cached_image_tokens: Integer,
@@ -228,7 +228,12 @@ module OpenAI
228
228
  attr_writer :input_cache_write_12h_tokens
229
229
 
230
230
  # The aggregated number of input tokens written to the cache with a 30-minute
231
- # retention period.
231
+ # retention period. May be absent or null for older responses.
232
+ sig { returns(T.nilable(Integer)) }
233
+ attr_accessor :input_cache_write_30m_tokens
234
+
235
+ # The aggregated number of input tokens written to the cache across 30-minute and
236
+ # 12-hour retention periods.
232
237
  sig { returns(T.nilable(Integer)) }
233
238
  attr_reader :input_cache_write_tokens
234
239
 
@@ -350,6 +355,8 @@ module OpenAI
350
355
 
351
356
  input_cache_write_12h_tokens: Integer,
352
357
 
358
+ input_cache_write_30m_tokens: T.nilable(Integer),
359
+
353
360
  input_cache_write_tokens: Integer,
354
361
 
355
362
  input_cached_audio_tokens: Integer,
@@ -421,7 +428,11 @@ module OpenAI
421
428
  input_cache_write_12h_tokens: nil,
422
429
 
423
430
  # The aggregated number of input tokens written to the cache with a 30-minute
424
- # retention period.
431
+ # retention period. May be absent or null for older responses.
432
+ input_cache_write_30m_tokens: nil,
433
+
434
+ # The aggregated number of input tokens written to the cache across 30-minute and
435
+ # 12-hour retention periods.
425
436
  input_cache_write_tokens: nil,
426
437
 
427
438
  # The aggregated number of cached audio input tokens used.
@@ -491,6 +502,7 @@ module OpenAI
491
502
  batch: T.nilable(T::Boolean),
492
503
  input_audio_tokens: Integer,
493
504
  input_cache_write_12h_tokens: Integer,
505
+ input_cache_write_30m_tokens: T.nilable(Integer),
494
506
  input_cache_write_tokens: Integer,
495
507
  input_cached_audio_tokens: Integer,
496
508
  input_cached_image_tokens: Integer,
@@ -224,7 +224,12 @@ module OpenAI
224
224
  attr_writer :input_cache_write_12h_tokens
225
225
 
226
226
  # The aggregated number of input tokens written to the cache with a 30-minute
227
- # retention period.
227
+ # retention period. May be absent or null for older responses.
228
+ sig { returns(T.nilable(Integer)) }
229
+ attr_accessor :input_cache_write_30m_tokens
230
+
231
+ # The aggregated number of input tokens written to the cache across 30-minute and
232
+ # 12-hour retention periods.
228
233
  sig { returns(T.nilable(Integer)) }
229
234
  attr_reader :input_cache_write_tokens
230
235
 
@@ -346,6 +351,8 @@ module OpenAI
346
351
 
347
352
  input_cache_write_12h_tokens: Integer,
348
353
 
354
+ input_cache_write_30m_tokens: T.nilable(Integer),
355
+
349
356
  input_cache_write_tokens: Integer,
350
357
 
351
358
  input_cached_audio_tokens: Integer,
@@ -417,7 +424,11 @@ module OpenAI
417
424
  input_cache_write_12h_tokens: nil,
418
425
 
419
426
  # The aggregated number of input tokens written to the cache with a 30-minute
420
- # retention period.
427
+ # retention period. May be absent or null for older responses.
428
+ input_cache_write_30m_tokens: nil,
429
+
430
+ # The aggregated number of input tokens written to the cache across 30-minute and
431
+ # 12-hour retention periods.
421
432
  input_cache_write_tokens: nil,
422
433
 
423
434
  # The aggregated number of cached audio input tokens used.
@@ -487,6 +498,7 @@ module OpenAI
487
498
  batch: T.nilable(T::Boolean),
488
499
  input_audio_tokens: Integer,
489
500
  input_cache_write_12h_tokens: Integer,
501
+ input_cache_write_30m_tokens: T.nilable(Integer),
490
502
  input_cache_write_tokens: Integer,
491
503
  input_cached_audio_tokens: Integer,
492
504
  input_cached_image_tokens: Integer,
@@ -186,6 +186,11 @@ module OpenAI
186
186
  # The aggregated number of input tokens written to the cache with a 30-minute
187
187
  # retention period.
188
188
  sig { returns(T.nilable(Integer)) }
189
+ attr_accessor :input_cache_write_30m_tokens
190
+
191
+ # The aggregated number of input tokens written to the cache across 30-minute and
192
+ # 12-hour retention periods.
193
+ sig { returns(T.nilable(Integer)) }
189
194
  attr_accessor :input_cache_write_tokens
190
195
 
191
196
  # The aggregated number of cached audio input tokens used.
@@ -273,6 +278,8 @@ module OpenAI
273
278
 
274
279
  input_cache_write_12h_tokens: T.nilable(Integer),
275
280
 
281
+ input_cache_write_30m_tokens: T.nilable(Integer),
282
+
276
283
  input_cache_write_tokens: T.nilable(Integer),
277
284
 
278
285
  input_cached_audio_tokens: T.nilable(Integer),
@@ -345,6 +352,10 @@ module OpenAI
345
352
 
346
353
  # The aggregated number of input tokens written to the cache with a 30-minute
347
354
  # retention period.
355
+ input_cache_write_30m_tokens: nil,
356
+
357
+ # The aggregated number of input tokens written to the cache across 30-minute and
358
+ # 12-hour retention periods.
348
359
  input_cache_write_tokens: nil,
349
360
 
350
361
  # The aggregated number of cached audio input tokens used.
@@ -414,6 +425,7 @@ module OpenAI
414
425
  batch: T.nilable(T::Boolean),
415
426
  input_audio_tokens: T.nilable(Integer),
416
427
  input_cache_write_12h_tokens: T.nilable(Integer),
428
+ input_cache_write_30m_tokens: T.nilable(Integer),
417
429
  input_cache_write_tokens: T.nilable(Integer),
418
430
  input_cached_audio_tokens: T.nilable(Integer),
419
431
  input_cached_image_tokens: T.nilable(Integer),
@@ -228,7 +228,12 @@ module OpenAI
228
228
  attr_writer :input_cache_write_12h_tokens
229
229
 
230
230
  # The aggregated number of input tokens written to the cache with a 30-minute
231
- # retention period.
231
+ # retention period. May be absent or null for older responses.
232
+ sig { returns(T.nilable(Integer)) }
233
+ attr_accessor :input_cache_write_30m_tokens
234
+
235
+ # The aggregated number of input tokens written to the cache across 30-minute and
236
+ # 12-hour retention periods.
232
237
  sig { returns(T.nilable(Integer)) }
233
238
  attr_reader :input_cache_write_tokens
234
239
 
@@ -350,6 +355,8 @@ module OpenAI
350
355
 
351
356
  input_cache_write_12h_tokens: Integer,
352
357
 
358
+ input_cache_write_30m_tokens: T.nilable(Integer),
359
+
353
360
  input_cache_write_tokens: Integer,
354
361
 
355
362
  input_cached_audio_tokens: Integer,
@@ -421,7 +428,11 @@ module OpenAI
421
428
  input_cache_write_12h_tokens: nil,
422
429
 
423
430
  # The aggregated number of input tokens written to the cache with a 30-minute
424
- # retention period.
431
+ # retention period. May be absent or null for older responses.
432
+ input_cache_write_30m_tokens: nil,
433
+
434
+ # The aggregated number of input tokens written to the cache across 30-minute and
435
+ # 12-hour retention periods.
425
436
  input_cache_write_tokens: nil,
426
437
 
427
438
  # The aggregated number of cached audio input tokens used.
@@ -491,6 +502,7 @@ module OpenAI
491
502
  batch: T.nilable(T::Boolean),
492
503
  input_audio_tokens: Integer,
493
504
  input_cache_write_12h_tokens: Integer,
505
+ input_cache_write_30m_tokens: T.nilable(Integer),
494
506
  input_cache_write_tokens: Integer,
495
507
  input_cached_audio_tokens: Integer,
496
508
  input_cached_image_tokens: Integer,
@@ -230,7 +230,12 @@ module OpenAI
230
230
  attr_writer :input_cache_write_12h_tokens
231
231
 
232
232
  # The aggregated number of input tokens written to the cache with a 30-minute
233
- # retention period.
233
+ # retention period. May be absent or null for older responses.
234
+ sig { returns(T.nilable(Integer)) }
235
+ attr_accessor :input_cache_write_30m_tokens
236
+
237
+ # The aggregated number of input tokens written to the cache across 30-minute and
238
+ # 12-hour retention periods.
234
239
  sig { returns(T.nilable(Integer)) }
235
240
  attr_reader :input_cache_write_tokens
236
241
 
@@ -352,6 +357,8 @@ module OpenAI
352
357
 
353
358
  input_cache_write_12h_tokens: Integer,
354
359
 
360
+ input_cache_write_30m_tokens: T.nilable(Integer),
361
+
355
362
  input_cache_write_tokens: Integer,
356
363
 
357
364
  input_cached_audio_tokens: Integer,
@@ -423,7 +430,11 @@ module OpenAI
423
430
  input_cache_write_12h_tokens: nil,
424
431
 
425
432
  # The aggregated number of input tokens written to the cache with a 30-minute
426
- # retention period.
433
+ # retention period. May be absent or null for older responses.
434
+ input_cache_write_30m_tokens: nil,
435
+
436
+ # The aggregated number of input tokens written to the cache across 30-minute and
437
+ # 12-hour retention periods.
427
438
  input_cache_write_tokens: nil,
428
439
 
429
440
  # The aggregated number of cached audio input tokens used.
@@ -493,6 +504,7 @@ module OpenAI
493
504
  batch: T.nilable(T::Boolean),
494
505
  input_audio_tokens: Integer,
495
506
  input_cache_write_12h_tokens: Integer,
507
+ input_cache_write_30m_tokens: T.nilable(Integer),
496
508
  input_cache_write_tokens: Integer,
497
509
  input_cached_audio_tokens: Integer,
498
510
  input_cached_image_tokens: Integer,
@@ -224,7 +224,12 @@ module OpenAI
224
224
  attr_writer :input_cache_write_12h_tokens
225
225
 
226
226
  # The aggregated number of input tokens written to the cache with a 30-minute
227
- # retention period.
227
+ # retention period. May be absent or null for older responses.
228
+ sig { returns(T.nilable(Integer)) }
229
+ attr_accessor :input_cache_write_30m_tokens
230
+
231
+ # The aggregated number of input tokens written to the cache across 30-minute and
232
+ # 12-hour retention periods.
228
233
  sig { returns(T.nilable(Integer)) }
229
234
  attr_reader :input_cache_write_tokens
230
235
 
@@ -346,6 +351,8 @@ module OpenAI
346
351
 
347
352
  input_cache_write_12h_tokens: Integer,
348
353
 
354
+ input_cache_write_30m_tokens: T.nilable(Integer),
355
+
349
356
  input_cache_write_tokens: Integer,
350
357
 
351
358
  input_cached_audio_tokens: Integer,
@@ -417,7 +424,11 @@ module OpenAI
417
424
  input_cache_write_12h_tokens: nil,
418
425
 
419
426
  # The aggregated number of input tokens written to the cache with a 30-minute
420
- # retention period.
427
+ # retention period. May be absent or null for older responses.
428
+ input_cache_write_30m_tokens: nil,
429
+
430
+ # The aggregated number of input tokens written to the cache across 30-minute and
431
+ # 12-hour retention periods.
421
432
  input_cache_write_tokens: nil,
422
433
 
423
434
  # The aggregated number of cached audio input tokens used.
@@ -487,6 +498,7 @@ module OpenAI
487
498
  batch: T.nilable(T::Boolean),
488
499
  input_audio_tokens: Integer,
489
500
  input_cache_write_12h_tokens: Integer,
501
+ input_cache_write_30m_tokens: T.nilable(Integer),
490
502
  input_cache_write_tokens: Integer,
491
503
  input_cached_audio_tokens: Integer,
492
504
  input_cached_image_tokens: Integer,
@@ -228,7 +228,12 @@ module OpenAI
228
228
  attr_writer :input_cache_write_12h_tokens
229
229
 
230
230
  # The aggregated number of input tokens written to the cache with a 30-minute
231
- # retention period.
231
+ # retention period. May be absent or null for older responses.
232
+ sig { returns(T.nilable(Integer)) }
233
+ attr_accessor :input_cache_write_30m_tokens
234
+
235
+ # The aggregated number of input tokens written to the cache across 30-minute and
236
+ # 12-hour retention periods.
232
237
  sig { returns(T.nilable(Integer)) }
233
238
  attr_reader :input_cache_write_tokens
234
239
 
@@ -350,6 +355,8 @@ module OpenAI
350
355
 
351
356
  input_cache_write_12h_tokens: Integer,
352
357
 
358
+ input_cache_write_30m_tokens: T.nilable(Integer),
359
+
353
360
  input_cache_write_tokens: Integer,
354
361
 
355
362
  input_cached_audio_tokens: Integer,
@@ -421,7 +428,11 @@ module OpenAI
421
428
  input_cache_write_12h_tokens: nil,
422
429
 
423
430
  # The aggregated number of input tokens written to the cache with a 30-minute
424
- # retention period.
431
+ # retention period. May be absent or null for older responses.
432
+ input_cache_write_30m_tokens: nil,
433
+
434
+ # The aggregated number of input tokens written to the cache across 30-minute and
435
+ # 12-hour retention periods.
425
436
  input_cache_write_tokens: nil,
426
437
 
427
438
  # The aggregated number of cached audio input tokens used.
@@ -491,6 +502,7 @@ module OpenAI
491
502
  batch: T.nilable(T::Boolean),
492
503
  input_audio_tokens: Integer,
493
504
  input_cache_write_12h_tokens: Integer,
505
+ input_cache_write_30m_tokens: T.nilable(Integer),
494
506
  input_cache_write_tokens: Integer,
495
507
  input_cached_audio_tokens: Integer,
496
508
  input_cached_image_tokens: Integer,
@@ -228,7 +228,12 @@ module OpenAI
228
228
  attr_writer :input_cache_write_12h_tokens
229
229
 
230
230
  # The aggregated number of input tokens written to the cache with a 30-minute
231
- # retention period.
231
+ # retention period. May be absent or null for older responses.
232
+ sig { returns(T.nilable(Integer)) }
233
+ attr_accessor :input_cache_write_30m_tokens
234
+
235
+ # The aggregated number of input tokens written to the cache across 30-minute and
236
+ # 12-hour retention periods.
232
237
  sig { returns(T.nilable(Integer)) }
233
238
  attr_reader :input_cache_write_tokens
234
239
 
@@ -350,6 +355,8 @@ module OpenAI
350
355
 
351
356
  input_cache_write_12h_tokens: Integer,
352
357
 
358
+ input_cache_write_30m_tokens: T.nilable(Integer),
359
+
353
360
  input_cache_write_tokens: Integer,
354
361
 
355
362
  input_cached_audio_tokens: Integer,
@@ -421,7 +428,11 @@ module OpenAI
421
428
  input_cache_write_12h_tokens: nil,
422
429
 
423
430
  # The aggregated number of input tokens written to the cache with a 30-minute
424
- # retention period.
431
+ # retention period. May be absent or null for older responses.
432
+ input_cache_write_30m_tokens: nil,
433
+
434
+ # The aggregated number of input tokens written to the cache across 30-minute and
435
+ # 12-hour retention periods.
425
436
  input_cache_write_tokens: nil,
426
437
 
427
438
  # The aggregated number of cached audio input tokens used.
@@ -491,6 +502,7 @@ module OpenAI
491
502
  batch: T.nilable(T::Boolean),
492
503
  input_audio_tokens: Integer,
493
504
  input_cache_write_12h_tokens: Integer,
505
+ input_cache_write_30m_tokens: T.nilable(Integer),
494
506
  input_cache_write_tokens: Integer,
495
507
  input_cached_audio_tokens: Integer,
496
508
  input_cached_image_tokens: Integer,
@@ -230,7 +230,12 @@ module OpenAI
230
230
  attr_writer :input_cache_write_12h_tokens
231
231
 
232
232
  # The aggregated number of input tokens written to the cache with a 30-minute
233
- # retention period.
233
+ # retention period. May be absent or null for older responses.
234
+ sig { returns(T.nilable(Integer)) }
235
+ attr_accessor :input_cache_write_30m_tokens
236
+
237
+ # The aggregated number of input tokens written to the cache across 30-minute and
238
+ # 12-hour retention periods.
234
239
  sig { returns(T.nilable(Integer)) }
235
240
  attr_reader :input_cache_write_tokens
236
241
 
@@ -352,6 +357,8 @@ module OpenAI
352
357
 
353
358
  input_cache_write_12h_tokens: Integer,
354
359
 
360
+ input_cache_write_30m_tokens: T.nilable(Integer),
361
+
355
362
  input_cache_write_tokens: Integer,
356
363
 
357
364
  input_cached_audio_tokens: Integer,
@@ -423,7 +430,11 @@ module OpenAI
423
430
  input_cache_write_12h_tokens: nil,
424
431
 
425
432
  # The aggregated number of input tokens written to the cache with a 30-minute
426
- # retention period.
433
+ # retention period. May be absent or null for older responses.
434
+ input_cache_write_30m_tokens: nil,
435
+
436
+ # The aggregated number of input tokens written to the cache across 30-minute and
437
+ # 12-hour retention periods.
427
438
  input_cache_write_tokens: nil,
428
439
 
429
440
  # The aggregated number of cached audio input tokens used.
@@ -493,6 +504,7 @@ module OpenAI
493
504
  batch: T.nilable(T::Boolean),
494
505
  input_audio_tokens: Integer,
495
506
  input_cache_write_12h_tokens: Integer,
507
+ input_cache_write_30m_tokens: T.nilable(Integer),
496
508
  input_cache_write_tokens: Integer,
497
509
  input_cached_audio_tokens: Integer,
498
510
  input_cached_image_tokens: Integer,
@@ -0,0 +1,86 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Audio
7
+
8
+ class VoiceConsent < OpenAI::Internal::Type::BaseModel
9
+
10
+ OrHash = T.type_alias do
11
+ T.any(
12
+ OpenAI::Audio::VoiceConsent,
13
+ OpenAI::Internal::AnyHash
14
+ )
15
+ end
16
+
17
+ # The consent recording identifier.
18
+ sig { returns(String) }
19
+ attr_accessor :id
20
+
21
+ # The Unix timestamp (in seconds) for when the consent recording was created.
22
+ sig { returns(Integer) }
23
+ attr_accessor :created_at
24
+
25
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
26
+ sig { returns(String) }
27
+ attr_accessor :language
28
+
29
+ # The label provided when the consent recording was uploaded.
30
+ sig { returns(String) }
31
+ attr_accessor :name
32
+
33
+ # The object type, which is always `audio.voice_consent`.
34
+ sig { returns(Symbol) }
35
+ attr_accessor :object
36
+
37
+ # A consent recording used to authorize creation of a custom voice.
38
+ sig do
39
+ params(
40
+
41
+ id: String,
42
+
43
+ created_at: Integer,
44
+
45
+ language: String,
46
+
47
+ name: String,
48
+
49
+ object: Symbol
50
+ )
51
+ .returns(T.attached_class)
52
+ end
53
+ def self.new(
54
+
55
+ # The consent recording identifier.
56
+ id:,
57
+
58
+ # The Unix timestamp (in seconds) for when the consent recording was created.
59
+ created_at:,
60
+
61
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
62
+ language:,
63
+
64
+ # The label provided when the consent recording was uploaded.
65
+ name:,
66
+
67
+ # The object type, which is always `audio.voice_consent`.
68
+
69
+ object: :"audio.voice_consent"
70
+ )
71
+ end
72
+
73
+ sig do
74
+ override.returns(
75
+ {id: String, created_at: Integer, language: String, name: String, object: Symbol}
76
+ )
77
+ end
78
+ def to_hash
79
+ end
80
+
81
+ end
82
+
83
+ end
84
+
85
+ end
86
+ end
@@ -0,0 +1,92 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Audio
7
+
8
+ class VoiceConsentCreateParams < OpenAI::Internal::Type::BaseModel
9
+
10
+ extend OpenAI::Internal::Type::RequestParameters::Converter
11
+ include OpenAI::Internal::Type::RequestParameters
12
+
13
+ OrHash = T.type_alias do
14
+ T.any(
15
+ OpenAI::Audio::VoiceConsentCreateParams,
16
+ OpenAI::Internal::AnyHash
17
+ )
18
+ end
19
+
20
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
21
+ sig { returns(String) }
22
+ attr_accessor :language
23
+
24
+ # The label to use for this consent recording.
25
+ sig { returns(String) }
26
+ attr_accessor :name
27
+
28
+ # The consent audio recording file. Maximum size is 10 MiB.
29
+ #
30
+ # Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`,
31
+ # `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
32
+ #
33
+ # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
34
+ # metadata. Use `OpenAI::FilePart` when you need to override the filename or
35
+ # content type.
36
+ sig { returns(OpenAI::Internal::FileInput) }
37
+ attr_accessor :recording
38
+
39
+ sig do
40
+ params(
41
+
42
+ language: String,
43
+
44
+ name: String,
45
+
46
+ recording: OpenAI::Internal::FileInput,
47
+
48
+ request_options: OpenAI::RequestOptions::OrHash
49
+ )
50
+ .returns(T.attached_class)
51
+ end
52
+ def self.new(
53
+
54
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
55
+ language:,
56
+
57
+ # The label to use for this consent recording.
58
+ name:,
59
+
60
+ # The consent audio recording file. Maximum size is 10 MiB.
61
+ #
62
+ # Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`,
63
+ # `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
64
+ #
65
+ # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
66
+ # metadata. Use `OpenAI::FilePart` when you need to override the filename or
67
+ # content type.
68
+ recording:,
69
+
70
+ request_options: {}
71
+ )
72
+ end
73
+
74
+ sig do
75
+ override.returns(
76
+ {
77
+ language: String,
78
+ name: String,
79
+ recording: OpenAI::Internal::FileInput,
80
+ request_options: OpenAI::RequestOptions
81
+ }
82
+ )
83
+ end
84
+ def to_hash
85
+ end
86
+
87
+ end
88
+
89
+ end
90
+
91
+ end
92
+ end
@@ -0,0 +1,53 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Models
5
+
6
+ module Audio
7
+
8
+ class VoiceConsentDeleteParams < OpenAI::Internal::Type::BaseModel
9
+
10
+ extend OpenAI::Internal::Type::RequestParameters::Converter
11
+ include OpenAI::Internal::Type::RequestParameters
12
+
13
+ OrHash = T.type_alias do
14
+ T.any(
15
+ OpenAI::Audio::VoiceConsentDeleteParams,
16
+ OpenAI::Internal::AnyHash
17
+ )
18
+ end
19
+
20
+ sig { returns(String) }
21
+ attr_accessor :consent_id
22
+
23
+ sig do
24
+ params(
25
+
26
+ consent_id: String,
27
+
28
+ request_options: OpenAI::RequestOptions::OrHash
29
+ )
30
+ .returns(T.attached_class)
31
+ end
32
+ def self.new(
33
+
34
+ consent_id:,
35
+
36
+ request_options: {}
37
+ )
38
+ end
39
+
40
+ sig do
41
+ override.returns(
42
+ {consent_id: String, request_options: OpenAI::RequestOptions}
43
+ )
44
+ end
45
+ def to_hash
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+
52
+ end
53
+ end