Class: OpenAI::Resources::Uploads::Parts
- Inherits:
-
Object
- Object
- OpenAI::Resources::Uploads::Parts
- Defined in:
- lib/openai/resources/uploads/parts.rb
Overview
Use Uploads to upload large files in multiple parts.
Instance Method Summary collapse
-
#create(upload_id, data:, request_options: {}) ⇒ OpenAI::Models::Uploads::UploadPart
Some parameter documentations has been truncated, see Models::Uploads::PartCreateParams for more details.
-
#initialize(client:) ⇒ Parts
constructor
private
A new instance of Parts.
Constructor Details
#initialize(client:) ⇒ Parts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Parts.
49 50 51 |
# File 'lib/openai/resources/uploads/parts.rb', line 49 def initialize(client:) @client = client end |
Instance Method Details
#create(upload_id, data:, request_options: {}) ⇒ OpenAI::Models::Uploads::UploadPart
Some parameter documentations has been truncated, see Models::Uploads::PartCreateParams for more details.
Adds a [Part](platform.openai.com/docs/api-reference/uploads/part-object) to an [Upload](platform.openai.com/docs/api-reference/uploads/object) object. A Part represents a chunk of bytes from the file you are trying to upload.
Each Part can be at most 64 MB, and you can add Parts until you hit the Upload maximum of 8 GB.
It is possible to add multiple Parts in parallel. You can decide the intended order of the Parts when you [complete the Upload](platform.openai.com/docs/api-reference/uploads/complete).
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/openai/resources/uploads/parts.rb', line 34 def create(upload_id, params) parsed, = OpenAI::Uploads::PartCreateParams.dump_request(params) @client.request( method: :post, path: ["uploads/%1$s/parts", upload_id], headers: {"content-type" => "multipart/form-data"}, body: parsed, model: OpenAI::Uploads::UploadPart, options: ) end |