openai 0.107.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +23 -0
- data/README.md +49 -1
- data/examples/chat/tool_runner.rb +33 -0
- data/lib/openai/client.rb +2 -2
- data/lib/openai/helpers/chat/tool_runner.rb +259 -0
- data/lib/openai/helpers/realtime/recovery.rb +8 -2
- data/lib/openai/helpers/responses_websocket/incremental.rb +5 -1
- data/lib/openai/helpers/responses_websocket/session.rb +11 -4
- data/lib/openai/helpers/streaming/chat_completion_resource.rb +52 -0
- data/lib/openai/models/admin/organization/usage_audio_speeches_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_audio_transcriptions_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_code_interpreter_sessions_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_completions_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_costs_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_decisions_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_embeddings_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_file_search_calls_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_images_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_moderations_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_vector_stores_response.rb +4 -4
- data/lib/openai/models/admin/organization/usage_web_search_calls_response.rb +4 -4
- data/lib/openai/models/audio/voice_consent.rb +58 -0
- data/lib/openai/models/audio/voice_consent_create_params.rb +57 -0
- data/lib/openai/models/audio/voice_consent_delete_params.rb +22 -0
- data/lib/openai/models/audio/voice_consent_deleted.rb +34 -0
- data/lib/openai/models/audio/voice_consent_list_params.rb +42 -0
- data/lib/openai/models/audio/voice_consent_retrieve_params.rb +22 -0
- data/lib/openai/models/audio/voice_consent_update_params.rb +32 -0
- data/lib/openai/resources/audio/voice_consents.rb +163 -0
- data/lib/openai/resources/audio.rb +5 -0
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +8 -0
- data/rbi/openai/helpers/chat/tool_runner.rbi +74 -0
- data/rbi/openai/models/admin/organization/usage_audio_speeches_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_audio_transcriptions_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_completions_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_costs_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_decisions_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_embeddings_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_file_search_calls_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_images_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_moderations_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_vector_stores_response.rbi +4 -4
- data/rbi/openai/models/admin/organization/usage_web_search_calls_response.rbi +4 -4
- data/rbi/openai/models/audio/voice_consent.rbi +86 -0
- data/rbi/openai/models/audio/voice_consent_create_params.rbi +92 -0
- data/rbi/openai/models/audio/voice_consent_delete_params.rbi +53 -0
- data/rbi/openai/models/audio/voice_consent_deleted.rbi +62 -0
- data/rbi/openai/models/audio/voice_consent_list_params.rbi +78 -0
- data/rbi/openai/models/audio/voice_consent_retrieve_params.rbi +53 -0
- data/rbi/openai/models/audio/voice_consent_update_params.rbi +62 -0
- data/rbi/openai/models/response_format_json_schema.rbi +13 -11
- data/rbi/openai/resources/audio/voice_consents.rbi +108 -0
- data/rbi/openai/resources/audio.rbi +4 -0
- data/sig/openai/helpers/chat/tool_runner.rbs +48 -0
- data/sig/openai/models/admin/organization/usage_audio_speeches_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_audio_transcriptions_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_code_interpreter_sessions_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_completions_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_costs_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_decisions_response.rbs +4 -4
- data/sig/openai/models/admin/organization/usage_embeddings_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_file_search_calls_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_images_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_moderations_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_vector_stores_response.rbs +6 -6
- data/sig/openai/models/admin/organization/usage_web_search_calls_response.rbs +6 -6
- data/sig/openai/models/audio/voice_consent.rbs +57 -0
- data/sig/openai/models/audio/voice_consent_create_params.rbs +61 -0
- data/sig/openai/models/audio/voice_consent_delete_params.rbs +25 -0
- data/sig/openai/models/audio/voice_consent_deleted.rbs +31 -0
- data/sig/openai/models/audio/voice_consent_list_params.rbs +57 -0
- data/sig/openai/models/audio/voice_consent_retrieve_params.rbs +25 -0
- data/sig/openai/models/audio/voice_consent_update_params.rbs +36 -0
- data/sig/openai/resources/audio/voice_consents.rbs +38 -0
- data/sig/openai/resources/audio.rbs +2 -0
- metadata +29 -1
|
@@ -239,8 +239,8 @@ module OpenAI
|
|
|
239
239
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
240
240
|
|
|
241
241
|
# @!attribute input_cache_write_tokens
|
|
242
|
-
# The aggregated number of input tokens written to the cache
|
|
243
|
-
# retention
|
|
242
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
243
|
+
# 12-hour retention periods.
|
|
244
244
|
#
|
|
245
245
|
# @return [Integer, nil]
|
|
246
246
|
optional :input_cache_write_tokens, Integer
|
|
@@ -378,8 +378,8 @@ module OpenAI
|
|
|
378
378
|
# retention period. May be absent or null for older responses.
|
|
379
379
|
#
|
|
380
380
|
# @param input_cache_write_tokens [Integer]
|
|
381
|
-
# The aggregated number of input tokens written to the cache
|
|
382
|
-
# retention
|
|
381
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
382
|
+
# 12-hour retention periods.
|
|
383
383
|
#
|
|
384
384
|
# @param input_cached_audio_tokens [Integer]
|
|
385
385
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -145,8 +145,8 @@ module OpenAI
|
|
|
145
145
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
146
146
|
|
|
147
147
|
# @!attribute input_cache_write_tokens
|
|
148
|
-
# The aggregated number of input tokens written to the cache
|
|
149
|
-
# retention
|
|
148
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
149
|
+
# 12-hour retention periods.
|
|
150
150
|
#
|
|
151
151
|
# @return [Integer, nil]
|
|
152
152
|
optional :input_cache_write_tokens, Integer, nil?: true
|
|
@@ -284,8 +284,8 @@ module OpenAI
|
|
|
284
284
|
# retention period.
|
|
285
285
|
#
|
|
286
286
|
# @param input_cache_write_tokens [Integer, nil]
|
|
287
|
-
# The aggregated number of input tokens written to the cache
|
|
288
|
-
# retention
|
|
287
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
288
|
+
# 12-hour retention periods.
|
|
289
289
|
#
|
|
290
290
|
# @param input_cached_audio_tokens [Integer, nil]
|
|
291
291
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -241,8 +241,8 @@ module OpenAI
|
|
|
241
241
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
242
242
|
|
|
243
243
|
# @!attribute input_cache_write_tokens
|
|
244
|
-
# The aggregated number of input tokens written to the cache
|
|
245
|
-
# retention
|
|
244
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
245
|
+
# 12-hour retention periods.
|
|
246
246
|
#
|
|
247
247
|
# @return [Integer, nil]
|
|
248
248
|
optional :input_cache_write_tokens, Integer
|
|
@@ -380,8 +380,8 @@ module OpenAI
|
|
|
380
380
|
# retention period. May be absent or null for older responses.
|
|
381
381
|
#
|
|
382
382
|
# @param input_cache_write_tokens [Integer]
|
|
383
|
-
# The aggregated number of input tokens written to the cache
|
|
384
|
-
# retention
|
|
383
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
384
|
+
# 12-hour retention periods.
|
|
385
385
|
#
|
|
386
386
|
# @param input_cached_audio_tokens [Integer]
|
|
387
387
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -243,8 +243,8 @@ module OpenAI
|
|
|
243
243
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
244
244
|
|
|
245
245
|
# @!attribute input_cache_write_tokens
|
|
246
|
-
# The aggregated number of input tokens written to the cache
|
|
247
|
-
# retention
|
|
246
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
247
|
+
# 12-hour retention periods.
|
|
248
248
|
#
|
|
249
249
|
# @return [Integer, nil]
|
|
250
250
|
optional :input_cache_write_tokens, Integer
|
|
@@ -382,8 +382,8 @@ module OpenAI
|
|
|
382
382
|
# retention period. May be absent or null for older responses.
|
|
383
383
|
#
|
|
384
384
|
# @param input_cache_write_tokens [Integer]
|
|
385
|
-
# The aggregated number of input tokens written to the cache
|
|
386
|
-
# retention
|
|
385
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
386
|
+
# 12-hour retention periods.
|
|
387
387
|
#
|
|
388
388
|
# @param input_cached_audio_tokens [Integer]
|
|
389
389
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -239,8 +239,8 @@ module OpenAI
|
|
|
239
239
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
240
240
|
|
|
241
241
|
# @!attribute input_cache_write_tokens
|
|
242
|
-
# The aggregated number of input tokens written to the cache
|
|
243
|
-
# retention
|
|
242
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
243
|
+
# 12-hour retention periods.
|
|
244
244
|
#
|
|
245
245
|
# @return [Integer, nil]
|
|
246
246
|
optional :input_cache_write_tokens, Integer
|
|
@@ -378,8 +378,8 @@ module OpenAI
|
|
|
378
378
|
# retention period. May be absent or null for older responses.
|
|
379
379
|
#
|
|
380
380
|
# @param input_cache_write_tokens [Integer]
|
|
381
|
-
# The aggregated number of input tokens written to the cache
|
|
382
|
-
# retention
|
|
381
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
382
|
+
# 12-hour retention periods.
|
|
383
383
|
#
|
|
384
384
|
# @param input_cached_audio_tokens [Integer]
|
|
385
385
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -241,8 +241,8 @@ module OpenAI
|
|
|
241
241
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
242
242
|
|
|
243
243
|
# @!attribute input_cache_write_tokens
|
|
244
|
-
# The aggregated number of input tokens written to the cache
|
|
245
|
-
# retention
|
|
244
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
245
|
+
# 12-hour retention periods.
|
|
246
246
|
#
|
|
247
247
|
# @return [Integer, nil]
|
|
248
248
|
optional :input_cache_write_tokens, Integer
|
|
@@ -380,8 +380,8 @@ module OpenAI
|
|
|
380
380
|
# retention period. May be absent or null for older responses.
|
|
381
381
|
#
|
|
382
382
|
# @param input_cache_write_tokens [Integer]
|
|
383
|
-
# The aggregated number of input tokens written to the cache
|
|
384
|
-
# retention
|
|
383
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
384
|
+
# 12-hour retention periods.
|
|
385
385
|
#
|
|
386
386
|
# @param input_cached_audio_tokens [Integer]
|
|
387
387
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -243,8 +243,8 @@ module OpenAI
|
|
|
243
243
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
244
244
|
|
|
245
245
|
# @!attribute input_cache_write_tokens
|
|
246
|
-
# The aggregated number of input tokens written to the cache
|
|
247
|
-
# retention
|
|
246
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
247
|
+
# 12-hour retention periods.
|
|
248
248
|
#
|
|
249
249
|
# @return [Integer, nil]
|
|
250
250
|
optional :input_cache_write_tokens, Integer
|
|
@@ -382,8 +382,8 @@ module OpenAI
|
|
|
382
382
|
# retention period. May be absent or null for older responses.
|
|
383
383
|
#
|
|
384
384
|
# @param input_cache_write_tokens [Integer]
|
|
385
|
-
# The aggregated number of input tokens written to the cache
|
|
386
|
-
# retention
|
|
385
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
386
|
+
# 12-hour retention periods.
|
|
387
387
|
#
|
|
388
388
|
# @param input_cached_audio_tokens [Integer]
|
|
389
389
|
# The aggregated number of cached audio input tokens used.
|
|
@@ -243,8 +243,8 @@ module OpenAI
|
|
|
243
243
|
optional :input_cache_write_30m_tokens, Integer, nil?: true
|
|
244
244
|
|
|
245
245
|
# @!attribute input_cache_write_tokens
|
|
246
|
-
# The aggregated number of input tokens written to the cache
|
|
247
|
-
# retention
|
|
246
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
247
|
+
# 12-hour retention periods.
|
|
248
248
|
#
|
|
249
249
|
# @return [Integer, nil]
|
|
250
250
|
optional :input_cache_write_tokens, Integer
|
|
@@ -382,8 +382,8 @@ module OpenAI
|
|
|
382
382
|
# retention period. May be absent or null for older responses.
|
|
383
383
|
#
|
|
384
384
|
# @param input_cache_write_tokens [Integer]
|
|
385
|
-
# The aggregated number of input tokens written to the cache
|
|
386
|
-
# retention
|
|
385
|
+
# The aggregated number of input tokens written to the cache across 30-minute and
|
|
386
|
+
# 12-hour retention periods.
|
|
387
387
|
#
|
|
388
388
|
# @param input_cached_audio_tokens [Integer]
|
|
389
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
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Audio
|
|
6
|
+
# @see OpenAI::Resources::Audio::VoiceConsents#list
|
|
7
|
+
class VoiceConsentListParams < OpenAI::Internal::Type::BaseModel
|
|
8
|
+
extend OpenAI::Internal::Type::RequestParameters::Converter
|
|
9
|
+
include OpenAI::Internal::Type::RequestParameters
|
|
10
|
+
|
|
11
|
+
# @!attribute after
|
|
12
|
+
# A cursor for use in pagination. `after` is an object ID that defines your place
|
|
13
|
+
# in the list. For instance, if you make a list request and receive 100 objects,
|
|
14
|
+
# ending with obj_foo, your subsequent call can include after=obj_foo in order to
|
|
15
|
+
# fetch the next page of the list.
|
|
16
|
+
#
|
|
17
|
+
# @return [String, nil]
|
|
18
|
+
optional :after, String
|
|
19
|
+
|
|
20
|
+
# @!attribute limit
|
|
21
|
+
# A limit on the number of objects to be returned. Limit can range between 1 and
|
|
22
|
+
# 100, and the default is 20.
|
|
23
|
+
#
|
|
24
|
+
# @return [Integer, nil]
|
|
25
|
+
optional :limit, Integer
|
|
26
|
+
|
|
27
|
+
# @!method initialize(after: nil, limit: nil, request_options: {})
|
|
28
|
+
# @param after [String]
|
|
29
|
+
# A cursor for use in pagination. `after` is an object ID that defines your place
|
|
30
|
+
# in the list. For instance, if you make a list request and receive 100 objects,
|
|
31
|
+
# ending with obj_foo, your subsequent call can include after=obj_foo in order to
|
|
32
|
+
# fetch the next page of the list.
|
|
33
|
+
#
|
|
34
|
+
# @param limit [Integer]
|
|
35
|
+
# A limit on the number of objects to be returned. Limit can range between 1 and
|
|
36
|
+
# 100, and the default is 20.
|
|
37
|
+
#
|
|
38
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
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#retrieve
|
|
7
|
+
class VoiceConsentRetrieveParams < 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,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Models
|
|
5
|
+
module Audio
|
|
6
|
+
# @see OpenAI::Resources::Audio::VoiceConsents#update
|
|
7
|
+
class VoiceConsentUpdateParams < 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
|
+
# @!attribute name
|
|
17
|
+
# The updated label for this consent recording.
|
|
18
|
+
#
|
|
19
|
+
# @return [String]
|
|
20
|
+
required :name, String
|
|
21
|
+
|
|
22
|
+
# @!method initialize(consent_id:, name:, request_options: {})
|
|
23
|
+
# @param consent_id [String]
|
|
24
|
+
#
|
|
25
|
+
# @param name [String]
|
|
26
|
+
# The updated label for this consent recording.
|
|
27
|
+
#
|
|
28
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module OpenAI
|
|
4
|
+
module Resources
|
|
5
|
+
class Audio
|
|
6
|
+
# Turn audio into text or text into audio.
|
|
7
|
+
class VoiceConsents
|
|
8
|
+
# Upload a voice consent recording.
|
|
9
|
+
#
|
|
10
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
11
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
12
|
+
# content type.
|
|
13
|
+
#
|
|
14
|
+
# @overload create(language:, name:, recording:, request_options: {})
|
|
15
|
+
#
|
|
16
|
+
# @param language [String]
|
|
17
|
+
# The BCP 47 language tag for the consent phrase (for example, `en-US`).
|
|
18
|
+
#
|
|
19
|
+
# @param name [String]
|
|
20
|
+
# The label to use for this consent recording.
|
|
21
|
+
#
|
|
22
|
+
# @param recording [Pathname, StringIO, IO, String, OpenAI::FilePart]
|
|
23
|
+
# The consent audio recording file. Maximum size is 10 MiB.
|
|
24
|
+
#
|
|
25
|
+
# Supported MIME types: `audio/mpeg`, `audio/wav`, `audio/x-wav`, `audio/ogg`,
|
|
26
|
+
# `audio/aac`, `audio/flac`, `audio/webm`, `audio/mp4`.
|
|
27
|
+
#
|
|
28
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
29
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
30
|
+
# content type.
|
|
31
|
+
#
|
|
32
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
33
|
+
#
|
|
34
|
+
# @return [OpenAI::Models::Audio::VoiceConsent]
|
|
35
|
+
#
|
|
36
|
+
# @see OpenAI::Models::Audio::VoiceConsentCreateParams
|
|
37
|
+
def create(params)
|
|
38
|
+
parsed, options = OpenAI::Audio::VoiceConsentCreateParams.dump_request(params)
|
|
39
|
+
@client.request(
|
|
40
|
+
method: :post,
|
|
41
|
+
path: "audio/voice_consents",
|
|
42
|
+
headers: {"content-type" => "multipart/form-data"},
|
|
43
|
+
body: parsed,
|
|
44
|
+
model: OpenAI::Audio::VoiceConsent,
|
|
45
|
+
security: {bearer_auth: true},
|
|
46
|
+
options: options
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Retrieves a voice consent recording.
|
|
51
|
+
#
|
|
52
|
+
# @overload retrieve(consent_id, request_options: {})
|
|
53
|
+
#
|
|
54
|
+
# @param consent_id [String]
|
|
55
|
+
# The ID of the consent recording to retrieve.
|
|
56
|
+
#
|
|
57
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
58
|
+
#
|
|
59
|
+
# @return [OpenAI::Models::Audio::VoiceConsent]
|
|
60
|
+
#
|
|
61
|
+
# @see OpenAI::Models::Audio::VoiceConsentRetrieveParams
|
|
62
|
+
def retrieve(consent_id, params = {})
|
|
63
|
+
@client.request(
|
|
64
|
+
method: :get,
|
|
65
|
+
path: ["audio/voice_consents/%1$s", consent_id],
|
|
66
|
+
model: OpenAI::Audio::VoiceConsent,
|
|
67
|
+
security: {bearer_auth: true},
|
|
68
|
+
options: params[:request_options]
|
|
69
|
+
)
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Updates a voice consent recording (metadata only).
|
|
73
|
+
#
|
|
74
|
+
# @overload update(consent_id, name:, request_options: {})
|
|
75
|
+
#
|
|
76
|
+
# @param consent_id [String]
|
|
77
|
+
# The ID of the consent recording to update.
|
|
78
|
+
#
|
|
79
|
+
# @param name [String]
|
|
80
|
+
# The updated label for this consent recording.
|
|
81
|
+
#
|
|
82
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
83
|
+
#
|
|
84
|
+
# @return [OpenAI::Models::Audio::VoiceConsent]
|
|
85
|
+
#
|
|
86
|
+
# @see OpenAI::Models::Audio::VoiceConsentUpdateParams
|
|
87
|
+
def update(consent_id, params)
|
|
88
|
+
parsed, options = OpenAI::Audio::VoiceConsentUpdateParams.dump_request(params)
|
|
89
|
+
@client.request(
|
|
90
|
+
method: :post,
|
|
91
|
+
path: ["audio/voice_consents/%1$s", consent_id],
|
|
92
|
+
body: parsed,
|
|
93
|
+
model: OpenAI::Audio::VoiceConsent,
|
|
94
|
+
security: {bearer_auth: true},
|
|
95
|
+
options: options
|
|
96
|
+
)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
# Returns a list of voice consent recordings.
|
|
100
|
+
#
|
|
101
|
+
# @overload list(after: nil, limit: nil, request_options: {})
|
|
102
|
+
#
|
|
103
|
+
# @param after [String]
|
|
104
|
+
# A cursor for use in pagination. `after` is an object ID that defines your place
|
|
105
|
+
# in the list. For instance, if you make a list request and receive 100 objects,
|
|
106
|
+
# ending with obj_foo, your subsequent call can include after=obj_foo in order to
|
|
107
|
+
# fetch the next page of the list.
|
|
108
|
+
#
|
|
109
|
+
# @param limit [Integer]
|
|
110
|
+
# A limit on the number of objects to be returned. Limit can range between 1 and
|
|
111
|
+
# 100, and the default is 20.
|
|
112
|
+
#
|
|
113
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
114
|
+
#
|
|
115
|
+
# @return [OpenAI::Internal::CursorPage<OpenAI::Models::Audio::VoiceConsent>]
|
|
116
|
+
#
|
|
117
|
+
# @see OpenAI::Models::Audio::VoiceConsentListParams
|
|
118
|
+
def list(params = {})
|
|
119
|
+
parsed, options = OpenAI::Audio::VoiceConsentListParams.dump_request(params)
|
|
120
|
+
query = OpenAI::Internal::Util.encode_query_params(parsed)
|
|
121
|
+
@client.request(
|
|
122
|
+
method: :get,
|
|
123
|
+
path: "audio/voice_consents",
|
|
124
|
+
query: query,
|
|
125
|
+
page: OpenAI::Internal::CursorPage,
|
|
126
|
+
model: OpenAI::Audio::VoiceConsent,
|
|
127
|
+
security: {bearer_auth: true},
|
|
128
|
+
options: options
|
|
129
|
+
)
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
# Deletes a voice consent recording.
|
|
133
|
+
#
|
|
134
|
+
# @overload delete(consent_id, request_options: {})
|
|
135
|
+
#
|
|
136
|
+
# @param consent_id [String]
|
|
137
|
+
# The ID of the consent recording to delete.
|
|
138
|
+
#
|
|
139
|
+
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
|
|
140
|
+
#
|
|
141
|
+
# @return [OpenAI::Models::Audio::VoiceConsentDeleted]
|
|
142
|
+
#
|
|
143
|
+
# @see OpenAI::Models::Audio::VoiceConsentDeleteParams
|
|
144
|
+
def delete(consent_id, params = {})
|
|
145
|
+
@client.request(
|
|
146
|
+
method: :delete,
|
|
147
|
+
path: ["audio/voice_consents/%1$s", consent_id],
|
|
148
|
+
model: OpenAI::Audio::VoiceConsentDeleted,
|
|
149
|
+
security: {bearer_auth: true},
|
|
150
|
+
options: params[:request_options]
|
|
151
|
+
)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
# @api private
|
|
155
|
+
#
|
|
156
|
+
# @param client [OpenAI::Client]
|
|
157
|
+
def initialize(client:)
|
|
158
|
+
@client = client
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
end
|
|
@@ -19,6 +19,10 @@ module OpenAI
|
|
|
19
19
|
# @return [OpenAI::Resources::Audio::Voices]
|
|
20
20
|
attr_reader :voices
|
|
21
21
|
|
|
22
|
+
# Turn audio into text or text into audio.
|
|
23
|
+
# @return [OpenAI::Resources::Audio::VoiceConsents]
|
|
24
|
+
attr_reader :voice_consents
|
|
25
|
+
|
|
22
26
|
# @api private
|
|
23
27
|
#
|
|
24
28
|
# @param client [OpenAI::Client]
|
|
@@ -28,6 +32,7 @@ module OpenAI
|
|
|
28
32
|
@translations = OpenAI::Resources::Audio::Translations.new(client: client)
|
|
29
33
|
@speech = OpenAI::Resources::Audio::Speech.new(client: client)
|
|
30
34
|
@voices = OpenAI::Resources::Audio::Voices.new(client: client)
|
|
35
|
+
@voice_consents = OpenAI::Resources::Audio::VoiceConsents.new(client: client)
|
|
31
36
|
end
|
|
32
37
|
end
|
|
33
38
|
end
|
data/lib/openai/version.rb
CHANGED
data/lib/openai.rb
CHANGED
|
@@ -462,6 +462,13 @@ require_relative "openai/models/audio/translation_create_params"
|
|
|
462
462
|
require_relative "openai/models/audio/translation_create_response"
|
|
463
463
|
require_relative "openai/models/audio/translation_verbose"
|
|
464
464
|
require_relative "openai/models/audio/voice"
|
|
465
|
+
require_relative "openai/models/audio/voice_consent"
|
|
466
|
+
require_relative "openai/models/audio/voice_consent_create_params"
|
|
467
|
+
require_relative "openai/models/audio/voice_consent_deleted"
|
|
468
|
+
require_relative "openai/models/audio/voice_consent_delete_params"
|
|
469
|
+
require_relative "openai/models/audio/voice_consent_list_params"
|
|
470
|
+
require_relative "openai/models/audio/voice_consent_retrieve_params"
|
|
471
|
+
require_relative "openai/models/audio/voice_consent_update_params"
|
|
465
472
|
require_relative "openai/models/audio/voice_create_params"
|
|
466
473
|
require_relative "openai/models/audio_model"
|
|
467
474
|
require_relative "openai/models/audio_response_format"
|
|
@@ -1558,6 +1565,7 @@ require_relative "openai/resources/audio"
|
|
|
1558
1565
|
require_relative "openai/resources/audio/speech"
|
|
1559
1566
|
require_relative "openai/resources/audio/transcriptions"
|
|
1560
1567
|
require_relative "openai/resources/audio/translations"
|
|
1568
|
+
require_relative "openai/resources/audio/voice_consents"
|
|
1561
1569
|
require_relative "openai/resources/audio/voices"
|
|
1562
1570
|
require_relative "openai/resources/batches"
|
|
1563
1571
|
require_relative "openai/resources/beta"
|