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
@@ -237,9 +237,16 @@ module OpenAI
237
237
  # @return [Integer, nil]
238
238
  optional :input_cache_write_12h_tokens, Integer
239
239
 
240
- # @!attribute input_cache_write_tokens
240
+ # @!attribute input_cache_write_30m_tokens
241
241
  # The aggregated number of input tokens written to the cache with a 30-minute
242
- # retention period.
242
+ # retention period. May be absent or null for older responses.
243
+ #
244
+ # @return [Integer, nil]
245
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
246
+
247
+ # @!attribute input_cache_write_tokens
248
+ # The aggregated number of input tokens written to the cache across 30-minute and
249
+ # 12-hour retention periods.
243
250
  #
244
251
  # @return [Integer, nil]
245
252
  optional :input_cache_write_tokens, Integer
@@ -335,7 +342,7 @@ module OpenAI
335
342
  # @return [String, nil]
336
343
  optional :user_id, String, nil?: true
337
344
 
338
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
345
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
339
346
  # The aggregated completions usage details of the specific time bucket.
340
347
  #
341
348
  # @param input_tokens [Integer]
@@ -372,9 +379,13 @@ module OpenAI
372
379
  # The aggregated number of input tokens written to the cache with a 12-hour
373
380
  # retention period.
374
381
  #
375
- # @param input_cache_write_tokens [Integer]
382
+ # @param input_cache_write_30m_tokens [Integer, nil]
376
383
  # The aggregated number of input tokens written to the cache with a 30-minute
377
- # retention period.
384
+ # retention period. May be absent or null for older responses.
385
+ #
386
+ # @param input_cache_write_tokens [Integer]
387
+ # The aggregated number of input tokens written to the cache across 30-minute and
388
+ # 12-hour retention periods.
378
389
  #
379
390
  # @param input_cached_audio_tokens [Integer]
380
391
  # The aggregated number of cached audio input tokens used.
@@ -233,9 +233,16 @@ module OpenAI
233
233
  # @return [Integer, nil]
234
234
  optional :input_cache_write_12h_tokens, Integer
235
235
 
236
- # @!attribute input_cache_write_tokens
236
+ # @!attribute input_cache_write_30m_tokens
237
237
  # The aggregated number of input tokens written to the cache with a 30-minute
238
- # retention period.
238
+ # retention period. May be absent or null for older responses.
239
+ #
240
+ # @return [Integer, nil]
241
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
242
+
243
+ # @!attribute input_cache_write_tokens
244
+ # The aggregated number of input tokens written to the cache across 30-minute and
245
+ # 12-hour retention periods.
239
246
  #
240
247
  # @return [Integer, nil]
241
248
  optional :input_cache_write_tokens, Integer
@@ -331,7 +338,7 @@ module OpenAI
331
338
  # @return [String, nil]
332
339
  optional :user_id, String, nil?: true
333
340
 
334
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
341
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
335
342
  # The aggregated completions usage details of the specific time bucket.
336
343
  #
337
344
  # @param input_tokens [Integer]
@@ -368,9 +375,13 @@ module OpenAI
368
375
  # The aggregated number of input tokens written to the cache with a 12-hour
369
376
  # retention period.
370
377
  #
371
- # @param input_cache_write_tokens [Integer]
378
+ # @param input_cache_write_30m_tokens [Integer, nil]
372
379
  # The aggregated number of input tokens written to the cache with a 30-minute
373
- # retention period.
380
+ # retention period. May be absent or null for older responses.
381
+ #
382
+ # @param input_cache_write_tokens [Integer]
383
+ # The aggregated number of input tokens written to the cache across 30-minute and
384
+ # 12-hour retention periods.
374
385
  #
375
386
  # @param input_cached_audio_tokens [Integer]
376
387
  # The aggregated number of cached audio input tokens used.
@@ -231,9 +231,16 @@ module OpenAI
231
231
  # @return [Integer, nil]
232
232
  optional :input_cache_write_12h_tokens, Integer
233
233
 
234
- # @!attribute input_cache_write_tokens
234
+ # @!attribute input_cache_write_30m_tokens
235
235
  # The aggregated number of input tokens written to the cache with a 30-minute
