Skip to content

Commit 3979765

Browse files
feat(api): manual updates
merge sora api changes
1 parent 5df8826 commit 3979765

14 files changed

Lines changed: 357 additions & 175 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 151
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-4e24269912b73a40b8af1ab2a59f99069b1f8cce2ff6ff342f2ad8644e94531e.yml
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-8de5b14ece687aac55187d923c8dca4b8c4a4dbaaa38bb1bcfffc975d441aca8.yml
33
openapi_spec_hash: 626982004d5a594a822fa7883422efb4
4-
config_hash: 5e5cd24c6e3b2585b61b8fa0af24ade7
4+
config_hash: 8421b0e4dae127df4dcc071c1aa5ea1a

lib/openai/models/video_create_params.rb

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ class VideoCreateParams < OpenAI::Internal::Type::BaseModel
1414
required :prompt, String
1515

1616
# @!attribute input_reference
17-
# Optional reference object that guides generation. Provide exactly one of
18-
# `image_url` or `file_id`.
17+
# Optional reference asset upload or reference object that guides generation.
1918
#
20-
# @return [OpenAI::Models::VideoCreateParams::InputReference, nil]
21-
optional :input_reference, -> { OpenAI::VideoCreateParams::InputReference }
19+
# @return [Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::VideoCreateParams::InputReference::ImageRefParam2, nil]
20+
optional :input_reference, union: -> { OpenAI::VideoCreateParams::InputReference }
2221

2322
# @!attribute model
2423
# The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
@@ -46,8 +45,7 @@ class VideoCreateParams < OpenAI::Internal::Type::BaseModel
4645
#
4746
# @param prompt [String] Text prompt that describes the video to generate.
4847
#
49-
# @param input_reference [OpenAI::Models::VideoCreateParams::InputReference] Optional reference object that guides generation. Provide exactly one of
50-
# `image\_
48+
# @param input_reference [Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::VideoCreateParams::InputReference::ImageRefParam2] Optional reference asset upload or reference object that guides generation.
5149
#
5250
# @param model [String, Symbol, OpenAI::Models::VideoModel] The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
5351
#
@@ -57,25 +55,35 @@ class VideoCreateParams < OpenAI::Internal::Type::BaseModel
5755
#
5856
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
5957

60-
class InputReference < OpenAI::Internal::Type::BaseModel
61-
# @!attribute file_id
62-
#
63-
# @return [String, nil]
64-
optional :file_id, String
58+
# Optional reference asset upload or reference object that guides generation.
59+
module InputReference
60+
extend OpenAI::Internal::Type::Union
6561

66-
# @!attribute image_url
67-
# A fully qualified URL or base64-encoded data URL.
68-
#
69-
# @return [String, nil]
70-
optional :image_url, String
62+
# Optional reference asset upload or reference object that guides generation.
63+
variant OpenAI::Internal::Type::FileInput
7164

72-
# @!method initialize(file_id: nil, image_url: nil)
73-
# Optional reference object that guides generation. Provide exactly one of
74-
# `image_url` or `file_id`.
75-
#
76-
# @param file_id [String]
77-
#
78-
# @param image_url [String] A fully qualified URL or base64-encoded data URL.
65+
variant -> { OpenAI::VideoCreateParams::InputReference::ImageRefParam2 }
66+
67+
class ImageRefParam2 < OpenAI::Internal::Type::BaseModel
68+
# @!attribute file_id
69+
#
70+
# @return [String, nil]
71+
optional :file_id, String
72+
73+
# @!attribute image_url
74+
# A fully qualified URL or base64-encoded data URL.
75+
#
76+
# @return [String, nil]
77+
optional :image_url, String
78+
79+
# @!method initialize(file_id: nil, image_url: nil)
80+
# @param file_id [String]
81+
#
82+
# @param image_url [String] A fully qualified URL or base64-encoded data URL.
83+
end
84+
85+
# @!method self.variants
86+
# @return [Array(StringIO, OpenAI::Models::VideoCreateParams::InputReference::ImageRefParam2)]
7987
end
8088
end
8189
end

