openai 0.107.0 → 0.109.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 (87) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/README.md +55 -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/client_runtime.rb +11 -0
  8. data/lib/openai/helpers/realtime/recovery.rb +8 -2
  9. data/lib/openai/helpers/responses_websocket/incremental.rb +5 -1
  10. data/lib/openai/helpers/responses_websocket/session.rb +11 -4
  11. data/lib/openai/helpers/streaming/chat_completion_resource.rb +52 -0
  12. data/lib/openai/internal/provider.rb +1 -0
  13. data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +4 -4
  14. data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +4 -4
  15. data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +4 -4
  16. data/lib/openai/models/admin/organization/usage_completions_response.rb +4 -4
  17. data/lib/openai/models/admin/organization/usage_costs_response.rb +4 -4
  18. data/lib/openai/models/admin/organization/usage_decisions_response.rb +4 -4
  19. data/lib/openai/models/admin/organization/usage_embeddings_response.rb +4 -4
  20. data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +4 -4
  21. data/lib/openai/models/admin/organization/usage_images_response.rb +4 -4
  22. data/lib/openai/models/admin/organization/usage_moderations_response.rb +4 -4
  23. data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +4 -4
  24. data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +4 -4
  25. data/lib/openai/models/audio/voice_consent.rb +58 -0
  26. data/lib/openai/models/audio/voice_consent_create_params.rb +57 -0
  27. data/lib/openai/models/audio/voice_consent_delete_params.rb +22 -0
  28. data/lib/openai/models/audio/voice_consent_deleted.rb +34 -0
  29. data/lib/openai/models/audio/voice_consent_list_params.rb +42 -0
  30. data/lib/openai/models/audio/voice_consent_retrieve_params.rb +22 -0
  31. data/lib/openai/models/audio/voice_consent_update_params.rb +32 -0
  32. data/lib/openai/providers/vertex.rb +229 -0
  33. data/lib/openai/resources/audio/voice_consents.rb +163 -0
  34. data/lib/openai/resources/audio.rb +5 -0
  35. data/lib/openai/version.rb +1 -1
  36. data/lib/openai.rb +9 -0
  37. data/rbi/openai/helpers/chat/tool_runner.rbi +74 -0
  38. data/rbi/openai/internal/provider.rbi +3 -0
  39. data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +4 -4
  40. data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +4 -4
  41. data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +4 -4
  42. data/rbi/openai/models/admin/organization/usage_completions_response.rbi +4 -4
  43. data/rbi/openai/models/admin/organization/usage_costs_response.rbi +4 -4
  44. data/rbi/openai/models/admin/organization/usage_decisions_response.rbi +4 -4
  45. data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +4 -4
  46. data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +4 -4
  47. data/rbi/openai/models/admin/organization/usage_images_response.rbi +4 -4
  48. data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +4 -4
  49. data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +4 -4
  50. data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +4 -4
  51. data/rbi/openai/models/audio/voice_consent.rbi +86 -0
  52. data/rbi/openai/models/audio/voice_consent_create_params.rbi +92 -0
  53. data/rbi/openai/models/audio/voice_consent_delete_params.rbi +53 -0
  54. data/rbi/openai/models/audio/voice_consent_deleted.rbi +62 -0
  55. data/rbi/openai/models/audio/voice_consent_list_params.rbi +78 -0
  56. data/rbi/openai/models/audio/voice_consent_retrieve_params.rbi +53 -0
  57. data/rbi/openai/models/audio/voice_consent_update_params.rbi +62 -0
  58. data/rbi/openai/models/response_format_json_schema.rbi +13 -11
  59. data/rbi/openai/providers.rbi +13 -0
  60. data/rbi/openai/resources/audio/voice_consents.rbi +108 -0
  61. data/rbi/openai/resources/audio.rbi +4 -0
  62. data/sig/openai/helpers/chat/tool_runner.rbs +48 -0
  63. data/sig/openai/internal/provider.rbs +3 -1
  64. data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +6 -6
  65. data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +6 -6
  66. data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +6 -6
  67. data/sig/openai/models/admin/organization/usage_completions_response.rbs +6 -6
  68. data/sig/openai/models/admin/organization/usage_costs_response.rbs +6 -6
  69. data/sig/openai/models/admin/organization/usage_decisions_response.rbs +4 -4
  70. data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +6 -6
  71. data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +6 -6
  72. data/sig/openai/models/admin/organization/usage_images_response.rbs +6 -6
  73. data/sig/openai/models/admin/organization/usage_moderations_response.rbs +6 -6
  74. data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +6 -6
  75. data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +6 -6
  76. data/sig/openai/models/audio/voice_consent.rbs +57 -0
  77. data/sig/openai/models/audio/voice_consent_create_params.rbs +61 -0
  78. data/sig/openai/models/audio/voice_consent_delete_params.rbs +25 -0
  79. data/sig/openai/models/audio/voice_consent_deleted.rbs +31 -0
  80. data/sig/openai/models/audio/voice_consent_list_params.rbs +57 -0
  81. data/sig/openai/models/audio/voice_consent_retrieve_params.rbs +25 -0
  82. data/sig/openai/models/audio/voice_consent_update_params.rbs +36 -0
  83. data/sig/openai/providers.rbs +8 -0
  84. data/sig/openai/resources/audio/voice_consents.rbs +38 -0
  85. data/sig/openai/resources/audio.rbs +2 -0
  86. data/vertex.md +29 -0
  87. metadata +32 -1
