Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Documentation/Classes/OpenAI.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ The API provides access to multiple resources that allow seamless interaction wi
| `moderations` | [OpenAIModerationsAPI](OpenAIModerationsAPI.md) | Access to the Moderations API. |
| `embeddings` | [OpenAIEmbeddingsAPI](OpenAIEmbeddingsAPI.md) | Access to the Embeddings API. |
| `files` | [OpenAIFilesAPI](OpenAIFilesAPI.md) | Access to the Files API. |
| `uploads` | [OpenAIUploadsAPI](OpenAIUploadsAPI.md) | Access to the Uploads API. |

### Example Usage

Expand Down
59 changes: 59 additions & 0 deletions Documentation/Classes/OpenAIUpload.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# OpenAIUpload

## Description
Represents a multipart file upload object in OpenAI. The Upload object allows you to upload large files (up to 8 GB) by breaking them into multiple parts.

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `id` | Text | The Upload unique identifier, which can be referenced in API endpoints. |
| `object` | Text | The object type, which is always "upload". |
| `bytes` | Integer | The intended number of bytes to be uploaded. |
| `created_at` | Integer | The Unix timestamp (in seconds) for when the Upload was created. |
| `filename` | Text | The name of the file to be uploaded. |
| `purpose` | Text | The intended purpose of the file. Possible values: `assistants`, `batch`, `fine-tune`, `vision`, `user_data`. |
| `status` | Text | The status of the Upload. Possible values: `pending`, `completed`, `cancelled`, `expired`. |
| `expires_at` | Integer | The Unix timestamp (in seconds) for when the Upload will expire. |
| `file` | cs.AIKit.OpenAIFile | The ready File object after the Upload is completed. Only present when status is "completed". |
| `mime_type` | Text | The MIME type of the file (e.g., "text/jsonl", "image/png", "application/pdf"). Could be returned empty by API.|

## Constructor

```4d
$upload:=cs.AIKit.OpenAIUpload.new($object)
```

**Parameters:**
- `$object` (Object): Object containing upload properties

**Note:** This class is typically instantiated by the API response, not manually by users.

## Example

```4d
// After creating and completing an upload
var $result : cs.AIKit.OpenAIUploadResult
$result:=$client.uploads.complete($uploadId; $params)

If ($result.success)
var $upload : cs.AIKit.OpenAIUpload
$upload:=$result.upload

ALERT("Upload ID: "+$upload.id)
ALERT("Status: "+$upload.status)
ALERT("Filename: "+$upload.filename)

If ($upload.status="completed") && ($upload.file#Null)
ALERT("File ID: "+$upload.file.id)
ALERT("File ready for use!")
End if
End if
```