lib/openai/models/video_edit_params.rb

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,41 @@ class VideoEditParams < OpenAI::Internal::Type::BaseModel
1616
# @!attribute video
1717
# Reference to the completed video to edit.
1818
#
19-
# @return [OpenAI::Models::VideoEditParams::Video]
20-
required :video, -> { OpenAI::VideoEditParams::Video }
19+
# @return [Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::VideoEditParams::Video::VideoReferenceInputParam]
20+
required :video, union: -> { OpenAI::VideoEditParams::Video }
2121

2222
# @!method initialize(prompt:, video:, request_options: {})
2323
# @param prompt [String] Text prompt that describes how to edit the source video.
2424
#
25-
# @param video [OpenAI::Models::VideoEditParams::Video] Reference to the completed video to edit.
25+
# @param video [Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::VideoEditParams::Video::VideoReferenceInputParam] Reference to the completed video to edit.
2626
#
2727
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
2828

29-
class Video < OpenAI::Internal::Type::BaseModel
30-
# @!attribute id
31-
# The identifier of the completed video.
32-
#
33-
# @return [String]
34-
required :id, String
35-
36-
# @!method initialize(id:)
37-
# Reference to the completed video to edit.
38-
#
39-
# @param id [String] The identifier of the completed video.
29+
# Reference to the completed video to edit.
30+
module Video
31+
extend OpenAI::Internal::Type::Union
32+
33+
# Reference to the completed video to edit.
34+
variant OpenAI::Internal::Type::FileInput
35+
36+
# Reference to the completed video.
37+
variant -> { OpenAI::VideoEditParams::Video::VideoReferenceInputParam }
38+
39+
class VideoReferenceInputParam < OpenAI::Internal::Type::BaseModel
40+
# @!attribute id
41+
# The identifier of the completed video.
42+
#
43+
# @return [String]
44+
required :id, String
45+
46+
# @!method initialize(id:)
47+
# Reference to the completed video.
48+
#
49+
# @param id [String] The identifier of the completed video.
50+
end
51+
52+
# @!method self.variants
53+
# @return [Array(StringIO, OpenAI::Models::VideoEditParams::Video::VideoReferenceInputParam)]
4054
end
4155
end
4256
end

lib/openai/models/video_extend_params.rb

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ class VideoExtendParams < OpenAI::Internal::Type::BaseModel
2121
required :seconds, enum: -> { OpenAI::VideoSeconds }
2222

2323
# @!attribute video
24-
# Reference to the completed video to extend.
24+
# Reference to the completed video.
2525
#
26-
# @return [OpenAI::Models::VideoExtendParams::Video]
27-
required :video, -> { OpenAI::VideoExtendParams::Video }
26+
# @return [OpenAI::Models::VideoExtendParams::Video::VideoReferenceInputParam, Pathname, StringIO, IO, String, OpenAI::FilePart]
27+
required :video, union: -> { OpenAI::VideoExtendParams::Video }
2828

2929
# @!method initialize(prompt:, seconds:, video:, request_options: {})
3030
# Some parameter documentations has been truncated, see
@@ -34,21 +34,35 @@ class VideoExtendParams < OpenAI::Internal::Type::BaseModel
3434
#
3535
# @param seconds [Symbol, OpenAI::Models::VideoSeconds] Length of the newly generated extension segment in seconds (allowed values: 4, 8
3636
#
37-
# @param video [OpenAI::Models::VideoExtendParams::Video] Reference to the completed video to extend.
37+
# @param video [OpenAI::Models::VideoExtendParams::Video::VideoReferenceInputParam, Pathname, StringIO, IO, String, OpenAI::FilePart] Reference to the completed video.
3838
#
3939
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}]
4040