236
- # retention period.
236
+ # retention period. May be absent or null for older responses.
237
+ #
238
+ # @return [Integer, nil]
239
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
240
+
241
+ # @!attribute input_cache_write_tokens
242
+ # The aggregated number of input tokens written to the cache across 30-minute and
243
+ # 12-hour retention periods.
237
244
  #
238
245
  # @return [Integer, nil]
239
246
  optional :input_cache_write_tokens, Integer
@@ -329,7 +336,7 @@ module OpenAI
329
336
  # @return [String, nil]
330
337
  optional :user_id, String, nil?: true
331
338
 
332
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
339
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
333
340
  # The aggregated completions usage details of the specific time bucket.
334
341
  #
335
342
  # @param input_tokens [Integer]
@@ -366,9 +373,13 @@ module OpenAI
366
373
  # The aggregated number of input tokens written to the cache with a 12-hour
367
374
  # retention period.
368
375
  #
369
- # @param input_cache_write_tokens [Integer]
376
+ # @param input_cache_write_30m_tokens [Integer, nil]
370
377
  # The aggregated number of input tokens written to the cache with a 30-minute
371
- # retention period.
378
+ # retention period. May be absent or null for older responses.
379
+ #
380
+ # @param input_cache_write_tokens [Integer]
381
+ # The aggregated number of input tokens written to the cache across 30-minute and
382
+ # 12-hour retention periods.
372
383
  #
373
384
  # @param input_cached_audio_tokens [Integer]
374
385
  # The aggregated number of cached audio input tokens used.
@@ -137,11 +137,18 @@ module OpenAI
137
137
  # @return [Integer, nil]
138
138
  optional :input_cache_write_12h_tokens, Integer, nil?: true
139
139
 
140
- # @!attribute input_cache_write_tokens
140
+ # @!attribute input_cache_write_30m_tokens
141
141
  # The aggregated number of input tokens written to the cache with a 30-minute
142
142
  # retention period.
143
143
  #
144
144
  # @return [Integer, nil]
145
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
146
+
147
+ # @!attribute input_cache_write_tokens
148
+ # The aggregated number of input tokens written to the cache across 30-minute and
149
+ # 12-hour retention periods.
150
+ #
151
+ # @return [Integer, nil]
145
152
  optional :input_cache_write_tokens, Integer, nil?: true
146
153
 
147
154
  # @!attribute input_cached_audio_tokens
@@ -235,7 +242,7 @@ module OpenAI
235
242
  # @return [String, nil]
236
243
  optional :user_id, String, nil?: true
237
244
 
238
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.decisions.result")
245
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.decisions.result")
239
246
  # The aggregated Decisions API usage details of the specific time bucket.
240
247
  #
241
248
  # @param input_tokens [Integer]
@@ -272,10 +279,14 @@ module OpenAI
272
279
  # The aggregated number of input tokens written to the cache with a 12-hour
273
280
  # retention period.
274
281
  #
275
- # @param input_cache_write_tokens [Integer, nil]
282
+ # @param input_cache_write_30m_tokens [Integer, nil]
276
283
  # The aggregated number of input tokens written to the cache with a 30-minute
277
284
  # retention period.
278
285
  #
286
+ # @param input_cache_write_tokens [Integer, nil]
287
+ # The aggregated number of input tokens written to the cache across 30-minute and
288
+ # 12-hour retention periods.
289
+ #
279
290
  # @param input_cached_audio_tokens [Integer, nil]
280
291
  # The aggregated number of cached audio input tokens used.
281
292
  #
@@ -233,9 +233,16 @@ module OpenAI
233
233
  # @return [Integer, nil]
234
234
  optional :input_cache_write_12h_tokens, Integer
235
235
 
236
- # @!attribute input_cache_write_tokens
236
+ # @!attribute input_cache_write_30m_tokens
237
237
  # The aggregated number of input tokens written to the cache with a 30-minute