@@ -14,6 +14,19 @@ module OpenAI
14
14
  def azure(endpoint: nil, api_key: nil, token_provider: nil)
15
15
  end
16
16
 
17
+ sig do
18
+ params(
19
+ project: T.nilable(String),
20
+ location: T.nilable(String),
21
+ base_url: T.nilable(String),
22
+ token_provider: T.nilable(T.proc.returns(String)),
23
+ credentials: T.untyped
24
+ )
25
+ .returns(OpenAI::Provider)
26
+ end
27
+ def vertex(project: nil, location: nil, base_url: nil, token_provider: nil, credentials: nil)
28
+ end
29
+
17
30
  sig do
18
31
  params(
19
32
  endpoint: T.nilable(T.any(String, Symbol)),
@@ -0,0 +1,108 @@
1
+ # typed: strong
2
+
3
+ module OpenAI
4
+ module Resources
5
+
6
+ class Audio
7
+
8
+ # Turn audio into text or text into audio.
9
+ class VoiceConsents
10
+
11
+ # Upload a voice consent recording.
12
+ sig {
13
+ params(
14
+ language: String,
15
+ name: String,
16
+ recording: OpenAI::Internal::FileInput,
17
+ request_options: OpenAI::RequestOptions::OrHash
18
+ )
19
+ .returns(OpenAI::Audio::VoiceConsent)
20
+ }
21
+ def create(
22
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
23
+ language:,
24
+ # The label to use for this consent recording.
25
+ name:,
26
+ # The consent audio recording file. Maximum size is 10 MiB.
27
+ #
28
+ # Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`,
29
+ # `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
30
+ #
31
+ # `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
32
+ # metadata. Use `OpenAI::FilePart` when you need to override the filename or
33
+ # content type.
34
+ recording:,
35
+ request_options: {}
36
+ )
37
+ end
38
+
39
+ # Retrieves a voice consent recording.
40
+ sig {
41
+ params(consent_id: String, request_options: OpenAI::RequestOptions::OrHash).returns(
42
+ OpenAI::Audio::VoiceConsent
43
+ )
44
+ }
45
+ def retrieve(
46
+ # The ID of the consent recording to retrieve.
47
+ consent_id,
48
+ request_options: {}
49
+ )
50
+ end
51
+
52
+ # Updates a voice consent recording (metadata only).
53
+ sig {
54
+ params(consent_id: String, name: String, request_options: OpenAI::RequestOptions::OrHash).returns(
55
+ OpenAI::Audio::VoiceConsent
56
+ )
57
+ }
58
+ def update(
59
+ # The ID of the consent recording to update.
60
+ consent_id,
61
+ # The updated label for this consent recording.
62
+ name:,
63
+ request_options: {}
64
+ )
65
+ end
66
+
67
+ # Returns a list of voice consent recordings.
68
+ sig {
69
+ params(after: String, limit: Integer, request_options: OpenAI::RequestOptions::OrHash).returns(
70
+ OpenAI::Internal::CursorPage[OpenAI::Audio::VoiceConsent]
71
+ )
72
+ }
73
+ def list(
74
+ # A cursor for use in pagination. `after` is an object ID that defines your place
75
+ # in the list. For instance, if you make a list request and receive 100 objects,
76
+ # ending with obj_foo, your subsequent call can include after=obj_foo in order to
77
+ # fetch the next page of the list.
78
+ after: nil,
79
+ # A limit on the number of objects to be returned. Limit can range between 1 and
80
+ # 100, and the default is 20.
81
+ limit: nil,
82
+ request_options: {}
83
+ )
84
+ end
85
+
86
+ # Deletes a voice consent recording.
87
+ sig {
88
+ params(consent_id: String, request_options: OpenAI::RequestOptions::OrHash).returns(
89
+ OpenAI::Audio::VoiceConsentDeleted
90
+ )
91
+ }
92
+ def delete(
93
+ # The ID of the consent recording to delete.
94
+ consent_id,
95
+ request_options: {}
96
+ )
97
+ end
98
+
99
+ # @api private
100
+ sig { params(client: OpenAI::Client).returns(T.attached_class) }
101
+ def self.new(client:)
102
+ end
103
+ end
104
+
105
+ end
106
+
107
+ end
108
+ end
@@ -21,6 +21,10 @@ module OpenAI
21
21
  sig { returns(OpenAI::Resources::Audio::Voices) }
22
22
  attr_reader :voices
23
23
 
24
+ # Turn audio into text or text into audio.
25
+ sig { returns(OpenAI::Resources::Audio::VoiceConsents) }
26
+ attr_reader :voice_consents
27
+
24
28
  # @api private
25
29
  sig { params(client: OpenAI::Client).returns(T.attached_class) }
26
30
  def self.new(client:)
@@ -0,0 +1,48 @@
1
+ module OpenAI
2
+ module Helpers
3
+ module Chat
4
+ class ToolRunner
5
+ type handler = ^(Hash[String, untyped]) -> untyped
6
+
7
+ class Error < StandardError
8
+ end
9
+
10
+ class MaxRoundsError < Error
11
+ end
12
+
13
+ # @api private
14
+ def initialize: (
15
+ completions: OpenAI::Resources::Chat::Completions,
16
+ params: Hash[Symbol, untyped],
17
+ tool_handlers: Hash[String, handler],
18
+ max_rounds: Integer
19
+ ) -> void
20
+
21
+ # @api private
22
+ def run: -> OpenAI::Chat::ChatCompletion
23
+ end
24
+ end
25
+ end
26
+
27
+ module Resources
28
+ class Chat
29
+ class Completions
30
+ # @api private
31
+ def create_for_tool_runner: (
32
+ Hash[Symbol, untyped] params
33
+ ) -> OpenAI::Chat::ChatCompletion
34
+
35
+ def run_tools: (
36
+ model: String | Symbol,
37
+ messages: Array[untyped],
38
+ tools: Array[Class
39
+ | OpenAI::Chat::ChatCompletionFunctionTool
40
+ | Hash[Symbol, untyped]],
41
+ tool_handlers: Hash[String, OpenAI::Helpers::Chat::ToolRunner::handler],
42
+ ?max_rounds: Integer,
43
+ **untyped
44
+ ) -> OpenAI::Chat::ChatCompletion
45
+ end
46
+ end
47
+ end
48
+ end
@@ -8,6 +8,7 @@ module OpenAI
8
8
  OpenAI::Internal::Transport::BaseClient::request_input
9
9
  ) -> OpenAI::Internal::Transport::BaseClient::request_input)?