41-
class Video < OpenAI::Internal::Type::BaseModel
42-
# @!attribute id
43-
# The identifier of the completed video.
44-
#
45-
# @return [String]
46-
required :id, String
47-
48-
# @!method initialize(id:)
49-
# Reference to the completed video to extend.
50-
#
51-
# @param id [String] The identifier of the completed video.
41+
# Reference to the completed video.
42+
module Video
43+
extend OpenAI::Internal::Type::Union
44+
45+
# Reference to the completed video.
46+
variant -> { OpenAI::VideoExtendParams::Video::VideoReferenceInputParam }
47+
48+
# Reference to the completed video to extend.
49+
variant OpenAI::Internal::Type::FileInput
50+
51+
class VideoReferenceInputParam < OpenAI::Internal::Type::BaseModel
52+
# @!attribute id
53+
# The identifier of the completed video.
54+
#
55+
# @return [String]
56+
required :id, String
57+
58+
# @!method initialize(id:)
59+
# Reference to the completed video.
60+
#
61+
# @param id [String] The identifier of the completed video.
62+
end
63+
64+
# @!method self.variants
65+
# @return [Array(OpenAI::Models::VideoExtendParams::Video::VideoReferenceInputParam, StringIO)]
5266
end
5367
end
5468
end

lib/openai/resources/videos.rb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ class Videos
1515
#
1616
# @param prompt [String] Text prompt that describes the video to generate.
1717
#
18-
# @param input_reference [OpenAI::Models::VideoCreateParams::InputReference] Optional reference object that guides generation. Provide exactly one of
19-
# `image\_
18+
# @param input_reference [Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::VideoCreateParams::InputReference::ImageRefParam2] Optional reference asset upload or reference object that guides generation.
2019
#
2120
# @param model [String, Symbol, OpenAI::Models::VideoModel] The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
2221
#
@@ -147,7 +146,7 @@ def download_content(video_id, params = {})
147146
#
148147
# @param prompt [String] Text prompt that describes how to edit the source video.
149148
#
150-
# @param video [OpenAI::Models::VideoEditParams::Video] Reference to the completed video to edit.
149+
# @param video [Pathname, StringIO, IO, String, OpenAI::FilePart, OpenAI::Models::VideoEditParams::Video::VideoReferenceInputParam] Reference to the completed video to edit.
151150
#
152151
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
153152
#
@@ -177,7 +176,7 @@ def edit(params)
177176
#
178177
# @param seconds [Symbol, OpenAI::Models::VideoSeconds] Length of the newly generated extension segment in seconds (allowed values: 4, 8
179178
#
180-
# @param video [OpenAI::Models::VideoExtendParams::Video] Reference to the completed video to extend.
179+
# @param video [OpenAI::Models::VideoExtendParams::Video::VideoReferenceInputParam, Pathname, StringIO, IO, String, OpenAI::FilePart] Reference to the completed video.
181180
#
182181
# @param request_options [OpenAI::RequestOptions, Hash{Symbol=>Object}, nil]
183182
#

rbi/openai/models/video_create_params.rbi

Lines changed: 71 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,26 @@ module OpenAI
1515
sig { returns(String) }
1616
attr_accessor :prompt
1717

18-
# Optional reference object that guides generation. Provide exactly one of
19-
# `image_url` or `file_id`.
20-
sig { returns(T.nilable(OpenAI::VideoCreateParams::InputReference)) }
18+
# Optional reference asset upload or reference object that guides generation.
19+
sig do
20+
returns(
21+
T.nilable(
22+
T.any(
23+
OpenAI::Internal::FileInput,
24+
OpenAI::VideoCreateParams::InputReference::ImageRefParam2
25+
)
26+
)
27+
)
28+
end
2129
attr_reader :input_reference
2230

