Preparing Files for Fine-Tuning
ScaleGenAI provides OpenAI SDK compatibility to prepare your training and validation files for fine-tuning. The following are the available methods.
Function | Description |
---|---|
upload | Upload a file. |
list | Get the list of all uploaded files. |
get | Get a file. |
delete | Delete an uploaded file. |
Upload File for Fine-Tuning
Endpoint: /openai/v1/files
Description
Upload training/validation file for fine-tuning a model.
Request
- Method:
POST
- Headers:
- Content-Type:
multipart/form-data
- Content-Type:
- Body:
{
"purpose": "string",
"file": "string"
}
Parameter Description
purpose
:: string : The intended purpose of the file. Supported values are fine-tune, fine-tune-results, assistants, and assistants_output.file
:: string : The training/validation file.
Response
Code: 200
{
"id": "string",
"bytes": 0,
"created_at": 0,
"filename": "string",
"object": "file",
"purpose": "fine-tune"
}
Example
curl -X POST \
-H "Content-Type: multipart/form-data" \
-d '{
"purpose": "fine-tune",
"file": "file.txt"
}' \
https://api.example.com/openai/v1/files
List All Files
Endpoint: /openai/v1/files
Description
List all the uploaded files.
Request
- Method:
GET
- Headers:
- Content-Type:
application/json
- Content-Type:
- Body:
{
"purpose": "string",
}
Parameter Description
purpose
:: string : The intended purpose of the file. Supported values are fine-tune, fine-tune-results, assistants, and assistants_output.
Response
Code: 200
{
"data": [
{
"id": "string",
"bytes": 0,
"created_at": 0,
"filename": "string",
"object": "file",
"purpose": "fine-tune"
}
],
"object": "list"
}
Example
curl -X GET \
-H "Content-Type: application/json" \
-d '{
"purpose": "fine-tune",
}' \
https://api.example.com/openai/v1/files
Retrieve File Info
Endpoint: /openai/v1/files/{file_id}
Description
Retrieve information for the uploaded file associated with a certain file ID.
Request
- Method:
GET
- Headers:
- Content-Type:
application/json
- Content-Type:
Parameter Description
file_id
:: string : File ID associated with the file.
Response
Code: 200
{
"id": "string",
"bytes": 0,
"created_at": 0,
"filename": "string",
"object": "file",
"purpose": "fine-tune"
}
Example
curl -X GET \
-H "Content-Type: application/json" \
https://api.example.com/openai/v1/files/test_file_id
Delete Uploaded File
Endpoint: /openai/v1/files/{file_id}
Description
Delete an uploaded file.
Request
- Method:
DELETE
- Headers:
- Content-Type:
application/json
- Content-Type:
Parameter Description
file_id
:: string : File ID associated with the file.
Response
Code: 200
{
"id": "string",
"object": "file",
"deleted": true
}
Example
curl -X DELETE \
-H "Content-Type: application/json" \
https://api.example.com/openai/v1/files/test_file_id