openai 0.97.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -0
- data/README.md +76 -1
- data/lib/openai/helpers/agents/session_stream.rb +60 -3
- data/lib/openai/helpers/beta/agents/artifacts.rb +72 -0
- data/lib/openai/helpers/beta/agents/creation_stream.rb +69 -0
- data/lib/openai/helpers/beta/agents/files.rb +236 -0
- data/lib/openai/helpers/beta/agents/function_tool.rb +65 -0
- data/lib/openai/helpers/beta/agents/model_adapter.rb +27 -0
- data/lib/openai/helpers/beta/agents/result.rb +170 -0
- data/lib/openai/helpers/beta/agents/typed_output.rb +191 -0
- data/lib/openai/helpers/live/websocket.rb +7 -1
- data/lib/openai/helpers/realtime/conversation_item_variant_resolver.rb +1 -1
- data/lib/openai/helpers/responses_websocket/connection.rb +7 -1
- data/lib/openai/helpers/responses_websocket/session.rb +5 -1
- data/lib/openai/helpers/responses_websocket/transports/async_websocket.rb +12 -2
- data/lib/openai/internal/transport/base_client.rb +18 -0
- data/lib/openai/internal/type/array_of.rb +1 -1
- data/lib/openai/internal/type/base_model.rb +6 -3
- data/lib/openai/internal/type/converter.rb +50 -3
- data/lib/openai/internal/type/hash_of.rb +1 -1
- data/lib/openai/internal/type/union.rb +6 -6
- data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_completions_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_costs_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_embeddings_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_images_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_moderations_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +16 -3
- data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +16 -3
- data/lib/openai/models/all_models.rb +42 -0
- data/lib/openai/models/audio/speech_create_params.rb +6 -0
- data/lib/openai/models/audio/voice.rb +75 -0
- data/lib/openai/models/audio/voice_create_params.rb +217 -0
- data/lib/openai/models/beta/agent_create_params.rb +0 -3
- data/lib/openai/models/beta/agent_update_params.rb +0 -3
- data/lib/openai/models/beta/agents/session_create_params.rb +0 -3
- data/lib/openai/models/beta/agents/session_update_params.rb +0 -3
- data/lib/openai/models/beta/agents/sessions/session_trace.rb +64 -0
- data/lib/openai/models/beta/agents/sessions/trace_list_params.rb +68 -0
- data/lib/openai/models/beta/agents/vaults/credential.rb +8 -4
- data/lib/openai/models/beta/beta_response.rb +220 -0
- data/lib/openai/models/beta/beta_response_output_text.rb +2 -2
- data/lib/openai/models/beta/beta_response_output_text_annotation_added_event.rb +2 -2
- data/lib/openai/models/beta/beta_responses_client_event.rb +220 -0
- data/lib/openai/models/beta/beta_tool.rb +3 -9
- data/lib/openai/models/beta/environment.rb +33 -1
- data/lib/openai/models/beta/environment_param.rb +24 -1
- data/lib/openai/models/beta/response_compact_params.rb +220 -0
- data/lib/openai/models/beta/response_create_params.rb +220 -0
- data/lib/openai/models/beta/session_turn_error.rb +3 -0
- data/lib/openai/models/chat/chat_completion_audio_param.rb +6 -3
- data/lib/openai/models/chat/chat_completion_content_part_image.rb +1 -0
- data/lib/openai/models/chat_model.rb +178 -0
- data/lib/openai/models/image.rb +14 -14
- data/lib/openai/models/image_create_variation_params.rb +7 -7
- data/lib/openai/models/image_edit_params.rb +76 -87
- data/lib/openai/models/image_generate_params.rb +51 -62
- data/lib/openai/models/image_model.rb +5 -3
- data/lib/openai/models/live/fork_server_event.rb +14 -3
- data/lib/openai/models/live/server_event.rb +14 -3
- data/lib/openai/models/realtime/realtime_audio_config_output.rb +9 -6
- data/lib/openai/models/realtime/realtime_response_create_audio_output.rb +9 -6
- data/lib/openai/models/realtime/translations/client_secret_create_params.rb +28 -0
- data/lib/openai/models/responses/response_compact_params.rb +220 -0
- data/lib/openai/models/responses/response_output_text.rb +2 -2
- data/lib/openai/models/responses/response_output_text_annotation_added_event.rb +2 -2
- data/lib/openai/models/responses/tool.rb +3 -9
- data/lib/openai/models/responses_model.rb +42 -0
- data/lib/openai/models/webhooks/agent_session_action_required_webhook_event.rb +109 -0
- data/lib/openai/models/webhooks/agent_session_created_webhook_event.rb +106 -0
- data/lib/openai/models/webhooks/agent_session_failed_webhook_event.rb +86 -0
- data/lib/openai/models/webhooks/agent_session_idle_webhook_event.rb +86 -0
- data/lib/openai/models/webhooks/agent_session_in_progress_webhook_event.rb +86 -0
- data/lib/openai/models/webhooks/unwrap_webhook_event.rb +18 -2
- data/lib/openai/models/webhooks/webhook_create_params.rb +5 -0
- data/lib/openai/models/webhooks/webhook_test_params.rb +5 -0
- data/lib/openai/models/webhooks/webhook_update_params.rb +5 -0
- data/lib/openai/resources/audio/speech.rb +2 -0
- data/lib/openai/resources/audio/voices.rb +53 -0
- data/lib/openai/resources/audio.rb +5 -0
- data/lib/openai/resources/beta/agents/environments/files.rb +31 -0
- data/lib/openai/resources/beta/agents/sessions/artifacts.rb +8 -0
- data/lib/openai/resources/beta/agents/sessions/events.rb +6 -5
- data/lib/openai/resources/beta/agents/sessions/traces.rb +58 -0
- data/lib/openai/resources/beta/agents/sessions.rb +18 -5
- data/lib/openai/resources/evals/runs.rb +1 -1
- data/lib/openai/resources/images.rb +71 -103
- data/lib/openai/resources/realtime/translations/client_secrets.rb +58 -0
- data/lib/openai/resources/realtime/translations.rb +20 -0
- data/lib/openai/resources/realtime.rb +4 -0
- data/lib/openai/resources/webhooks.rb +1 -1
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +17 -1
- data/rbi/openai/helpers/agents.rbi +20 -1
- data/rbi/openai/helpers/beta/agents/artifacts.rbi +29 -0
- data/rbi/openai/helpers/beta/agents/files.rbi +65 -0
- data/rbi/openai/helpers/beta/agents/function_tool.rbi +40 -0
- data/rbi/openai/helpers/beta/agents/model_adapter.rbi +22 -0
- data/rbi/openai/helpers/beta/agents.rbi +146 -0
- data/rbi/openai/internal/transport/base_client.rbi +12 -0
- data/rbi/openai/internal/type/base_model.rbi +2 -2
- data/rbi/openai/internal/type/converter.rbi +21 -3
- data/rbi/openai/internal/type/union.rbi +6 -2
- data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_completions_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_costs_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_images_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +19 -2
- data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +19 -2
- data/rbi/openai/models/audio/speech_create_params.rbi +6 -0
- data/rbi/openai/models/audio/voice.rbi +111 -0
- data/rbi/openai/models/audio/voice_create_params.rbi +321 -0
- data/rbi/openai/models/beta/agent_create_params.rbi +0 -3
- data/rbi/openai/models/beta/agent_update_params.rbi +0 -3
- data/rbi/openai/models/beta/agents/session_create_params.rbi +0 -3
- data/rbi/openai/models/beta/agents/session_update_params.rbi +0 -3
- data/rbi/openai/models/beta/agents/sessions/session_trace.rbi +97 -0
- data/rbi/openai/models/beta/agents/sessions/trace_list_params.rbi +121 -0
- data/rbi/openai/models/beta/agents/vaults/credential.rbi +5 -5
- data/rbi/openai/models/beta/beta_response_output_text.rbi +2 -2
- data/rbi/openai/models/beta/beta_response_output_text_annotation_added_event.rbi +2 -2
- data/rbi/openai/models/beta/beta_tool.rbi +3 -9
- data/rbi/openai/models/beta/environment.rbi +29 -0
- data/rbi/openai/models/beta/environment_param.rbi +31 -0
- data/rbi/openai/models/beta/session_turn_error.rbi +3 -0
- data/rbi/openai/models/chat/chat_completion_audio_param.rbi +6 -3
- data/rbi/openai/models/chat/chat_completion_content_part_image.rbi +1 -0
- data/rbi/openai/models/image.rbi +14 -14
- data/rbi/openai/models/image_create_variation_params.rbi +6 -6
- data/rbi/openai/models/image_edit_params.rbi +61 -82
- data/rbi/openai/models/image_generate_params.rbi +30 -61
- data/rbi/openai/models/image_model.rbi +3 -3
- data/rbi/openai/models/live/fork_server_event.rbi +14 -2
- data/rbi/openai/models/live/server_event.rbi +14 -2
- data/rbi/openai/models/realtime/realtime_audio_config_output.rbi +9 -6
- data/rbi/openai/models/realtime/realtime_response_create_audio_output.rbi +9 -6
- data/rbi/openai/models/realtime/translations/client_secret_create_params.rbi +68 -0
- data/rbi/openai/models/responses/response_output_text.rbi +2 -2
- data/rbi/openai/models/responses/response_output_text_annotation_added_event.rbi +2 -2
- data/rbi/openai/models/responses/tool.rbi +3 -9
- data/rbi/openai/models/webhooks/agent_session_action_required_webhook_event.rbi +222 -0
- data/rbi/openai/models/webhooks/agent_session_created_webhook_event.rbi +202 -0
- data/rbi/openai/models/webhooks/agent_session_failed_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/agent_session_idle_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/agent_session_in_progress_webhook_event.rbi +151 -0
- data/rbi/openai/models/webhooks/unwrap_webhook_event.rbi +7 -1
- data/rbi/openai/models/webhooks/webhook_create_params.rbi +20 -0
- data/rbi/openai/models/webhooks/webhook_test_params.rbi +20 -0
- data/rbi/openai/models/webhooks/webhook_update_params.rbi +20 -0
- data/rbi/openai/resources/audio/speech.rbi +2 -0
- data/rbi/openai/resources/audio/voices.rbi +49 -0
- data/rbi/openai/resources/audio.rbi +4 -0
- data/rbi/openai/resources/beta/agents/environments/files.rbi +31 -0
- data/rbi/openai/resources/beta/agents/sessions/artifacts.rbi +8 -0
- data/rbi/openai/resources/beta/agents/sessions/events.rbi +6 -5
- data/rbi/openai/resources/beta/agents/sessions/traces.rbi +54 -0
- data/rbi/openai/resources/beta/agents/sessions.rbi +6 -1
- data/rbi/openai/resources/images.rbi +69 -103
- data/rbi/openai/resources/realtime/translations/client_secrets.rbi +54 -0
- data/rbi/openai/resources/realtime/translations.rbi +22 -0
- data/rbi/openai/resources/realtime.rbi +3 -0
- data/rbi/openai/resources/webhooks.rbi +5 -0
- data/sig/openai/helpers/agents.rbs +7 -0
- data/sig/openai/helpers/beta/agents/artifacts.rbs +20 -0
- data/sig/openai/helpers/beta/agents/files.rbs +41 -0
- data/sig/openai/helpers/beta/agents/function_tool.rbs +24 -0
- data/sig/openai/helpers/beta/agents/model_adapter.rbs +16 -0
- data/sig/openai/helpers/beta/agents.rbs +71 -0
- data/sig/openai/helpers/structured_output.rbs +12 -0
- data/sig/openai/internal/transport/base_client.rbs +8 -0
- data/sig/openai/internal/type/base_model.rbs +3 -1
- data/sig/openai/internal/type/converter.rbs +16 -2
- data/sig/openai/internal/type/union.rbs +2 -1
- data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_completions_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_costs_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_images_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_moderations_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +20 -3
- data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +20 -3
- data/sig/openai/models/audio/speech_create_params.rbs +4 -0
- data/sig/openai/models/audio/voice.rbs +70 -0
- data/sig/openai/models/audio/voice_create_params.rbs +203 -0
- data/sig/openai/models/beta/agent_create_params.rbs +1 -5
- data/sig/openai/models/beta/agent_update_params.rbs +1 -5
- data/sig/openai/models/beta/agents/session_create_params.rbs +1 -5
- data/sig/openai/models/beta/agents/session_update_params.rbs +1 -5
- data/sig/openai/models/beta/agents/sessions/session_trace.rbs +65 -0
- data/sig/openai/models/beta/agents/sessions/trace_list_params.rbs +81 -0
- data/sig/openai/models/beta/agents/vaults/credential.rbs +5 -5
- data/sig/openai/models/beta/beta_response_output_text.rbs +2 -2
- data/sig/openai/models/beta/beta_response_output_text_annotation_added_event.rbs +2 -2
- data/sig/openai/models/beta/beta_tool.rbs +3 -9
- data/sig/openai/models/beta/environment.rbs +22 -0
- data/sig/openai/models/beta/environment_param.rbs +25 -0
- data/sig/openai/models/beta/session_turn_error.rbs +4 -0
- data/sig/openai/models/chat/chat_completion_audio_param.rbs +4 -2
- data/sig/openai/models/chat/chat_completion_content_part_image.rbs +2 -1
- data/sig/openai/models/image.rbs +21 -21
- data/sig/openai/models/image_create_variation_params.rbs +4 -4
- data/sig/openai/models/image_edit_params.rbs +46 -60
- data/sig/openai/models/image_generate_params.rbs +23 -45
- data/sig/openai/models/image_model.rbs +6 -6
- data/sig/openai/models/live/fork_server_event.rbs +17 -2
- data/sig/openai/models/live/server_event.rbs +17 -2
- data/sig/openai/models/realtime/realtime_audio_config_output.rbs +9 -6
- data/sig/openai/models/realtime/realtime_response_create_audio_output.rbs +9 -6
- data/sig/openai/models/realtime/translations/client_secret_create_params.rbs +39 -0
- data/sig/openai/models/responses/response_output_text.rbs +2 -2
- data/sig/openai/models/responses/response_output_text_annotation_added_event.rbs +2 -2
- data/sig/openai/models/responses/tool.rbs +3 -9
- data/sig/openai/models/webhooks/agent_session_action_required_webhook_event.rbs +114 -0
- data/sig/openai/models/webhooks/agent_session_created_webhook_event.rbs +115 -0
- data/sig/openai/models/webhooks/agent_session_failed_webhook_event.rbs +89 -0
- data/sig/openai/models/webhooks/agent_session_idle_webhook_event.rbs +89 -0
- data/sig/openai/models/webhooks/agent_session_in_progress_webhook_event.rbs +89 -0
- data/sig/openai/models/webhooks/unwrap_webhook_event.rbs +6 -1
- data/sig/openai/models/webhooks/webhook_create_params.rbs +10 -0
- data/sig/openai/models/webhooks/webhook_test_params.rbs +10 -0
- data/sig/openai/models/webhooks/webhook_update_params.rbs +10 -0
- data/sig/openai/resources/audio/voices.rbs +14 -0
- data/sig/openai/resources/audio.rbs +2 -0
- data/sig/openai/resources/beta/agents/environments/files.rbs +17 -0
- data/sig/openai/resources/beta/agents/sessions/artifacts.rbs +4 -0
- data/sig/openai/resources/beta/agents/sessions/traces.rbs +21 -0
- data/sig/openai/resources/beta/agents/sessions.rbs +4 -1
- data/sig/openai/resources/realtime/translations/client_secrets.rbs +17 -0
- data/sig/openai/resources/realtime/translations.rbs +11 -0
- data/sig/openai/resources/realtime.rbs +2 -0
- data/sig/openai/resources/webhooks.rbs +6 -1
- metadata +61 -1
|
@@ -135,17 +135,26 @@ module OpenAI
|
|
|
135
135
|
# @param request_only [Boolean] Exclude fields omitted by the request serializer.
|
|
136
136
|
#
|
|
137
137
|
# @return [Hash{Symbol=>Object}]
|
|
138
|
-
def new_coerce_state(translate_names: true, request_only: false)
|
|
138
|
+
def new_coerce_state(translate_names: true, request_only: false, memoize: false)
|
|
139
139
|
{
|
|
140
140
|
translate_names: translate_names,
|
|
141
141
|
request_only: request_only,
|
|
142
142
|
strictness: true,
|
|
143
143
|
exactness: {yes: 0, no: 0, maybe: 0},
|
|
144
144
|
error: nil,
|
|
145
|
-
branched: 0
|
|
145
|
+
branched: 0,
|
|
146
|
+
memo: memoize ? {}.compare_by_identity : nil
|
|
146
147
|
}
|
|
147
148
|
end
|
|
148
149
|
|
|
150
|
+
# @api private
|
|
151
|
+
# Resolve lazy schema types once within an opted-in parse.
|
|
152
|
+
def resolve_type(type_fn, state: nil)
|
|
153
|
+
return type_fn.call unless state && state[:memo]
|
|
154
|
+
cache = state[:memo][:resolved_types] ||= {}.compare_by_identity
|
|
155
|
+
cache.fetch(type_fn) { cache[type_fn] = type_fn.call }
|
|
156
|
+
end
|
|
157
|
+
|
|
149
158
|
# @api private
|
|
150
159
|
#
|
|
151
160
|
# Based on `target`, transform `value` into `target`, to the extent possible:
|
|
@@ -191,6 +200,12 @@ module OpenAI
|
|
|
191
200
|
#
|
|
192
201
|
# @return [Object]
|
|
193
202
|
def coerce(target, value, state: OpenAI::Internal::Type::Converter.new_coerce_state)
|
|
203
|
+
if state[:memo] &&
|
|
204
|
+
target.is_a?(OpenAI::Internal::Type::Converter) &&
|
|
205
|
+
(value.is_a?(Hash) || value.is_a?(Array))
|
|
206
|
+
return coerce_cached(target, value, state: state)
|
|
207
|
+
end
|
|
208
|
+
|
|
194
209
|
exactness = state.fetch(:exactness)
|
|
195
210
|
|
|
196
211
|
case target
|
|
@@ -248,6 +263,12 @@ module OpenAI
|
|
|
248
263
|
state[:error] = TypeError.new("#{value.class} can't be coerced into #{String}")
|
|
249
264
|
end
|
|
250
265
|
|
|
266
|
+
in -> { _1 <= Symbol }
|
|
267
|
+
if value.is_a?(String)
|
|
268
|
+
exactness[:yes] += 1
|
|
269
|
+
return value.to_sym
|
|
270
|
+
end
|
|
271
|
+
|
|
251
272
|
in -> { _1 <= Date || _1 <= Time }
|
|
252
273
|
Kernel.then do
|
|
253
274
|
return target.parse(value).tap { exactness[:yes] += 1 }
|
|
@@ -282,6 +303,31 @@ module OpenAI
|
|
|
282
303
|
value
|
|
283
304
|
end
|
|
284
305
|
|
|
306
|
+
# @api private
|
|
307
|
+
# Reuse converter/value pairs within one parse, including recursive collections.
|
|
308
|
+
# Identity keys avoid recursively hashing model and converter definitions.
|
|
309
|
+
def coerce_cached(target, value, state:)
|
|
310
|
+
converters = state.fetch(:memo)
|
|
311
|
+
values = converters[target] ||= {}.compare_by_identity
|
|
312
|
+
outcomes = values[value] ||= {}
|
|
313
|
+
key = state.values_at(:translate_names, :request_only, :strictness, :error)
|
|
314
|
+
exactness = state.fetch(:exactness)
|
|
315
|
+
if (cached = outcomes[key])
|
|
316
|
+
parsed, delta, error, branched = cached
|
|
317
|
+
delta.each { exactness[_1] += _2 }
|
|
318
|
+
state[:error] = error
|
|
319
|
+
state[:branched] += branched
|
|
320
|
+
return parsed
|
|
321
|
+
end
|
|
322
|
+
|
|
323
|
+
before = exactness.dup
|
|
324
|
+
branched = state.fetch(:branched)
|
|
325
|
+
parsed = target.coerce(value, state: state)
|
|
326
|
+
delta = exactness.to_h { |name, count| [name, count - before.fetch(name)] }
|
|
327
|
+
outcomes[key] = [parsed, delta, state[:error], state[:branched] - branched]
|
|
328
|
+
parsed
|
|
329
|
+
end
|
|
330
|
+
|
|
285
331
|
# @api private
|
|
286
332
|
#
|
|
287
333
|
# Coerces a value while isolating its error from sibling coercions.
|
|
@@ -350,7 +396,8 @@ module OpenAI
|
|
|
350
396
|
strictness: T::Boolean,
|
|
351
397
|
exactness: {yes: Integer, no: Integer, maybe: Integer},
|
|
352
398
|
error: T.nilable(StandardError),
|
|
353
|
-
branched: Integer
|
|
399
|
+
branched: Integer,
|
|
400
|
+
memo: T.nilable(T::Hash[T.untyped, T.untyped])
|
|
354
401
|
}
|
|
355
402
|
end
|
|
356
403
|
end
|
|
@@ -88,7 +88,7 @@ module OpenAI
|
|
|
88
88
|
# @param value [Object]
|
|
89
89
|
#
|
|
90
90
|
# @return [OpenAI::Internal::Type::Converter, Class, nil]
|
|
91
|
-
private def resolve_variant(value)
|
|
91
|
+
private def resolve_variant(value, state: nil)
|
|
92
92
|
case [@discriminator, value]
|
|
93
93
|
in [_, OpenAI::Internal::Type::BaseModel]
|
|
94
94
|
value.class
|
|
@@ -101,18 +101,18 @@ module OpenAI
|
|
|
101
101
|
|
|
102
102
|
key = key.to_sym if key.is_a?(String)
|
|
103
103
|
_, found = known_variants.find { |k,| !k.nil? && k == key }
|
|
104
|
-
return found
|
|
104
|
+
return OpenAI::Internal::Type::Converter.resolve_type(found, state: state) if found
|
|
105
105
|
|
|
106
106
|
known_variants.each do |variant_key, variant_fn|
|
|
107
107
|
next unless variant_key.nil?
|
|
108
108
|
|
|
109
|
-
target = variant_fn
|
|
109
|
+
target = OpenAI::Internal::Type::Converter.resolve_type(variant_fn, state: state)
|
|
110
110
|
next unless target.is_a?(Class) && target <= OpenAI::Internal::Type::BaseModel
|
|
111
111
|
|
|
112
112
|
field = target.known_fields[@discriminator]
|
|
113
113
|
next unless field
|
|
114
114
|
|
|
115
|
-
type = field.fetch(:type_fn)
|
|
115
|
+
type = OpenAI::Internal::Type::Converter.resolve_type(field.fetch(:type_fn), state: state)
|
|
116
116
|
next unless OpenAI::Internal::Type::Enum === type
|
|
117
117
|
|
|
118
118
|
return target if type === key
|
|
@@ -174,7 +174,7 @@ module OpenAI
|
|
|
174
174
|
def coerce(value, state:)
|
|
175
175
|
strictness = state.fetch(:strictness)
|
|
176
176
|
previous_error = state.fetch(:error)
|
|
177
|
-
if (target = resolve_variant(value))
|
|
177
|
+
if (target = resolve_variant(value, state: state))
|
|
178
178
|
return OpenAI::Internal::Type::Converter.coerce(target, value, state: state)
|
|
179
179
|
end
|
|
180
180
|
|
|
@@ -182,7 +182,7 @@ module OpenAI
|
|
|
182
182
|
|
|
183
183
|
alternatives = []
|
|
184
184
|
known_variants.each_with_index do |(_, variant_fn), index|
|
|
185
|
-
target = variant_fn
|
|
185
|
+
target = OpenAI::Internal::Type::Converter.resolve_type(variant_fn, state: state)
|
|
186
186
|
exact = state[:exactness] = {yes: 0, no: 0, maybe: 0}
|
|
187
187
|
state[:branched] += 1
|
|
188
188
|
|
|
@@ -213,8 +213,16 @@ module OpenAI
|
|
|
213
213
|
# @return [Integer, nil]
|
|
214
214
|
optional :input_audio_tokens, Integer
|
|
215
215
|
|
|
216
|
+
# @!attribute input_cache_write_12h_tokens
|
|
217
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
218
|
+
# retention period.
|
|
219
|
+
#
|
|
220
|
+
# @return [Integer, nil]
|
|
221
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
222
|
+
|
|
216
223
|
# @!attribute input_cache_write_tokens
|
|
217
|
-
# The aggregated number of input tokens written to the cache
|
|
224
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
225
|
+
# retention period.
|
|
218
226
|
#
|
|
219
227
|
# @return [Integer, nil]
|
|
220
228
|
optional :input_cache_write_tokens, Integer
|
|
@@ -310,7 +318,7 @@ module OpenAI
|
|
|
310
318
|
# @return [String, nil]
|
|
311
319
|
optional :user_id, String, nil?: true
|
|
312
320
|
|
|
313
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
321
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
314
322
|
# The aggregated completions usage details of the specific time bucket.
|
|
315
323
|
#
|
|
316
324
|
# @param input_tokens [Integer]
|
|
@@ -337,8 +345,13 @@ module OpenAI
|
|
|
337
345
|
# @param input_audio_tokens [Integer]
|
|
338
346
|
# The aggregated number of uncached audio input tokens used.
|
|
339
347
|
#
|
|
348
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
349
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
350
|
+
# retention period.
|
|
351
|
+
#
|
|
340
352
|
# @param input_cache_write_tokens [Integer]
|
|
341
|
-
# The aggregated number of input tokens written to the cache
|
|
353
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
354
|
+
# retention period.
|
|
342
355
|
#
|
|
343
356
|
# @param input_cached_audio_tokens [Integer]
|
|
344
357
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -215,8 +215,16 @@ module OpenAI
|
|
|
215
215
|
# @return [Integer, nil]
|
|
216
216
|
optional :input_audio_tokens, Integer
|
|
217
217
|
|
|
218
|
+
# @!attribute input_cache_write_12h_tokens
|
|
219
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
220
|
+
# retention period.
|
|
221
|
+
#
|
|
222
|
+
# @return [Integer, nil]
|
|
223
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
224
|
+
|
|
218
225
|
# @!attribute input_cache_write_tokens
|
|
219
|
-
# The aggregated number of input tokens written to the cache
|
|
226
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
227
|
+
# retention period.
|
|
220
228
|
#
|
|
221
229
|
# @return [Integer, nil]
|
|
222
230
|
optional :input_cache_write_tokens, Integer
|
|
@@ -312,7 +320,7 @@ module OpenAI
|
|
|
312
320
|
# @return [String, nil]
|
|
313
321
|
optional :user_id, String, nil?: true
|
|
314
322
|
|
|
315
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
323
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
316
324
|
# The aggregated completions usage details of the specific time bucket.
|
|
317
325
|
#
|
|
318
326
|
# @param input_tokens [Integer]
|
|
@@ -339,8 +347,13 @@ module OpenAI
|
|
|
339
347
|
# @param input_audio_tokens [Integer]
|
|
340
348
|
# The aggregated number of uncached audio input tokens used.
|
|
341
349
|
#
|
|
350
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
351
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
352
|
+
# retention period.
|
|
353
|
+
#
|
|
342
354
|
# @param input_cache_write_tokens [Integer]
|
|
343
|
-
# The aggregated number of input tokens written to the cache
|
|
355
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
356
|
+
# retention period.
|
|
344
357
|
#
|
|
345
358
|
# @param input_cached_audio_tokens [Integer]
|
|
346
359
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -215,8 +215,16 @@ module OpenAI
|
|
|
215
215
|
# @return [Integer, nil]
|
|
216
216
|
optional :input_audio_tokens, Integer
|
|
217
217
|
|
|
218
|
+
# @!attribute input_cache_write_12h_tokens
|
|
219
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
220
|
+
# retention period.
|
|
221
|
+
#
|
|
222
|
+
# @return [Integer, nil]
|
|
223
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
224
|
+
|
|
218
225
|
# @!attribute input_cache_write_tokens
|
|
219
|
-
# The aggregated number of input tokens written to the cache
|
|
226
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
227
|
+
# retention period.
|
|
220
228
|
#
|
|
221
229
|
# @return [Integer, nil]
|
|
222
230
|
optional :input_cache_write_tokens, Integer
|
|
@@ -312,7 +320,7 @@ module OpenAI
|
|
|
312
320
|
# @return [String, nil]
|
|
313
321
|
optional :user_id, String, nil?: true
|
|
314
322
|
|
|
315
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
323
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
316
324
|
# The aggregated completions usage details of the specific time bucket.
|
|
317
325
|
#
|
|
318
326
|
# @param input_tokens [Integer]
|
|
@@ -339,8 +347,13 @@ module OpenAI
|
|
|
339
347
|
# @param input_audio_tokens [Integer]
|
|
340
348
|
# The aggregated number of uncached audio input tokens used.
|
|
341
349
|
#
|
|
350
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
351
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
352
|
+
# retention period.
|
|
353
|
+
#
|
|
342
354
|
# @param input_cache_write_tokens [Integer]
|
|
343
|
-
# The aggregated number of input tokens written to the cache
|
|
355
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
356
|
+
# retention period.
|
|
344
357
|
#
|
|
345
358
|
# @param input_cached_audio_tokens [Integer]
|
|
346
359
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -211,8 +211,16 @@ module OpenAI
|
|
|
211
211
|
# @return [Integer, nil]
|
|
212
212
|
optional :input_audio_tokens, Integer
|
|
213
213
|
|
|
214
|
+
# @!attribute input_cache_write_12h_tokens
|
|
215
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
216
|
+
# retention period.
|
|
217
|
+
#
|
|
218
|
+
# @return [Integer, nil]
|
|
219
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
220
|
+
|
|
214
221
|
# @!attribute input_cache_write_tokens
|
|
215
|
-
# The aggregated number of input tokens written to the cache
|
|
222
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
223
|
+
# retention period.
|
|
216
224
|
#
|
|
217
225
|
# @return [Integer, nil]
|
|
218
226
|
optional :input_cache_write_tokens, Integer
|
|
@@ -308,7 +316,7 @@ module OpenAI
|
|
|
308
316
|
# @return [String, nil]
|
|
309
317
|
optional :user_id, String, nil?: true
|
|
310
318
|
|
|
311
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
319
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
312
320
|
# The aggregated completions usage details of the specific time bucket.
|
|
313
321
|
#
|
|
314
322
|
# @param input_tokens [Integer]
|
|
@@ -335,8 +343,13 @@ module OpenAI
|
|
|
335
343
|
# @param input_audio_tokens [Integer]
|
|
336
344
|
# The aggregated number of uncached audio input tokens used.
|
|
337
345
|
#
|
|
346
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
347
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
348
|
+
# retention period.
|
|
349
|
+
#
|
|
338
350
|
# @param input_cache_write_tokens [Integer]
|
|
339
|
-
# The aggregated number of input tokens written to the cache
|
|
351
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
352
|
+
# retention period.
|
|
340
353
|
#
|
|
341
354
|
# @param input_cached_audio_tokens [Integer]
|
|
342
355
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -209,8 +209,16 @@ module OpenAI
|
|
|
209
209
|
# @return [Integer, nil]
|
|
210
210
|
optional :input_audio_tokens, Integer
|
|
211
211
|
|
|
212
|
+
# @!attribute input_cache_write_12h_tokens
|
|
213
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
214
|
+
# retention period.
|
|
215
|
+
#
|
|
216
|
+
# @return [Integer, nil]
|
|
217
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
218
|
+
|
|
212
219
|
# @!attribute input_cache_write_tokens
|
|
213
|
-
# The aggregated number of input tokens written to the cache
|
|
220
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
221
|
+
# retention period.
|
|
214
222
|
#
|
|
215
223
|
# @return [Integer, nil]
|
|
216
224
|
optional :input_cache_write_tokens, Integer
|
|
@@ -306,7 +314,7 @@ module OpenAI
|
|
|
306
314
|
# @return [String, nil]
|
|
307
315
|
optional :user_id, String, nil?: true
|
|
308
316
|
|
|
309
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
317
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
310
318
|
# The aggregated completions usage details of the specific time bucket.
|
|
311
319
|
#
|
|
312
320
|
# @param input_tokens [Integer]
|
|
@@ -333,8 +341,13 @@ module OpenAI
|
|
|
333
341
|
# @param input_audio_tokens [Integer]
|
|
334
342
|
# The aggregated number of uncached audio input tokens used.
|
|
335
343
|
#
|
|
344
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
345
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
346
|
+
# retention period.
|
|
347
|
+
#
|
|
336
348
|
# @param input_cache_write_tokens [Integer]
|
|
337
|
-
# The aggregated number of input tokens written to the cache
|
|
349
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
350
|
+
# retention period.
|
|
338
351
|
#
|
|
339
352
|
# @param input_cached_audio_tokens [Integer]
|
|
340
353
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -211,8 +211,16 @@ module OpenAI
|
|
|
211
211
|
# @return [Integer, nil]
|
|
212
212
|
optional :input_audio_tokens, Integer
|
|
213
213
|
|
|
214
|
+
# @!attribute input_cache_write_12h_tokens
|
|
215
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
216
|
+
# retention period.
|
|
217
|
+
#
|
|
218
|
+
# @return [Integer, nil]
|
|
219
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
220
|
+
|
|
214
221
|
# @!attribute input_cache_write_tokens
|
|
215
|
-
# The aggregated number of input tokens written to the cache
|
|
222
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
223
|
+
# retention period.
|
|
216
224
|
#
|
|
217
225
|
# @return [Integer, nil]
|
|
218
226
|
optional :input_cache_write_tokens, Integer
|
|
@@ -308,7 +316,7 @@ module OpenAI
|
|
|
308
316
|
# @return [String, nil]
|
|
309
317
|
optional :user_id, String, nil?: true
|
|
310
318
|
|
|
311
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
319
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
312
320
|
# The aggregated completions usage details of the specific time bucket.
|
|
313
321
|
#
|
|
314
322
|
# @param input_tokens [Integer]
|
|
@@ -335,8 +343,13 @@ module OpenAI
|
|
|
335
343
|
# @param input_audio_tokens [Integer]
|
|
336
344
|
# The aggregated number of uncached audio input tokens used.
|
|
337
345
|
#
|
|
346
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
347
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
348
|
+
# retention period.
|
|
349
|
+
#
|
|
338
350
|
# @param input_cache_write_tokens [Integer]
|
|
339
|
-
# The aggregated number of input tokens written to the cache
|
|
351
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
352
|
+
# retention period.
|
|
340
353
|
#
|
|
341
354
|
# @param input_cached_audio_tokens [Integer]
|
|
342
355
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -213,8 +213,16 @@ module OpenAI
|
|
|
213
213
|
# @return [Integer, nil]
|
|
214
214
|
optional :input_audio_tokens, Integer
|
|
215
215
|
|
|
216
|
+
# @!attribute input_cache_write_12h_tokens
|
|
217
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
218
|
+
# retention period.
|
|
219
|
+
#
|
|
220
|
+
# @return [Integer, nil]
|
|
221
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
222
|
+
|
|
216
223
|
# @!attribute input_cache_write_tokens
|
|
217
|
-
# The aggregated number of input tokens written to the cache
|
|
224
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
225
|
+
# retention period.
|
|
218
226
|
#
|
|
219
227
|
# @return [Integer, nil]
|
|
220
228
|
optional :input_cache_write_tokens, Integer
|
|
@@ -310,7 +318,7 @@ module OpenAI
|
|
|
310
318
|
# @return [String, nil]
|
|
311
319
|
optional :user_id, String, nil?: true
|
|
312
320
|
|
|
313
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
321
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
314
322
|
# The aggregated completions usage details of the specific time bucket.
|
|
315
323
|
#
|
|
316
324
|
# @param input_tokens [Integer]
|
|
@@ -337,8 +345,13 @@ module OpenAI
|
|
|
337
345
|
# @param input_audio_tokens [Integer]
|
|
338
346
|
# The aggregated number of uncached audio input tokens used.
|
|
339
347
|
#
|
|
348
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
349
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
350
|
+
# retention period.
|
|
351
|
+
#
|
|
340
352
|
# @param input_cache_write_tokens [Integer]
|
|
341
|
-
# The aggregated number of input tokens written to the cache
|
|
353
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
354
|
+
# retention period.
|
|
342
355
|
#
|
|
343
356
|
# @param input_cached_audio_tokens [Integer]
|
|
344
357
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -209,8 +209,16 @@ module OpenAI
|
|
|
209
209
|
# @return [Integer, nil]
|
|
210
210
|
optional :input_audio_tokens, Integer
|
|
211
211
|
|
|
212
|
+
# @!attribute input_cache_write_12h_tokens
|
|
213
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
214
|
+
# retention period.
|
|
215
|
+
#
|
|
216
|
+
# @return [Integer, nil]
|
|
217
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
218
|
+
|
|
212
219
|
# @!attribute input_cache_write_tokens
|
|
213
|
-
# The aggregated number of input tokens written to the cache
|
|
220
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
221
|
+
# retention period.
|
|
214
222
|
#
|
|
215
223
|
# @return [Integer, nil]
|
|
216
224
|
optional :input_cache_write_tokens, Integer
|
|
@@ -306,7 +314,7 @@ module OpenAI
|
|
|
306
314
|
# @return [String, nil]
|
|
307
315
|
optional :user_id, String, nil?: true
|
|
308
316
|
|
|
309
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
317
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
310
318
|
# The aggregated completions usage details of the specific time bucket.
|
|
311
319
|
#
|
|
312
320
|
# @param input_tokens [Integer]
|
|
@@ -333,8 +341,13 @@ module OpenAI
|
|
|
333
341
|
# @param input_audio_tokens [Integer]
|
|
334
342
|
# The aggregated number of uncached audio input tokens used.
|
|
335
343
|
#
|
|
344
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
345
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
346
|
+
# retention period.
|
|
347
|
+
#
|
|
336
348
|
# @param input_cache_write_tokens [Integer]
|
|
337
|
-
# The aggregated number of input tokens written to the cache
|
|
349
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
350
|
+
# retention period.
|
|
338
351
|
#
|
|
339
352
|
# @param input_cached_audio_tokens [Integer]
|
|
340
353
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -211,8 +211,16 @@ module OpenAI
|
|
|
211
211
|
# @return [Integer, nil]
|
|
212
212
|
optional :input_audio_tokens, Integer
|
|
213
213
|
|
|
214
|
+
# @!attribute input_cache_write_12h_tokens
|
|
215
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
216
|
+
# retention period.
|
|
217
|
+
#
|
|
218
|
+
# @return [Integer, nil]
|
|
219
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
220
|
+
|
|
214
221
|
# @!attribute input_cache_write_tokens
|
|
215
|
-
# The aggregated number of input tokens written to the cache
|
|
222
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
223
|
+
# retention period.
|
|
216
224
|
#
|
|
217
225
|
# @return [Integer, nil]
|
|
218
226
|
optional :input_cache_write_tokens, Integer
|
|
@@ -308,7 +316,7 @@ module OpenAI
|
|
|
308
316
|
# @return [String, nil]
|
|
309
317
|
optional :user_id, String, nil?: true
|
|
310
318
|
|
|
311
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
319
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
312
320
|
# The aggregated completions usage details of the specific time bucket.
|
|
313
321
|
#
|
|
314
322
|
# @param input_tokens [Integer]
|
|
@@ -335,8 +343,13 @@ module OpenAI
|
|
|
335
343
|
# @param input_audio_tokens [Integer]
|
|
336
344
|
# The aggregated number of uncached audio input tokens used.
|
|
337
345
|
#
|
|
346
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
347
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
348
|
+
# retention period.
|
|
349
|
+
#
|
|
338
350
|
# @param input_cache_write_tokens [Integer]
|
|
339
|
-
# The aggregated number of input tokens written to the cache
|
|
351
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
352
|
+
# retention period.
|
|
340
353
|
#
|
|
341
354
|
# @param input_cached_audio_tokens [Integer]
|
|
342
355
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -213,8 +213,16 @@ module OpenAI
|
|
|
213
213
|
# @return [Integer, nil]
|
|
214
214
|
optional :input_audio_tokens, Integer
|
|
215
215
|
|
|
216
|
+
# @!attribute input_cache_write_12h_tokens
|
|
217
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
218
|
+
# retention period.
|
|
219
|
+
#
|
|
220
|
+
# @return [Integer, nil]
|
|
221
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
222
|
+
|
|
216
223
|
# @!attribute input_cache_write_tokens
|
|
217
|
-
# The aggregated number of input tokens written to the cache
|
|
224
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
225
|
+
# retention period.
|
|
218
226
|
#
|
|
219
227
|
# @return [Integer, nil]
|
|
220
228
|
optional :input_cache_write_tokens, Integer
|
|
@@ -310,7 +318,7 @@ module OpenAI
|
|
|
310
318
|
# @return [String, nil]
|
|
311
319
|
optional :user_id, String, nil?: true
|
|
312
320
|
|
|
313
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
321
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
314
322
|
# The aggregated completions usage details of the specific time bucket.
|
|
315
323
|
#
|
|
316
324
|
# @param input_tokens [Integer]
|
|
@@ -337,8 +345,13 @@ module OpenAI
|
|
|
337
345
|
# @param input_audio_tokens [Integer]
|
|
338
346
|
# The aggregated number of uncached audio input tokens used.
|
|
339
347
|
#
|
|
348
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
349
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
350
|
+
# retention period.
|
|
351
|
+
#
|
|
340
352
|
# @param input_cache_write_tokens [Integer]
|
|
341
|
-
# The aggregated number of input tokens written to the cache
|
|
353
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
354
|
+
# retention period.
|
|
342
355
|
#
|
|
343
356
|
# @param input_cached_audio_tokens [Integer]
|
|
344
357
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -213,8 +213,16 @@ module OpenAI
|
|
|
213
213
|
# @return [Integer, nil]
|
|
214
214
|
optional :input_audio_tokens, Integer
|
|
215
215
|
|
|
216
|
+
# @!attribute input_cache_write_12h_tokens
|
|
217
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
218
|
+
# retention period.
|
|
219
|
+
#
|
|
220
|
+
# @return [Integer, nil]
|
|
221
|
+
optional :input_cache_write_12h_tokens, Integer
|
|
222
|
+
|
|
216
223
|
# @!attribute input_cache_write_tokens
|
|
217
|
-
# The aggregated number of input tokens written to the cache
|
|
224
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
225
|
+
# retention period.
|
|
218
226
|
#
|
|
219
227
|
# @return [Integer, nil]
|
|
220
228
|
optional :input_cache_write_tokens, Integer
|
|
@@ -310,7 +318,7 @@ module OpenAI
|
|
|
310
318
|
# @return [String, nil]
|
|
311
319
|
optional :user_id, String, nil?: true
|
|
312
320
|
|
|
313
|
-
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: nil, batch: nil, input_audio_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")
|
|
321
|
+
# @!method initialize(input_tokens:, num_model_requests:, output_tokens:, api_key_id: 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")
|
|
314
322
|
# The aggregated completions usage details of the specific time bucket.
|
|
315
323
|
#
|
|
316
324
|
# @param input_tokens [Integer]
|
|
@@ -337,8 +345,13 @@ module OpenAI
|
|
|
337
345
|
# @param input_audio_tokens [Integer]
|
|
338
346
|
# The aggregated number of uncached audio input tokens used.
|
|
339
347
|
#
|
|
348
|
+
# @param input_cache_write_12h_tokens [Integer]
|
|
349
|
+
# The aggregated number of input tokens written to the cache with a 12-hour
|
|
350
|
+
# retention period.
|
|
351
|
+
#
|
|
340
352
|
# @param input_cache_write_tokens [Integer]
|
|
341
|
-
# The aggregated number of input tokens written to the cache
|
|
353
|
+
# The aggregated number of input tokens written to the cache with a 30-minute
|
|
354
|
+
# retention period.
|
|
342
355
|
#
|
|
343
356
|
# @param input_cached_audio_tokens [Integer]
|
|
344
357
|
# The aggregated number of cached audio input tokens used.
|