2331
sig do
2432
params(
25-
input_reference: OpenAI::VideoCreateParams::InputReference::OrHash
33+
input_reference:
34+
T.any(
35+
OpenAI::Internal::FileInput,
36+
OpenAI::VideoCreateParams::InputReference::ImageRefParam2::OrHash
37+
)
2638
).void
2739
end
2840
attr_writer :input_reference
@@ -53,7 +65,11 @@ module OpenAI
5365
sig do
5466
params(
5567
prompt: String,
56-
input_reference: OpenAI::VideoCreateParams::InputReference::OrHash,
68+
input_reference:
69+
T.any(
70+
OpenAI::Internal::FileInput,
71+
OpenAI::VideoCreateParams::InputReference::ImageRefParam2::OrHash
72+
),
5773
model: T.any(String, OpenAI::VideoModel::OrSymbol),
5874
seconds: OpenAI::VideoSeconds::OrSymbol,
5975
size: OpenAI::VideoSize::OrSymbol,
@@ -63,8 +79,7 @@ module OpenAI
6379
def self.new(
6480
# Text prompt that describes the video to generate.
6581
prompt:,
66-
# Optional reference object that guides generation. Provide exactly one of
67-
# `image_url` or `file_id`.
82+
# Optional reference asset upload or reference object that guides generation.
6883
input_reference: nil,
6984
# The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
7085
# to `sora-2`.
@@ -82,7 +97,11 @@ module OpenAI
8297
override.returns(
8398
{
8499
prompt: String,
85-
input_reference: OpenAI::VideoCreateParams::InputReference,
100+
input_reference:
101+
T.any(
102+
OpenAI::Internal::FileInput,
103+
OpenAI::VideoCreateParams::InputReference::ImageRefParam2
104+
),
86105
model: T.any(String, OpenAI::VideoModel::OrSymbol),
87106
seconds: OpenAI::VideoSeconds::OrSymbol,
88107
size: OpenAI::VideoSize::OrSymbol,
@@ -93,42 +112,61 @@ module OpenAI
93112
def to_hash
94113
end
95114

96-
class InputReference < OpenAI::Internal::Type::BaseModel
97-
OrHash =
115+
# Optional reference asset upload or reference object that guides generation.
116+
module InputReference
117+
extend OpenAI::Internal::Type::Union
118+
119+
Variants =
98120
T.type_alias do
99121
T.any(
100-
OpenAI::VideoCreateParams::InputReference,
101-
OpenAI::Internal::AnyHash
122+
StringIO,
123+
OpenAI::VideoCreateParams::InputReference::ImageRefParam2
102124
)
103125
end
104126

105-
sig { returns(T.nilable(String)) }
106-
attr_reader :file_id
127+
class ImageRefParam2 < OpenAI::Internal::Type::BaseModel
128+
OrHash =
129+
T.type_alias do
130+
T.any(
131+
OpenAI::VideoCreateParams::InputReference::ImageRefParam2,
132+
OpenAI::Internal::AnyHash
133+
)
134+
end
107135

108-
sig { params(file_id: String).void }
109-
attr_writer :file_id
136+
sig { returns(T.nilable(String)) }
137+
attr_reader :file_id
110138

111-
# A fully qualified URL or base64-encoded data URL.
112-
sig { returns(T.nilable(String)) }
113-
attr_reader :image_url
139+
sig { params(file_id: String).void }
140+
attr_writer :file_id
114141

115-
sig { params(image_url: String).void }
116-
attr_writer :image_url
117-
118-
# Optional reference object that guides generation. Provide exactly one of
119-
# `image_url` or `file_id`.
120-
sig do
121-
params(file_id: String, image_url: String).returns(T.attached_class)
122-
end
123-
def self.new(
124-
file_id: nil,
125142
# A fully qualified URL or base64-encoded data URL.
126-
image_url: nil
127-
)
143+
sig { returns(T.nilable(String)) }
144+
attr_reader :image_url
145+
146+
sig { params(image_url: String).void }
147+
attr_writer :image_url
148+
149+
sig do
150+
params(file_id: String, image_url: String).returns(T.attached_class)
151+
end
152+
def self.new(
153+
file_id: nil,
154+
# A fully qualified URL or base64-encoded data URL.
155+
image_url: nil
156+
)
157+
end
158+
159+
sig { override.returns({ file_id: String, image_url: String }) }
160+
def to_hash
161+
end
128162
end
129163

130-
sig { override.returns({ file_id: String, image_url: String }) }
131-
def to_hash
164+
sig do
165+
override.returns(
166+
T::Array[OpenAI::VideoCreateParams::InputReference::Variants]
167+
)
168+
end
169+
def self.variants
132170
end
133171
end
134172
end

0 commit comments

Comments
 (0)