238
- # retention period.
238
+ # retention period. May be absent or null for older responses.
239
+ #
240
+ # @return [Integer, nil]
241
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
242
+
243
+ # @!attribute input_cache_write_tokens
244
+ # The aggregated number of input tokens written to the cache across 30-minute and
245
+ # 12-hour retention periods.
239
246
  #
240
247
  # @return [Integer, nil]
241
248
  optional :input_cache_write_tokens, Integer
@@ -331,7 +338,7 @@ module OpenAI
331
338
  # @return [String, nil]
332
339
  optional :user_id, String, nil?: true
333
340
 
334
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
341
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
335
342
  # The aggregated completions usage details of the specific time bucket.
336
343
  #
337
344
  # @param input_tokens [Integer]
@@ -368,9 +375,13 @@ module OpenAI
368
375
  # The aggregated number of input tokens written to the cache with a 12-hour
369
376
  # retention period.
370
377
  #
371
- # @param input_cache_write_tokens [Integer]
378
+ # @param input_cache_write_30m_tokens [Integer, nil]
372
379
  # The aggregated number of input tokens written to the cache with a 30-minute
373
- # retention period.
380
+ # retention period. May be absent or null for older responses.
381
+ #
382
+ # @param input_cache_write_tokens [Integer]
383
+ # The aggregated number of input tokens written to the cache across 30-minute and
384
+ # 12-hour retention periods.
374
385
  #
375
386
  # @param input_cached_audio_tokens [Integer]
376
387
  # The aggregated number of cached audio input tokens used.
@@ -235,9 +235,16 @@ module OpenAI
235
235
  # @return [Integer, nil]
236
236
  optional :input_cache_write_12h_tokens, Integer
237
237
 
238
- # @!attribute input_cache_write_tokens
238
+ # @!attribute input_cache_write_30m_tokens
239
239
  # The aggregated number of input tokens written to the cache with a 30-minute
240
- # retention period.
240
+ # retention period. May be absent or null for older responses.
241
+ #
242
+ # @return [Integer, nil]
243
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
244
+
245
+ # @!attribute input_cache_write_tokens
246
+ # The aggregated number of input tokens written to the cache across 30-minute and
247
+ # 12-hour retention periods.
241
248
  #
242
249
  # @return [Integer, nil]
243
250
  optional :input_cache_write_tokens, Integer
@@ -333,7 +340,7 @@ module OpenAI
333
340
  # @return [String, nil]
334
341
  optional :user_id, String, nil?: true
335
342
 
336
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
343
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
337
344
  # The aggregated completions usage details of the specific time bucket.
338
345
  #
339
346
  # @param input_tokens [Integer]
@@ -370,9 +377,13 @@ module OpenAI
370
377
  # The aggregated number of input tokens written to the cache with a 12-hour
371
378
  # retention period.
372
379
  #
373
- # @param input_cache_write_tokens [Integer]
380
+ # @param input_cache_write_30m_tokens [Integer, nil]
374
381
  # The aggregated number of input tokens written to the cache with a 30-minute
375
- # retention period.
382
+ # retention period. May be absent or null for older responses.
383
+ #
384
+ # @param input_cache_write_tokens [Integer]
385
+ # The aggregated number of input tokens written to the cache across 30-minute and
386
+ # 12-hour retention periods.
376
387
  #
377
388
  # @param input_cached_audio_tokens [Integer]
378
389
  # The aggregated number of cached audio input tokens used.
@@ -231,9 +231,16 @@ module OpenAI
231
231
  # @return [Integer, nil]
232
232
  optional :input_cache_write_12h_tokens, Integer
233
233
 
234
- # @!attribute input_cache_write_tokens
234
+ # @!attribute input_cache_write_30m_tokens
235
235
  # The aggregated number of input tokens written to the cache with a 30-minute
236
- # retention period.
236
+ # retention period. May be absent or null for older responses.
237
+ #
238
+ # @return [Integer, nil]
239
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
240
+
241
+ # @!attribute input_cache_write_tokens
242
+ # The aggregated number of input tokens written to the cache across 30-minute and
243
+ # 12-hour retention periods.
237
244
  #
238
245
  # @return [Integer, nil]
239
246
  optional :input_cache_write_tokens, Integer