## See Also
- [OpenAIUploadResult](OpenAIUploadResult.md)
- [OpenAIUploadsAPI](OpenAIUploadsAPI.md)
- [OpenAIUploadParameters](OpenAIUploadParameters.md)
- [OpenAIFile](OpenAIFile.md)
- [OpenAI Uploads API Documentation](https://platform.openai.com/docs/api-reference/uploads)
35 changes: 35 additions & 0 deletions Documentation/Classes/OpenAIUploadCompleteParameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# OpenAIUploadCompleteParameters

## Description
Optional parameters for completing an Upload.

## Inherits

[OpenAIParameters](OpenAIParameters.md)

## Properties

| Property | Type | Required | Default | Description |
| -------- | ---- | -------- | ------- | ----------- |
| `md5` | Text | No | `Null` | The optional MD5 checksum for the file contents to verify if the bytes uploaded matches what you expect. This provides an additional verification step to ensure file integrity. |

## Example

```4d
VAR $uploadId:="upload_abc123"
VAR $partIds:=["part_def456"; "part_ghi789"; "part_jkl012"]

$md5Hash:="5d41402abc4b2a76b9719d911017c592" // Example MD5
var $completeParams:=cs.AIKit.OpenAIUploadCompleteParameters.new()
$completeParams.md5:=$md5Hash // Optional verification

// Complete the upload - part_ids is passed as explicit parameter
$result:=$client.uploads.complete($uploadId; $partIds; $completeParams)
```

## See Also
- [OpenAIUpload](OpenAIUpload.md)
- [OpenAIUploadResult](OpenAIUploadResult.md)
- [OpenAIUploadPart](OpenAIUploadPart.md)
- [OpenAIUploadsAPI](OpenAIUploadsAPI.md)
- [OpenAI Uploads API Documentation](https://platform.openai.com/docs/api-reference/uploads/complete)
36 changes: 36 additions & 0 deletions Documentation/Classes/OpenAIUploadParameters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# OpenAIUploadParameters

## Description
Optional parameters for creating an Upload object in OpenAI.

## Inherits

[OpenAIParameters](OpenAIParameters.md)

## Properties

| Property | Type | Required | Default | Description |
| -------- | ---- | -------- | ------- | ----------- |
| `expires_after` | Object | No | `Null` | The expiration policy for a file. By default, files with `purpose=batch` expire after 30 days and all other files are persisted until they are manually deleted. Object structure: `{anchor: "created_at", seconds: 3600}` where `seconds` must be between 3600 (1 hour) and 2592000 (30 days). |


## Example

```4d
var $params:=cs.AIKit.OpenAIUploadParameters.new({\
expires_after: {\
anchor: "created_at"; \
seconds: 7200\
}\
})

// Mandatory parameters are passed to the function
$result:=$client.uploads.create("large_dataset.jsonl"; 2147483648; "batch"; "text/jsonl"; $params)
```

## See Also
- [OpenAIUpload](OpenAIUpload.md)
- [OpenAIUploadResult](OpenAIUploadResult.md)
- [OpenAIUploadsAPI](OpenAIUploadsAPI.md)
- [OpenAIParameters](OpenAIParameters.md)
- [OpenAI Uploads API Documentation](https://platform.openai.com/docs/api-reference/uploads/create)
19 changes: 19 additions & 0 deletions Documentation/Classes/OpenAIUploadPart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# OpenAIUploadPart

## Description
Represents a chunk of bytes added to an Upload object. Each Part can be up to 64 MB in size, and multiple Parts can be uploaded in parallel.

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `id` | Text | The upload Part unique identifier, which can be referenced in API endpoints. |
| `object` | Text | The object type, which is always "upload.part". |
| `created_at` | Integer | The Unix timestamp (in seconds) for when the Part was created. |
| `upload_id` | Text | The ID of the Upload object that this Part was added to. |

## See Also
- [OpenAIUploadPartResult](OpenAIUploadPartResult.md)
- [OpenAIUploadsAPI](OpenAIUploadsAPI.md)
- [OpenAIUpload](OpenAIUpload.md)
- [OpenAI Uploads API Documentation](https://platform.openai.com/docs/api-reference/uploads/add-part)
19 changes: 19 additions & 0 deletions Documentation/Classes/OpenAIUploadPartResult.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# OpenAIUploadPartResult

## Description
Result class for Upload Part operations. Contains the upload part object returned by the API after adding a part to an upload, along with success/error status.

## Inherits

[OpenAIResult](OpenAIResult.md)

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `part` | cs.AIKit.OpenAIUploadPart | (read-only) Returns the upload part object from the API response. Returns Null if the response is invalid. |

## See Also
- [OpenAIUploadPart](OpenAIUploadPart.md)
- [OpenAIUploadsAPI](OpenAIUploadsAPI.md)
- [OpenAI Uploads API Documentation](https://platform.openai.com/docs/api-reference/uploads/add-part)
19 changes: 19 additions & 0 deletions Documentation/Classes/OpenAIUploadResult.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# OpenAIUploadResult

## Description
Result class for Upload operations (create, complete, or cancel). Contains the upload object returned by the API along with success/error status.

## Inherits

[OpenAIResult](OpenAIResult.md)

## Properties

| Property | Type | Description |
| -------- | ---- | ----------- |
| `upload` | cs.AIKit.OpenAIUpload | Returns the upload object from the API response. Returns Null if the response is invalid. |

## See Also
- [OpenAIUpload](OpenAIUpload.md)
- [OpenAIUploadsAPI](OpenAIUploadsAPI.md)
- [OpenAI Uploads API Documentation](https://platform.openai.com/docs/api-reference/uploads)
Loading
Loading