OpenAI | Uploads
Upload large files in parts. The Uploads API allows you to upload files larger than 512 MB by splitting them into parts and uploading each part separately.
Simple Example
Create an upload, add a part, and complete it.
OpenAI := TsgcHTTP_API_OpenAI.Create(nil);
OpenAI.OpenAIOptions.ApiKey := 'API_KEY';
// Create an upload
vUploadResponse := OpenAI._CreateUpload('training_data.jsonl', 'fine-tune',
2147483648, 'application/jsonl');
// Add a part
vPartResponse := OpenAI._AddUploadPart('upload_abc123', 'part1.jsonl');
// Complete the upload
WriteLn(OpenAI._CompleteUpload('upload_abc123', '["part_abc123"]'));
Methods
- CreateUpload: Creates an intermediate Upload object to begin a multi-part upload.
- Filename: The name of the file to upload.
- Purpose: The intended purpose of the uploaded file (e.g. fine-tune).
- Bytes: The number of bytes in the file.
- MimeType: The MIME type of the file (e.g. application/jsonl).
- AddUploadPart: Adds a part to an Upload object.
- UploadId: The ID of the Upload.
- Filename: The chunk of bytes for this part.
- CompleteUpload: Completes the Upload. The uploaded file is usable only after completion.
- UploadId: The ID of the Upload.
- PartIds: The ordered list of Part IDs as a JSON array string.
- CancelUpload: Cancels the Upload. No parts may be added after cancellation.
- UploadId: The ID of the Upload to cancel.