openai 0.78.0 → 0.79.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 +80 -0
- data/README.md +241 -8
- data/SECURITY.md +6 -22
- data/azure.md +110 -0
- data/bedrock.md +132 -0
- data/examples/mtls_custom_http_client.rb +61 -0
- data/lib/openai/auth/workload_identity.rb +13 -2
- data/lib/openai/auth/workload_identity_auth.rb +2 -1
- data/lib/openai/client.rb +29 -6
- data/lib/openai/errors.rb +11 -1
- data/lib/openai/helpers/streaming/chat_completion_stream.rb +3 -3
- data/lib/openai/helpers/streaming/response_stream.rb +5 -6
- data/lib/openai/helpers/structured_output/base_model.rb +20 -19
- data/lib/openai/helpers/structured_output/json_schema_converter.rb +12 -5
- data/lib/openai/http_client.rb +99 -7
- data/lib/openai/internal/conversation_cursor_page.rb +5 -6
- data/lib/openai/internal/cursor_page.rb +3 -3
- data/lib/openai/internal/logging.rb +419 -0
- data/lib/openai/internal/next_cursor_page.rb +5 -6
- data/lib/openai/internal/page.rb +2 -2
- data/lib/openai/internal/provider.rb +7 -1
- data/lib/openai/internal/read_io_adapter.rb +42 -18
- data/lib/openai/internal/stream.rb +2 -2
- data/lib/openai/internal/transport/base_client.rb +137 -37
- data/lib/openai/internal/type/array_of.rb +6 -4
- data/lib/openai/internal/type/base_model.rb +39 -1
- data/lib/openai/internal/type/base_page.rb +19 -2
- data/lib/openai/internal/type/base_stream.rb +39 -7
- data/lib/openai/internal/type/hash_of.rb +3 -3
- data/lib/openai/internal/util.rb +52 -27
- data/lib/openai/models/admin/organization/audit_log_list_params.rb +3 -1
- data/lib/openai/models/admin/organization/audit_log_list_response.rb +33 -11
- data/lib/openai/models/admin/organization/groups/role_list_response.rb +5 -1
- data/lib/openai/models/admin/organization/groups/role_retrieve_response.rb +5 -1
- data/lib/openai/models/admin/organization/projects/groups/role_list_response.rb +6 -1
- data/lib/openai/models/admin/organization/projects/groups/role_retrieve_response.rb +6 -1
- data/lib/openai/models/admin/organization/projects/service_account_create_response.rb +3 -1
- data/lib/openai/models/admin/organization/projects/users/role_list_response.rb +6 -1
- data/lib/openai/models/admin/organization/projects/users/role_retrieve_response.rb +6 -1
- data/lib/openai/models/admin/organization/users/role_list_response.rb +5 -1
- data/lib/openai/models/admin/organization/users/role_retrieve_response.rb +5 -1
- data/lib/openai/models/all_models.rb +3 -0
- data/lib/openai/models/audio/transcription_create_params.rb +7 -1
- data/lib/openai/models/audio/translation_create_params.rb +7 -1
- data/lib/openai/models/beta/beta_response.rb +9 -0
- data/lib/openai/models/beta/beta_response_stream_event.rb +1 -1
- data/lib/openai/models/beta/beta_responses_client_event.rb +28 -3
- data/lib/openai/models/beta/beta_responses_server_event.rb +1037 -61
- data/lib/openai/models/beta/response_compact_params.rb +9 -0
- data/lib/openai/models/beta/response_create_params.rb +9 -0
- data/lib/openai/models/containers/file_create_params.rb +4 -0
- data/lib/openai/models/content_provenance_check_create_params.rb +4 -0
- data/lib/openai/models/file_create_params.rb +4 -0
- data/lib/openai/models/image_create_variation_params.rb +4 -0
- data/lib/openai/models/image_edit_params.rb +8 -0
- data/lib/openai/models/responses/response_compact_params.rb +9 -0
- data/lib/openai/models/responses/response_stream_event.rb +1 -1
- data/lib/openai/models/responses/responses_client_event.rb +13 -1
- data/lib/openai/models/responses/responses_server_event.rb +1027 -54
- data/lib/openai/models/responses_model.rb +3 -0
- data/lib/openai/models/skill_create_params.rb +4 -0
- data/lib/openai/models/skills/version_create_params.rb +4 -0
- data/lib/openai/models/uploads/part_create_params.rb +4 -0
- data/lib/openai/models/vector_store_search_response.rb +3 -1
- data/lib/openai/models/video_create_character_params.rb +4 -0
- data/lib/openai/models/video_create_params.rb +4 -0
- data/lib/openai/models/video_edit_params.rb +4 -0
- data/lib/openai/models/video_extend_params.rb +4 -0
- data/lib/openai/models.rb +9 -1
- data/lib/openai/net_http_client.rb +20 -6
- data/lib/openai/providers/azure.rb +216 -0
- data/lib/openai/providers/bedrock.rb +3 -1
- data/lib/openai/resources/admin/organization/projects/groups/roles.rb +1 -1
- data/lib/openai/resources/admin/organization/projects/groups.rb +1 -1
- data/lib/openai/resources/admin/organization/projects/users/roles.rb +1 -1
- data/lib/openai/resources/admin/organization/projects.rb +4 -2
- data/lib/openai/resources/audio/transcriptions.rb +8 -0
- data/lib/openai/resources/audio/translations.rb +4 -0
- data/lib/openai/resources/beta/responses.rb +1 -1
- data/lib/openai/resources/beta/threads/runs/steps.rb +2 -2
- data/lib/openai/resources/containers/files.rb +4 -0
- data/lib/openai/resources/content_provenance_checks.rb +4 -0
- data/lib/openai/resources/conversations/items.rb +1 -1
- data/lib/openai/resources/evals/runs/output_items.rb +1 -1
- data/lib/openai/resources/files.rb +4 -0
- data/lib/openai/resources/images.rb +12 -0
- data/lib/openai/resources/responses.rb +3 -2
- data/lib/openai/resources/skills/versions.rb +4 -0
- data/lib/openai/resources/skills.rb +4 -0
- data/lib/openai/resources/uploads/parts.rb +4 -0
- data/lib/openai/resources/vector_stores/file_batches.rb +1 -1
- data/lib/openai/resources/videos.rb +38 -0
- data/lib/openai/resources/webhooks.rb +18 -6
- data/lib/openai/version.rb +1 -1
- data/lib/openai.rb +111 -107
- data/rbi/openai/auth.rbi +4 -4
- data/rbi/openai/client.rbi +13 -3
- data/rbi/openai/errors.rbi +7 -0
- data/rbi/openai/helpers/streaming/events.rbi +12 -0
- data/rbi/openai/http_client.rbi +62 -2
- data/rbi/openai/internal/logging.rbi +192 -0
- data/rbi/openai/internal/provider.rbi +3 -0
- data/rbi/openai/internal/read_io_adapter.rbi +6 -1
- data/rbi/openai/internal/transport/base_client.rbi +61 -7
- data/rbi/openai/internal/type/base_model.rbi +24 -1
- data/rbi/openai/internal/type/base_page.rbi +13 -2
- data/rbi/openai/internal/type/base_stream.rbi +15 -4
- data/rbi/openai/internal/util.rbi +26 -2
- data/rbi/openai/models/admin/organization/audit_log_list_params.rbi +5 -0
- data/rbi/openai/models/admin/organization/audit_log_list_response.rbi +5 -0
- data/rbi/openai/models/all_models.rbi +15 -0
- data/rbi/openai/models/audio/transcription_create_params.rbi +14 -2
- data/rbi/openai/models/audio/translation_create_params.rbi +14 -2
- data/rbi/openai/models/beta/beta_response.rbi +15 -0
- data/rbi/openai/models/beta/beta_response_stream_event.rbi +1 -1
- data/rbi/openai/models/beta/beta_responses_client_event.rbi +37 -1
- data/rbi/openai/models/beta/beta_responses_server_event.rbi +3791 -54
- data/rbi/openai/models/beta/response_compact_params.rbi +15 -0
- data/rbi/openai/models/beta/response_create_params.rbi +15 -0
- data/rbi/openai/models/containers/file_create_params.rbi +8 -0
- data/rbi/openai/models/content_provenance_check_create_params.rbi +8 -0
- data/rbi/openai/models/file_create_params.rbi +8 -0
- data/rbi/openai/models/image_create_variation_params.rbi +8 -0
- data/rbi/openai/models/image_edit_params.rbi +16 -0
- data/rbi/openai/models/responses/response_compact_params.rbi +15 -0
- data/rbi/openai/models/responses/response_stream_event.rbi +1 -1
- data/rbi/openai/models/responses/responses_client_event.rbi +19 -0
- data/rbi/openai/models/responses/responses_server_event.rbi +3282 -53
- data/rbi/openai/models/responses_model.rbi +15 -0
- data/rbi/openai/models/skill_create_params.rbi +8 -0
- data/rbi/openai/models/skills/version_create_params.rbi +8 -0
- data/rbi/openai/models/uploads/part_create_params.rbi +8 -0
- data/rbi/openai/models/video_create_character_params.rbi +8 -0
- data/rbi/openai/models/video_create_params.rbi +8 -0
- data/rbi/openai/models/video_edit_params.rbi +8 -0
- data/rbi/openai/models/video_extend_params.rbi +8 -0
- data/rbi/openai/net_http_client.rbi +2 -2
- data/rbi/openai/providers.rbi +9 -0
- data/rbi/openai/resources/audio/transcriptions.rbi +14 -2
- data/rbi/openai/resources/audio/translations.rbi +7 -1
- data/rbi/openai/resources/containers/files.rbi +4 -0
- data/rbi/openai/resources/content_provenance_checks.rbi +4 -0
- data/rbi/openai/resources/files.rbi +4 -0
- data/rbi/openai/resources/images.rbi +20 -0
- data/rbi/openai/resources/skills/versions.rbi +4 -0
- data/rbi/openai/resources/skills.rbi +4 -0
- data/rbi/openai/resources/uploads/parts.rbi +4 -0
- data/rbi/openai/resources/videos.rbi +16 -0
- data/sig/openai/client.rbs +6 -2
- data/sig/openai/errors.rbs +5 -0
- data/sig/openai/http_client.rbs +37 -2
- data/sig/openai/internal/logging.rbs +88 -0
- data/sig/openai/internal/provider.rbs +3 -1
- data/sig/openai/internal/read_io_adapter.rbs +3 -1
- data/sig/openai/internal/transport/base_client.rbs +33 -5
- data/sig/openai/internal/type/base_model.rbs +13 -0
- data/sig/openai/internal/type/base_page.rbs +8 -1
- data/sig/openai/internal/type/base_stream.rbs +8 -2
- data/sig/openai/internal/util.rbs +12 -0
- data/sig/openai/models/admin/organization/audit_log_list_params.rbs +2 -0
- data/sig/openai/models/admin/organization/audit_log_list_response.rbs +2 -0
- data/sig/openai/models/all_models.rbs +6 -0
- data/sig/openai/models/beta/beta_response.rbs +6 -0
- data/sig/openai/models/beta/beta_responses_client_event.rbs +13 -0
- data/sig/openai/models/beta/beta_responses_server_event.rbs +1946 -54
- data/sig/openai/models/beta/response_compact_params.rbs +6 -0
- data/sig/openai/models/beta/response_create_params.rbs +6 -0
- data/sig/openai/models/responses/response_compact_params.rbs +6 -0
- data/sig/openai/models/responses/responses_client_event.rbs +7 -0
- data/sig/openai/models/responses/responses_server_event.rbs +1786 -53
- data/sig/openai/models/responses_model.rbs +6 -0
- data/sig/openai/net_http_client.rbs +2 -2
- data/sig/openai/providers.rbs +6 -0
- metadata +24 -1
|
@@ -93,6 +93,21 @@ module OpenAI
|
|
|
93
93
|
:"gpt-5.1-codex-max",
|
|
94
94
|
OpenAI::ResponsesModel::ResponsesOnlyModel::TaggedSymbol
|
|
95
95
|
)
|
|
96
|
+
GPT_DAYBREAK_BLUE_LATEST =
|
|
97
|
+
T.let(
|
|
98
|
+
:"gpt-daybreak-blue-latest",
|
|
99
|
+
OpenAI::ResponsesModel::ResponsesOnlyModel::TaggedSymbol
|
|
100
|
+
)
|
|
101
|
+
GPT_DAYBREAK_RED_LATEST =
|
|
102
|
+
T.let(
|
|
103
|
+
:"gpt-daybreak-red-latest",
|
|
104
|
+
OpenAI::ResponsesModel::ResponsesOnlyModel::TaggedSymbol
|
|
105
|
+
)
|
|
106
|
+
GPT_5_6_CYBER =
|
|
107
|
+
T.let(
|
|
108
|
+
:"gpt-5.6-cyber",
|
|
109
|
+
OpenAI::ResponsesModel::ResponsesOnlyModel::TaggedSymbol
|
|
110
|
+
)
|
|
96
111
|
|
|
97
112
|
sig do
|
|
98
113
|
override.returns(
|
|
@@ -12,6 +12,10 @@ module OpenAI
|
|
|
12
12
|
end
|
|
13
13
|
|
|
14
14
|
# Skill files to upload (directory upload) or a single zip file.
|
|
15
|
+
#
|
|
16
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
17
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
18
|
+
# content type.
|
|
15
19
|
sig { returns(T.nilable(OpenAI::SkillCreateParams::Files::Variants)) }
|
|
16
20
|
attr_reader :files
|
|
17
21
|
|
|
@@ -26,6 +30,10 @@ module OpenAI
|
|
|
26
30
|
end
|
|
27
31
|
def self.new(
|
|
28
32
|
# Skill files to upload (directory upload) or a single zip file.
|
|
33
|
+
#
|
|
34
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
35
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
36
|
+
# content type.
|
|
29
37
|
files: nil,
|
|
30
38
|
request_options: {}
|
|
31
39
|
)
|
|
@@ -26,6 +26,10 @@ module OpenAI
|
|
|
26
26
|
attr_writer :default
|
|
27
27
|
|
|
28
28
|
# Skill files to upload (directory upload) or a single zip file.
|
|
29
|
+
#
|
|
30
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
31
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
32
|
+
# content type.
|
|
29
33
|
sig do
|
|
30
34
|
returns(
|
|
31
35
|
T.nilable(OpenAI::Skills::VersionCreateParams::Files::Variants)
|
|
@@ -53,6 +57,10 @@ module OpenAI
|
|
|
53
57
|
# Whether to set this version as the default.
|
|
54
58
|
default: nil,
|
|
55
59
|
# Skill files to upload (directory upload) or a single zip file.
|
|
60
|
+
#
|
|
61
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
62
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
63
|
+
# content type.
|
|
56
64
|
files: nil,
|
|
57
65
|
request_options: {}
|
|
58
66
|
)
|
|
@@ -16,6 +16,10 @@ module OpenAI
|
|
|
16
16
|
attr_accessor :upload_id
|
|
17
17
|
|
|
18
18
|
# The chunk of bytes for this Part.
|
|
19
|
+
#
|
|
20
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
21
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
22
|
+
# content type.
|
|
19
23
|
sig { returns(OpenAI::Internal::FileInput) }
|
|
20
24
|
attr_accessor :data
|
|
21
25
|
|
|
@@ -29,6 +33,10 @@ module OpenAI
|
|
|
29
33
|
def self.new(
|
|
30
34
|
upload_id:,
|
|
31
35
|
# The chunk of bytes for this Part.
|
|
36
|
+
#
|
|
37
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
38
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
39
|
+
# content type.
|
|
32
40
|
data:,
|
|
33
41
|
request_options: {}
|
|
34
42
|
)
|
|
@@ -16,6 +16,10 @@ module OpenAI
|
|
|
16
16
|
attr_accessor :name
|
|
17
17
|
|
|
18
18
|
# Video file used to create a character.
|
|
19
|
+
#
|
|
20
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
21
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
22
|
+
# content type.
|
|
19
23
|
sig { returns(OpenAI::Internal::FileInput) }
|
|
20
24
|
attr_accessor :video
|
|
21
25
|
|
|
@@ -30,6 +34,10 @@ module OpenAI
|
|
|
30
34
|
# Display name for this API character.
|
|
31
35
|
name:,
|
|
32
36
|
# Video file used to create a character.
|
|
37
|
+
#
|
|
38
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
39
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
40
|
+
# content type.
|
|
33
41
|
video:,
|
|
34
42
|
request_options: {}
|
|
35
43
|
)
|
|
@@ -16,6 +16,10 @@ module OpenAI
|
|
|
16
16
|
attr_accessor :prompt
|
|
17
17
|
|
|
18
18
|
# Optional reference asset upload or reference object that guides generation.
|
|
19
|
+
#
|
|
20
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
21
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
22
|
+
# content type.
|
|
19
23
|
sig do
|
|
20
24
|
returns(
|
|
21
25
|
T.nilable(
|
|
@@ -77,6 +81,10 @@ module OpenAI
|
|
|
77
81
|
# Text prompt that describes the video to generate.
|
|
78
82
|
prompt:,
|
|
79
83
|
# Optional reference asset upload or reference object that guides generation.
|
|
84
|
+
#
|
|
85
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
86
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
87
|
+
# content type.
|
|
80
88
|
input_reference: nil,
|
|
81
89
|
# The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
|
|
82
90
|
# to `sora-2`.
|
|
@@ -16,6 +16,10 @@ module OpenAI
|
|
|
16
16
|
attr_accessor :prompt
|
|
17
17
|
|
|
18
18
|
# Reference to the completed video to edit.
|
|
19
|
+
#
|
|
20
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
21
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
22
|
+
# content type.
|
|
19
23
|
sig do
|
|
20
24
|
returns(
|
|
21
25
|
T.any(
|
|
@@ -41,6 +45,10 @@ module OpenAI
|
|
|
41
45
|
# Text prompt that describes how to edit the source video.
|
|
42
46
|
prompt:,
|
|
43
47
|
# Reference to the completed video to edit.
|
|
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.
|
|
44
52
|
video:,
|
|
45
53
|
request_options: {}
|
|
46
54
|
)
|
|
@@ -21,6 +21,10 @@ module OpenAI
|
|
|
21
21
|
attr_accessor :seconds
|
|
22
22
|
|
|
23
23
|
# Reference to the completed video to extend.
|
|
24
|
+
#
|
|
25
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
26
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
27
|
+
# content type.
|
|
24
28
|
sig do
|
|
25
29
|
returns(
|
|
26
30
|
T.any(
|
|
@@ -50,6 +54,10 @@ module OpenAI
|
|
|
50
54
|
# 8, 12, 16, 20).
|
|
51
55
|
seconds:,
|
|
52
56
|
# Reference to the completed video to extend.
|
|
57
|
+
#
|
|
58
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
59
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
60
|
+
# content type.
|
|
53
61
|
video:,
|
|
54
62
|
request_options: {}
|
|
55
63
|
)
|
|
@@ -10,7 +10,7 @@ module OpenAI
|
|
|
10
10
|
private def connect(url:)
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
sig { params(conn: Net::HTTP, deadline: Float).void }
|
|
13
|
+
sig { params(conn: Net::HTTP, deadline: T.nilable(Float)).void }
|
|
14
14
|
private def calibrate_socket_timeout(conn, deadline)
|
|
15
15
|
end
|
|
16
16
|
|
|
@@ -26,7 +26,7 @@ module OpenAI
|
|
|
26
26
|
sig do
|
|
27
27
|
params(
|
|
28
28
|
url: URI::Generic,
|
|
29
|
-
deadline: Float,
|
|
29
|
+
deadline: T.nilable(Float),
|
|
30
30
|
blk: T.proc.params(arg0: Net::HTTP).void
|
|
31
31
|
).void
|
|
32
32
|
end
|
data/rbi/openai/providers.rbi
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
3
3
|
module OpenAI
|
|
4
4
|
module Providers
|
|
5
5
|
class << self
|
|
6
|
+
sig do
|
|
7
|
+
params(
|
|
8
|
+
endpoint: T.nilable(String),
|
|
9
|
+
api_key: T.nilable(String),
|
|
10
|
+
token_provider: T.nilable(T.proc.returns(String))
|
|
11
|
+
).returns(OpenAI::Provider)
|
|
12
|
+
end
|
|
13
|
+
def azure(endpoint: nil, api_key: nil, token_provider: nil); end
|
|
14
|
+
|
|
6
15
|
sig do
|
|
7
16
|
params(
|
|
8
17
|
region: T.nilable(String),
|
|
@@ -44,7 +44,13 @@ module OpenAI
|
|
|
44
44
|
end
|
|
45
45
|
def create(
|
|
46
46
|
# The audio file object (not file name) to transcribe, in one of these formats:
|
|
47
|
-
# flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
|
|
47
|
+
# flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include
|
|
48
|
+
# enough format metadata for the file to be identified. We recommend an
|
|
49
|
+
# extension-bearing filename and an appropriate content type.
|
|
50
|
+
#
|
|
51
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
52
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
53
|
+
# content type.
|
|
48
54
|
file:,
|
|
49
55
|
# ID of the model to use. The options are `gpt-transcribe`, `gpt-4o-transcribe`,
|
|
50
56
|
# `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1`
|
|
@@ -159,7 +165,13 @@ module OpenAI
|
|
|
159
165
|
end
|
|
160
166
|
def create_streaming(
|
|
161
167
|
# The audio file object (not file name) to transcribe, in one of these formats:
|
|
162
|
-
# flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
|
|
168
|
+
# flac, mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include
|
|
169
|
+
# enough format metadata for the file to be identified. We recommend an
|
|
170
|
+
# extension-bearing filename and an appropriate content type.
|
|
171
|
+
#
|
|
172
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
173
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
174
|
+
# content type.
|
|
163
175
|
file:,
|
|
164
176
|
# ID of the model to use. The options are `gpt-transcribe`, `gpt-4o-transcribe`,
|
|
165
177
|
# `gpt-4o-mini-transcribe`, `gpt-4o-mini-transcribe-2025-12-15`, `whisper-1`
|
|
@@ -19,7 +19,13 @@ module OpenAI
|
|
|
19
19
|
end
|
|
20
20
|
def create(
|
|
21
21
|
# The audio file object (not file name) translate, in one of these formats: flac,
|
|
22
|
-
# mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm.
|
|
22
|
+
# mp3, mp4, mpeg, mpga, m4a, ogg, wav, or webm. The request must include enough
|
|
23
|
+
# format metadata for the file to be identified. We recommend an extension-bearing
|
|
24
|
+
# filename and an appropriate content type.
|
|
25
|
+
#
|
|
26
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
27
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
28
|
+
# content type.
|
|
23
29
|
file:,
|
|
24
30
|
# ID of the model to use. Only `whisper-1` (which is powered by our open source
|
|
25
31
|
# Whisper V2 model) is currently available.
|
|
@@ -22,6 +22,10 @@ module OpenAI
|
|
|
22
22
|
def create(
|
|
23
23
|
container_id,
|
|
24
24
|
# The File object (not file name) to be uploaded.
|
|
25
|
+
#
|
|
26
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
27
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
28
|
+
# content type.
|
|
25
29
|
file: nil,
|
|
26
30
|
# Name of the file to create.
|
|
27
31
|
file_id: nil,
|
|
@@ -20,6 +20,10 @@ module OpenAI
|
|
|
20
20
|
end
|
|
21
21
|
def create(
|
|
22
22
|
# The image or audio file to check for supported OpenAI provenance signals.
|
|
23
|
+
#
|
|
24
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
25
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
26
|
+
# content type.
|
|
23
27
|
file:,
|
|
24
28
|
request_options: {}
|
|
25
29
|
)
|
|
@@ -42,6 +42,10 @@ module OpenAI
|
|
|
42
42
|
end
|
|
43
43
|
def create(
|
|
44
44
|
# The File object (not file name) to be uploaded.
|
|
45
|
+
#
|
|
46
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
47
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
48
|
+
# content type.
|
|
45
49
|
file:,
|
|
46
50
|
# The intended purpose of the uploaded file. One of:
|
|
47
51
|
#
|
|
@@ -22,6 +22,10 @@ module OpenAI
|
|
|
22
22
|
def create_variation(
|
|
23
23
|
# The image to use as the basis for the variation(s). Must be a valid PNG file,
|
|
24
24
|
# less than 4MB, and square.
|
|
25
|
+
#
|
|
26
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
27
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
28
|
+
# content type.
|
|
25
29
|
image:,
|
|
26
30
|
# The model to use for image generation. Only `dall-e-2` is supported at this
|
|
27
31
|
# time.
|
|
@@ -82,6 +86,10 @@ module OpenAI
|
|
|
82
86
|
#
|
|
83
87
|
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
84
88
|
# file less than 4MB.
|
|
89
|
+
#
|
|
90
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
91
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
92
|
+
# content type.
|
|
85
93
|
image:,
|
|
86
94
|
# A text description of the desired image(s). The maximum length is 1000
|
|
87
95
|
# characters for `dall-e-2`, and 32000 characters for the GPT image models.
|
|
@@ -108,6 +116,10 @@ module OpenAI
|
|
|
108
116
|
# indicate where `image` should be edited. If there are multiple images provided,
|
|
109
117
|
# the mask will be applied on the first image. Must be a valid PNG file, less than
|
|
110
118
|
# 4MB, and have the same dimensions as `image`.
|
|
119
|
+
#
|
|
120
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
121
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
122
|
+
# content type.
|
|
111
123
|
mask: nil,
|
|
112
124
|
# The model to use for image generation. One of `dall-e-2` or a GPT image model
|
|
113
125
|
# (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
|
|
@@ -203,6 +215,10 @@ module OpenAI
|
|
|
203
215
|
#
|
|
204
216
|
# For `dall-e-2`, you can only provide one image, and it should be a square `png`
|
|
205
217
|
# file less than 4MB.
|
|
218
|
+
#
|
|
219
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
220
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
221
|
+
# content type.
|
|
206
222
|
image:,
|
|
207
223
|
# A text description of the desired image(s). The maximum length is 1000
|
|
208
224
|
# characters for `dall-e-2`, and 32000 characters for the GPT image models.
|
|
@@ -229,6 +245,10 @@ module OpenAI
|
|
|
229
245
|
# indicate where `image` should be edited. If there are multiple images provided,
|
|
230
246
|
# the mask will be applied on the first image. Must be a valid PNG file, less than
|
|
231
247
|
# 4MB, and have the same dimensions as `image`.
|
|
248
|
+
#
|
|
249
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
250
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
251
|
+
# content type.
|
|
232
252
|
mask: nil,
|
|
233
253
|
# The model to use for image generation. One of `dall-e-2` or a GPT image model
|
|
234
254
|
# (`gpt-image-1`, `gpt-image-1-mini`, `gpt-image-1.5`, `gpt-image-2`,
|
|
@@ -22,6 +22,10 @@ module OpenAI
|
|
|
22
22
|
# Whether to set this version as the default.
|
|
23
23
|
default: nil,
|
|
24
24
|
# Skill files to upload (directory upload) or a single zip file.
|
|
25
|
+
#
|
|
26
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
27
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
28
|
+
# content type.
|
|
25
29
|
files: nil,
|
|
26
30
|
request_options: {}
|
|
27
31
|
)
|
|
@@ -18,6 +18,10 @@ module OpenAI
|
|
|
18
18
|
end
|
|
19
19
|
def create(
|
|
20
20
|
# Skill files to upload (directory upload) or a single zip file.
|
|
21
|
+
#
|
|
22
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
23
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
24
|
+
# content type.
|
|
21
25
|
files: nil,
|
|
22
26
|
request_options: {}
|
|
23
27
|
)
|
|
@@ -27,6 +27,10 @@ module OpenAI
|
|
|
27
27
|
# The ID of the Upload.
|
|
28
28
|
upload_id,
|
|
29
29
|
# The chunk of bytes for this Part.
|
|
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.
|
|
30
34
|
data:,
|
|
31
35
|
request_options: {}
|
|
32
36
|
)
|
|
@@ -22,6 +22,10 @@ module OpenAI
|
|
|
22
22
|
# Text prompt that describes the video to generate.
|
|
23
23
|
prompt:,
|
|
24
24
|
# Optional reference asset upload or reference object that guides generation.
|
|
25
|
+
#
|
|
26
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
27
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
28
|
+
# content type.
|
|
25
29
|
input_reference: nil,
|
|
26
30
|
# The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
|
|
27
31
|
# to `sora-2`.
|
|
@@ -96,6 +100,10 @@ module OpenAI
|
|
|
96
100
|
# Display name for this API character.
|
|
97
101
|
name:,
|
|
98
102
|
# Video file used to create a character.
|
|
103
|
+
#
|
|
104
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
105
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
106
|
+
# content type.
|
|
99
107
|
video:,
|
|
100
108
|
request_options: {}
|
|
101
109
|
)
|
|
@@ -137,6 +145,10 @@ module OpenAI
|
|
|
137
145
|
# Text prompt that describes how to edit the source video.
|
|
138
146
|
prompt:,
|
|
139
147
|
# Reference to the completed video to edit.
|
|
148
|
+
#
|
|
149
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
150
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
151
|
+
# content type.
|
|
140
152
|
video:,
|
|
141
153
|
request_options: {}
|
|
142
154
|
)
|
|
@@ -162,6 +174,10 @@ module OpenAI
|
|
|
162
174
|
# 8, 12, 16, 20).
|
|
163
175
|
seconds:,
|
|
164
176
|
# Reference to the completed video to extend.
|
|
177
|
+
#
|
|
178
|
+
# `String`, `StringIO`, and pathless `IO` inputs are sent with generic upload
|
|
179
|
+
# metadata. Use `OpenAI::FilePart` when you need to override the filename or
|
|
180
|
+
# content type.
|
|
165
181
|
video:,
|
|
166
182
|
request_options: {}
|
|
167
183
|
)
|
data/sig/openai/client.rbs
CHANGED
|
@@ -91,11 +91,15 @@ module OpenAI
|
|
|
91
91
|
?webhook_secret: String?,
|
|
92
92
|
?provider: OpenAI::Provider?,
|
|
93
93
|
?base_url: String?,
|
|
94
|
+
?default_headers: ::Hash[String, String?]?,
|
|
94
95
|
?max_retries: Integer,
|
|
95
|
-
?timeout: Float
|
|
96
|
+
?timeout: Float?,
|
|
96
97
|
?initial_retry_delay: Float,
|
|
97
98
|
?max_retry_delay: Float,
|
|
98
|
-
?http_client: OpenAI::_HTTPClient
|
|
99
|
+
?http_client: OpenAI::_HTTPClient?,
|
|
100
|
+
?logger: OpenAI::_Logger?,
|
|
101
|
+
?log_level: (Symbol | String)?,
|
|
102
|
+
?on_retry: (^(OpenAI::RetryEvent) -> void)?
|
|
99
103
|
) -> void
|
|
100
104
|
end
|
|
101
105
|
end
|
data/sig/openai/errors.rbs
CHANGED
|
@@ -31,6 +31,11 @@ module OpenAI
|
|
|
31
31
|
|
|
32
32
|
attr_accessor type: String?
|
|
33
33
|
|
|
34
|
+
# The ID of the API request, returned via the `x-request-id` response
|
|
35
|
+
# header. This is nil when no HTTP response was received or the response
|
|
36
|
+
# did not include the header.
|
|
37
|
+
def request_id: -> String?
|
|
38
|
+
|
|
34
39
|
def initialize: (
|
|
35
40
|
url: URI::Generic,
|
|
36
41
|
?status: Integer?,
|
data/sig/openai/http_client.rbs
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
1
|
module OpenAI
|
|
2
|
+
interface _Logger
|
|
3
|
+
def debug: (String message) -> untyped
|
|
4
|
+
def info: (String message) -> untyped
|
|
5
|
+
def warn: (String message) -> untyped
|
|
6
|
+
def error: (String message) -> untyped
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
class ResponseMetadata
|
|
10
|
+
attr_reader status: Integer
|
|
11
|
+
attr_reader headers: ::Hash[String, String]
|
|
12
|
+
attr_reader request_id: String?
|
|
13
|
+
|
|
14
|
+
def initialize: (status: Integer, headers: ::Hash[String, String]) -> void
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
class RetryEvent
|
|
18
|
+
attr_reader attempt: Integer
|
|
19
|
+
attr_reader max_attempts: Integer
|
|
20
|
+
attr_reader delay: Float
|
|
21
|
+
attr_reader response: OpenAI::ResponseMetadata?
|
|
22
|
+
attr_reader error: OpenAI::Errors::APIConnectionError?
|
|
23
|
+
|
|
24
|
+
def initialize: (
|
|
25
|
+
attempt: Integer,
|
|
26
|
+
max_attempts: Integer,
|
|
27
|
+
delay: Float,
|
|
28
|
+
response: OpenAI::ResponseMetadata?,
|
|
29
|
+
error: OpenAI::Errors::APIConnectionError?
|
|
30
|
+
) -> void
|
|
31
|
+
|
|
32
|
+
def status: -> Integer?
|
|
33
|
+
def request_id: -> String?
|
|
34
|
+
end
|
|
35
|
+
|
|
2
36
|
interface _HTTPClient
|
|
3
37
|
def execute: (
|
|
4
38
|
OpenAI::HTTPClient::Request request
|
|
@@ -11,14 +45,14 @@ module OpenAI
|
|
|
11
45
|
attr_reader url: URI::Generic
|
|
12
46
|
attr_reader headers: ::Hash[String, String]
|
|
13
47
|
attr_reader body: top
|
|
14
|
-
attr_reader timeout: Float
|
|
48
|
+
attr_reader timeout: Float?
|
|
15
49
|
|
|
16
50
|
def initialize: (
|
|
17
51
|
method: Symbol,
|
|
18
52
|
url: URI::Generic,
|
|
19
53
|
headers: ::Hash[String, String],
|
|
20
54
|
body: top,
|
|
21
|
-
timeout: Float
|
|
55
|
+
timeout: Float?
|
|
22
56
|
) -> void
|
|
23
57
|
end
|
|
24
58
|
|
|
@@ -26,6 +60,7 @@ module OpenAI
|
|
|
26
60
|
attr_reader status: Integer
|
|
27
61
|
attr_reader headers: ::Hash[String, String]
|
|
28
62
|
attr_reader body: Enumerable[String]
|
|
63
|
+
attr_reader metadata: OpenAI::ResponseMetadata
|
|
29
64
|
|
|
30
65
|
def initialize: (
|
|
31
66
|
status: Integer,
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
module OpenAI
|
|
2
|
+
module Internal
|
|
3
|
+
module Logging
|
|
4
|
+
LOG_LEVELS: ::Hash[Symbol, Integer]
|
|
5
|
+
REDACTED_HEADERS: ::Array[String]
|
|
6
|
+
MAX_BODY_BYTES: Integer
|
|
7
|
+
MAX_ARRAY_ITEMS: Integer
|
|
8
|
+
OPAQUE_STRING_BYTES: Integer
|
|
9
|
+
SENSITIVE_BODY_KEY: Regexp
|
|
10
|
+
SENSITIVE_QUERY_KEY: Regexp
|
|
11
|
+
URL_HEADER_KEY: Regexp
|
|
12
|
+
|
|
13
|
+
class Context
|
|
14
|
+
def initialize: (
|
|
15
|
+
logger: OpenAI::_Logger?,
|
|
16
|
+
log_level: Symbol,
|
|
17
|
+
on_retry: (^(OpenAI::RetryEvent) -> void)?,
|
|
18
|
+
method: Symbol,
|
|
19
|
+
url: URI::Generic
|
|
20
|
+
) -> void
|
|
21
|
+
def request_started: (
|
|
22
|
+
OpenAI::HTTPClient::Request request,
|
|
23
|
+
redirect_count: Integer
|
|
24
|
+
) -> void
|
|
25
|
+
def response_received: (
|
|
26
|
+
OpenAI::HTTPClient::Response response
|
|
27
|
+
) -> OpenAI::HTTPClient::Response
|
|
28
|
+
def attempt_failed: (OpenAI::Errors::APIConnectionError error) -> void
|
|
29
|
+
def retry_scheduled: (
|
|
30
|
+
Integer | OpenAI::Errors::APIConnectionError cause,
|
|
31
|
+
delay: Float,
|
|
32
|
+
response: OpenAI::ResponseMetadata?,
|
|
33
|
+
retry_count: Integer,
|
|
34
|
+
max_retries: Integer
|
|
35
|
+
) -> void
|
|
36
|
+
def completed: (OpenAI::HTTPClient::Response response) -> void
|
|
37
|
+
def observe_stream: [Elem] (
|
|
38
|
+
OpenAI::Internal::Type::BaseStream[top, Elem] stream,
|
|
39
|
+
response: OpenAI::HTTPClient::Response
|
|
40
|
+
) -> OpenAI::Internal::Type::BaseStream[top, Elem]
|
|
41
|
+
def request_failed: (StandardError error) -> void
|
|
42
|
+
def response_body: (
|
|
43
|
+
String body,
|
|
44
|
+
headers: ::Hash[String, String],
|
|
45
|
+
complete: bool,
|
|
46
|
+
total_bytes: Integer,
|
|
47
|
+
attempt: Integer
|
|
48
|
+
) -> void
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
class ObservedBody
|
|
52
|
+
include Enumerable[String]
|
|
53
|
+
|
|
54
|
+
def initialize: (
|
|
55
|
+
body: Enumerable[String],
|
|
56
|
+
headers: ::Hash[String, String],
|
|
57
|
+
context: OpenAI::Internal::Logging::Context,
|
|
58
|
+
attempt: Integer
|
|
59
|
+
) -> void
|
|
60
|
+
|
|
61
|
+
def each: { (String) -> void } -> void
|
|
62
|
+
def close: -> void
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def self.normalize_level: (Symbol | String value) -> Symbol
|
|
66
|
+
def self.validate_logger!: (OpenAI::_Logger? logger) -> void
|
|
67
|
+
def self.default_logger: -> OpenAI::_Logger
|
|
68
|
+
def self.enabled?: (Symbol configured_level, Symbol event_level) -> bool
|
|
69
|
+
def self.safe_path: (URI::Generic url) -> String
|
|
70
|
+
def self.safe_url: (URI::Generic url) -> String
|
|
71
|
+
def self.safe_field: (top? value) -> String
|
|
72
|
+
def self.sensitive_header?: (String | Symbol name) -> bool
|
|
73
|
+
def self.credential_header?: (String | Symbol name) -> bool
|
|
74
|
+
def self.format_headers: (::Hash[String, String] headers) -> String
|
|
75
|
+
def self.format_body: (
|
|
76
|
+
top body,
|
|
77
|
+
headers: ::Hash[String, String]
|
|
78
|
+
) -> String
|
|
79
|
+
def self.capture_response_body?: (::Hash[String, String] headers) -> bool
|
|
80
|
+
def self.format_observed_body: (
|
|
81
|
+
String body,
|
|
82
|
+
headers: ::Hash[String, String],
|
|
83
|
+
complete: bool,
|
|
84
|
+
total_bytes: Integer
|
|
85
|
+
) -> String
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
@@ -7,13 +7,15 @@ module OpenAI
|
|
|
7
7
|
attr_accessor prepare_request: (^(
|
|
8
8
|
OpenAI::Internal::Transport::BaseClient::request_input
|
|
9
9
|
) -> OpenAI::Internal::Transport::BaseClient::request_input)?
|
|
10
|
+
attr_accessor authentication_headers: Array[String]
|
|
10
11
|
|
|
11
12
|
def initialize: (
|
|
12
13
|
name: String,
|
|
13
14
|
base_url: String,
|
|
14
15
|
prepare_request: (^(
|
|
15
16
|
OpenAI::Internal::Transport::BaseClient::request_input
|
|
16
|
-
) -> OpenAI::Internal::Transport::BaseClient::request_input)
|
|
17
|
+
) -> OpenAI::Internal::Transport::BaseClient::request_input)?,
|
|
18
|
+
authentication_headers: Array[String]
|
|
17
19
|
) -> void
|
|
18
20
|
end
|
|
19
21
|
|
|
@@ -6,7 +6,9 @@ module OpenAI
|
|
|
6
6
|
|
|
7
7
|
def close: -> void
|
|
8
8
|
|
|
9
|
-
private def read_enum: (Integer? max_len) -> String
|
|
9
|
+
private def read_enum: (Integer? max_len) -> String?
|
|
10
|
+
|
|
11
|
+
private def read_buffer: (Integer max_len) -> String
|
|
10
12
|
|
|
11
13
|
def read: (?Integer? max_len, ?String? out_string) -> String?
|
|
12
14
|
|