@@ -329,7 +336,7 @@ module OpenAI
329
336
  # @return [String, nil]
330
337
  optional :user_id, String, nil?: true
331
338
 
332
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
339
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
333
340
  # The aggregated completions usage details of the specific time bucket.
334
341
  #
335
342
  # @param input_tokens [Integer]
@@ -366,9 +373,13 @@ module OpenAI
366
373
  # The aggregated number of input tokens written to the cache with a 12-hour
367
374
  # retention period.
368
375
  #
369
- # @param input_cache_write_tokens [Integer]
376
+ # @param input_cache_write_30m_tokens [Integer, nil]
370
377
  # The aggregated number of input tokens written to the cache with a 30-minute
371
- # retention period.
378
+ # retention period. May be absent or null for older responses.
379
+ #
380
+ # @param input_cache_write_tokens [Integer]
381
+ # The aggregated number of input tokens written to the cache across 30-minute and
382
+ # 12-hour retention periods.
372
383
  #
373
384
  # @param input_cached_audio_tokens [Integer]
374
385
  # The aggregated number of cached audio input tokens used.
@@ -233,9 +233,16 @@ module OpenAI
233
233
  # @return [Integer, nil]
234
234
  optional :input_cache_write_12h_tokens, Integer
235
235
 
236
- # @!attribute input_cache_write_tokens
236
+ # @!attribute input_cache_write_30m_tokens
237
237
  # The aggregated number of input tokens written to the cache with a 30-minute
238
- # retention period.
238
+ # retention period. May be absent or null for older responses.
239
+ #
240
+ # @return [Integer, nil]
241
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
242
+
243
+ # @!attribute input_cache_write_tokens
244
+ # The aggregated number of input tokens written to the cache across 30-minute and
245
+ # 12-hour retention periods.
239
246
  #
240
247
  # @return [Integer, nil]
241
248
  optional :input_cache_write_tokens, Integer
@@ -331,7 +338,7 @@ module OpenAI
331
338
  # @return [String, nil]
332
339
  optional :user_id, String, nil?: true
333
340
 
334
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
341
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
335
342
  # The aggregated completions usage details of the specific time bucket.
336
343
  #
337
344
  # @param input_tokens [Integer]
@@ -368,9 +375,13 @@ module OpenAI
368
375
  # The aggregated number of input tokens written to the cache with a 12-hour
369
376
  # retention period.
370
377
  #
371
- # @param input_cache_write_tokens [Integer]
378
+ # @param input_cache_write_30m_tokens [Integer, nil]
372
379
  # The aggregated number of input tokens written to the cache with a 30-minute
373
- # retention period.
380
+ # retention period. May be absent or null for older responses.
381
+ #
382
+ # @param input_cache_write_tokens [Integer]
383
+ # The aggregated number of input tokens written to the cache across 30-minute and
384
+ # 12-hour retention periods.
374
385
  #
375
386
  # @param input_cached_audio_tokens [Integer]
376
387
  # The aggregated number of cached audio input tokens used.
@@ -235,9 +235,16 @@ module OpenAI
235
235
  # @return [Integer, nil]
236
236
  optional :input_cache_write_12h_tokens, Integer
237
237
 
238
- # @!attribute input_cache_write_tokens
238
+ # @!attribute input_cache_write_30m_tokens
239
239
  # The aggregated number of input tokens written to the cache with a 30-minute
240
- # retention period.
240
+ # retention period. May be absent or null for older responses.
241
+ #
242
+ # @return [Integer, nil]
243
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
244
+
245
+ # @!attribute input_cache_write_tokens
246
+ # The aggregated number of input tokens written to the cache across 30-minute and
247
+ # 12-hour retention periods.
241
248
  #
242
249
  # @return [Integer, nil]
243
250
  optional :input_cache_write_tokens, Integer
@@ -333,7 +340,7 @@ module OpenAI
333
340
  # @return [String, nil]
334
341
  optional :user_id, String, nil?: true
335
342
 
336
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
343
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
337
344
  # The aggregated completions usage details of the specific time bucket.
338
345
  #
339
346
  # @param input_tokens [Integer]