10
10
  attr_accessor authentication_headers: Array[String]
11
+ attr_accessor wrap_request: Proc?
11
12
 
12
13
  def initialize: (
13
14
  name: String,
@@ -15,7 +16,8 @@ module OpenAI
15
16
  prepare_request: (^(
16
17
  OpenAI::Internal::Transport::BaseClient::request_input
17
18
  ) -> OpenAI::Internal::Transport::BaseClient::request_input)?,
18
- authentication_headers: Array[String]
19
+ authentication_headers: Array[String],
20
+ ?wrap_request: Proc?
19
21
  ) -> void
20
22
  end
21
23
 
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -134,8 +134,8 @@ module OpenAI
134
134
  # retention period.
135
135
  attr_accessor input_cache_write_30m_tokens: Integer?
136
136
 
137
- # The aggregated number of input tokens written to the cache with a 30-minute
138
- # retention period.
137
+ # The aggregated number of input tokens written to the cache across 30-minute and
138
+ # 12-hour retention periods.
139
139
  attr_accessor input_cache_write_tokens: Integer?
140
140
 
141
141
  # The aggregated number of cached audio input tokens used.
@@ -217,8 +217,8 @@ module OpenAI
217
217
  # The aggregated number of input tokens written to the cache with a 30-minute
218
218
  # retention period.