@@ -370,9 +377,13 @@ module OpenAI
370
377
  # The aggregated number of input tokens written to the cache with a 12-hour
371
378
  # retention period.
372
379
  #
373
- # @param input_cache_write_tokens [Integer]
380
+ # @param input_cache_write_30m_tokens [Integer, nil]
374
381
  # The aggregated number of input tokens written to the cache with a 30-minute
375
- # retention period.
382
+ # retention period. May be absent or null for older responses.
383
+ #
384
+ # @param input_cache_write_tokens [Integer]
385
+ # The aggregated number of input tokens written to the cache across 30-minute and
386
+ # 12-hour retention periods.
376
387
  #
377
388
  # @param input_cached_audio_tokens [Integer]
378
389
  # The aggregated number of cached audio input tokens used.
@@ -235,9 +235,16 @@ module OpenAI
235
235
  # @return [Integer, nil]
236
236
  optional :input_cache_write_12h_tokens, Integer
237
237
 
238
- # @!attribute input_cache_write_tokens
238
+ # @!attribute input_cache_write_30m_tokens
239
239
  # The aggregated number of input tokens written to the cache with a 30-minute
240
- # retention period.
240
+ # retention period. May be absent or null for older responses.
241
+ #
242
+ # @return [Integer, nil]
243
+ optional :input_cache_write_30m_tokens, Integer, nil?: true
244
+
245
+ # @!attribute input_cache_write_tokens
246
+ # The aggregated number of input tokens written to the cache across 30-minute and
247
+ # 12-hour retention periods.
241
248
  #
242
249
  # @return [Integer, nil]
243
250
  optional :input_cache_write_tokens, Integer
@@ -333,7 +340,7 @@ module OpenAI
333
340
  # @return [String, nil]
334
341
  optional :user_id, String, nil?: true
335
342
 
336
- # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
343
+ # @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, api_source: nil, batch: nil, input_audio_tokens: nil, input_cache_write_12h_tokens: nil, input_cache_write_30m_tokens: nil, input_cache_write_tokens: nil, input_cached_audio_tokens: nil, input_cached_image_tokens: nil, input_cached_text_tokens: nil, input_cached_tokens: nil, input_image_tokens: nil, input_text_tokens: nil, input_uncached_tokens: nil, model: nil, output_audio_tokens: nil, output_image_tokens: nil, output_text_tokens: nil, project_id: nil, service_tier: nil, user_id: nil, object: :"organization.usage.completions.result")
337
344
  # The aggregated completions usage details of the specific time bucket.
338
345
  #
339
346
  # @param input_tokens [Integer]
@@ -370,9 +377,13 @@ module OpenAI
370
377
  # The aggregated number of input tokens written to the cache with a 12-hour
371
378
  # retention period.
372
379
  #
373
- # @param input_cache_write_tokens [Integer]
380
+ # @param input_cache_write_30m_tokens [Integer, nil]
374
381
  # The aggregated number of input tokens written to the cache with a 30-minute
375
- # retention period.
382
+ # retention period. May be absent or null for older responses.
383
+ #
384
+ # @param input_cache_write_tokens [Integer]
385
+ # The aggregated number of input tokens written to the cache across 30-minute and
386
+ # 12-hour retention periods.
376
387
  #
377
388
  # @param input_cached_audio_tokens [Integer]