219
219
  # @param input_cache_write_tokens
220
- # The aggregated number of input tokens written to the cache with a 30-minute
221
- # retention period.
220
+ # The aggregated number of input tokens written to the cache across 30-minute and
221
+ # 12-hour retention periods.
222
222
  # @param input_cached_audio_tokens
223
223
  # The aggregated number of cached audio input tokens used.
224
224
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -157,12 +157,12 @@ module OpenAI
157
157
  # retention period. May be absent or null for older responses.
158
158
  attr_accessor input_cache_write_30m_tokens: Integer?
159
159
 
160
- # The aggregated number of input tokens written to the cache with a 30-minute
161
- # retention period.
160
+ # The aggregated number of input tokens written to the cache across 30-minute and
161
+ # 12-hour retention periods.
162
162
  attr_reader input_cache_write_tokens: Integer?
163
163
 
164
- # The aggregated number of input tokens written to the cache with a 30-minute
165
- # retention period.
164
+ # The aggregated number of input tokens written to the cache across 30-minute and
165
+ # 12-hour retention periods.
166
166
  def input_cache_write_tokens=: (Integer) -> Integer
167
167
 
168
168
  # The aggregated number of cached audio input tokens used.
@@ -277,8 +277,8 @@ module OpenAI
277
277
  # The aggregated number of input tokens written to the cache with a 30-minute
278
278
  # retention period. May be absent or null for older responses.
279
279
  # @param input_cache_write_tokens
280
- # The aggregated number of input tokens written to the cache with a 30-minute
281
- # retention period.
280
+ # The aggregated number of input tokens written to the cache across 30-minute and
281
+ # 12-hour retention periods.
282
282
  # @param input_cached_audio_tokens
283
283
  # The aggregated number of cached audio input tokens used.
284
284
  # @param input_cached_image_tokens
@@ -0,0 +1,57 @@
1
+ module OpenAI
2
+ module Models
3
+ module Audio
4
+ type voice_consent =
5
+ {
6
+ id: String,
7
+ created_at: Integer,
8
+ language: String,
9
+ name: String,
10
+ ?object: :"audio.voice_consent"
11
+ }
12
+
13
+ class VoiceConsent < OpenAI::Internal::Type::BaseModel
14
+ # The consent recording identifier.
15
+ attr_accessor id: String
16
+
17
+ # The Unix timestamp (in seconds) for when the consent recording was created.
18
+ attr_accessor created_at: Integer
19
+
20
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
21
+ attr_accessor language: String
22
+
23
+ # The label provided when the consent recording was uploaded.
24
+ attr_accessor name: String
25
+
26
+ # The object type, which is always `audio.voice_consent`.
27
+ attr_accessor object: :"audio.voice_consent"
28
+
29
+ # @param id
30
+ # The consent recording identifier.
31
+ # @param created_at
32
+ # The Unix timestamp (in seconds) for when the consent recording was created.
33
+ # @param language
34
+ # The BCP 47 language tag for the consent phrase (for example, `en-US`).
35
+ # @param name
36
+ # The label provided when the consent recording was uploaded.
37
+ # @param object
38
+ # The object type, which is always `audio.voice_consent`.
39
+ def initialize: (
40
+ id: String,
41
+ created_at: Integer,
42
+ language: String,
43
+ name: String,
44
+ ?object: :"audio.voice_consent"
45
+ ) -> void
46
+
47
+ def to_hash: -> {
48
+ id: String,
49
+ created_at: Integer,
50
+ language: String,
51
+ name: String,
52
+ ?object: :"audio.voice_consent"
53
+ }
54
+ end
55
+ end
56
+ end
57
+ end