378
389
  # The aggregated number of cached audio input tokens used.
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Audio
6
+ # @see OpenAI::Resources::Audio::VoiceConsents#create
7
+ class VoiceConsent < OpenAI::Internal::Type::BaseModel
8
+ # @!attribute id
9
+ # The consent recording identifier.
10
+ #
11
+ # @return [String]
12
+ required :id, String
13
+
14
+ # @!attribute created_at
15
+ # The Unix timestamp (in seconds) for when the consent recording was created.
16
+ #
17
+ # @return [Integer]
18
+ required :created_at, Integer
19
+
20
+ # @!attribute language
21
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
22
+ #
23
+ # @return [String]
24
+ required :language, String
25
+
26
+ # @!attribute name
27
+ # The label provided when the consent recording was uploaded.
28
+ #
29
+ # @return [String]
30
+ required :name, String
31
+
32
+ # @!attribute object
33
+ # The object type, which is always `audio.voice_consent`.
34
+ #
35
+ # @return [Symbol, :"audio.voice_consent"]
36
+ required :object, const: :"audio.voice_consent"
37
+
38
+ # @!method initialize(id:, created_at:, language:, name:, object: :"audio.voice_consent")
39
+ # A consent recording used to authorize creation of a custom voice.
40
+ #
41
+ # @param id [String]
42
+ # The consent recording identifier.
43
+ #
44
+ # @param created_at [Integer]
45
+ # The Unix timestamp (in seconds) for when the consent recording was created.
46
+ #
47
+ # @param language [String]
48
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
49
+ #
50
+ # @param name [String]
51
+ # The label provided when the consent recording was uploaded.
52
+ #
53
+ # @param object [Symbol, :"audio.voice_consent"]
54
+ # The object type, which is always `audio.voice_consent`.
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Audio
6
+ # @see OpenAI::Resources::Audio::VoiceConsents#create
7
+ class VoiceConsentCreateParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!attribute language
12
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
13
+ #
14
+ # @return [String]
15
+ required :language, String
16
+
17
+ # @!attribute name
18
+ # The label to use for this consent recording.
19
+ #
20
+ # @return [String]
21
+ required :name, String
22
+
23
+ # @!attribute recording
24
+ # The consent audio recording file. Maximum size is 10 MiB.
25
+ #
26
+ # Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`,
27
+ # `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
28
+ #
29
+ # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
30
+ # metadata. Use `OpenAI::FilePart` when you need to override the filename or
31
+ # content type.
32
+ #
33
+ # @return [Pathname, StringIO, IO, String, OpenAI::FilePart]
34
+ required :recording, OpenAI::Internal::Type::FileInput
35
+
36
+ # @!method initialize(language:, name:, recording:, request_options: {})
37
+ # @param language [String]
38
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
39
+ #
40
+ # @param name [String]
41
+ # The label to use for this consent recording.
42
+ #
43
+ # @param recording [Pathname, StringIO, IO, String, OpenAI::FilePart]
44
+ # The consent audio recording file. Maximum size is 10 MiB.
45
+ #
46
+ # Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`,
47
+ # `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
48
+ #
49
+ # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
50
+ # metadata. Use `OpenAI::FilePart` when you need to override the filename or
51
+ # content type.
52
+ #
53
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Audio
6
+ # @see OpenAI::Resources::Audio::VoiceConsents#delete
7
+ class VoiceConsentDeleteParams < OpenAI::Internal::Type::BaseModel
8
+ extend OpenAI::Internal::Type::RequestParameters::Converter
9
+ include OpenAI::Internal::Type::RequestParameters
10
+
11
+ # @!attribute consent_id
12
+ #
13
+ # @return [String]
14
+ required :consent_id, String
15
+
16
+ # @!method initialize(consent_id:, request_options: {})
17
+ # @param consent_id [String]
18
+ # @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OpenAI
4
+ module Models
5
+ module Audio
6
+ # @see OpenAI::Resources::Audio::VoiceConsents#delete
7
+ class VoiceConsentDeleted < OpenAI::Internal::Type::BaseModel
8
+ # @!attribute id
9
+ # The consent recording identifier.
10
+ #
11
+ # @return [String]
12
+ required :id, String
13
+
14
+ # @!attribute deleted
15
+ #
16
+ # @return [Boolean]
17
+ required :deleted, OpenAI::Internal::Type::Boolean
18
+
19
+ # @!attribute object
20
+ #
21
+ # @return [Symbol, :"audio.voice_consent"]
22
+ required :object, const: :"audio.voice_consent"
23
+
24
+ # @!method initialize(id:, deleted:, object: :"audio.voice_consent")
25
+ # @param id [String]
26
+ # The consent recording identifier.
27
+ #
28
+ # @param deleted [Boolean]
29
+ #
30
+ # @param object [Symbol, :"audio.voice_consent"]
31
+ end
32
+ end
33
+ end
34
+ end