Steps to upload the file is provided in the below URL:
https://platform.openai.com/docs/api-reference/files/create
The sample curl command provided in this page is:
curl https://api.openai.com/v1/files \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-F purpose="fine-tune" \
-F file="@mydata.jsonl"
One will have to update this curl command with one’s details. Below is my example:
curl https://api.openai.com/v1/files -H "Authorization: Bearer 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" -F purpose="fine-tune" -F file="@toy_chat_fine_tuning.jsonl"
Then run it in Windows command prompt as below:
C:\Users\abhis\Downloads\Files>curl https://api.openai.com/v1/files -H "Authorization: Bearer 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" -F purpose="fine-tune" -F file="@toy_chat_fine_tuning.jsonl"
{
"object": "file",
"id": "file-k7YXCvhph7gz7O7MijIOTBtE",
"purpose": "fine-tune",
"filename": "toy_chat_fine_tuning.jsonl",
"bytes": 27385,
"created_at": 1696991013,
"status": "uploaded",
"status_details": null
}
===========
To get the files list which are upload use below:
In the below URL the curl command is given:
https://platform.openai.com/docs/api-reference/files/list
Sample curl command is:
curl https://api.openai.com/v1/files \
-H "Authorization: Bearer $OPENAI_API_KEY"
For my case the curl command becomes:
curl https://api.openai.com/v1/files -H "Authorization: Bearer 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"
Below is the returned response:
C:\Users\abhis\Downloads\Files>curl https://api.openai.com/v1/files -H "Authorization: Bearer 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"
{
"object": "list",
"data": [
{
"object": "file",
"id": "file-k7YXCvhph7gz7O7MijIOTBtE",
"purpose": "fine-tune",
"filename": "toy_chat_fine_tuning.jsonl",
"bytes": 27385,
"created_at": 1696991013,
"status": "processed",
"status_details": null
}
]
}
================
Another file uploaded:
C:\Users\abhis\Downloads\Files>curl https://api.openai.com/v1/files -H "Authorization: Bearer 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" -F purpose="fine-tune" -F file="@toy_chat_fine_tuning1.jsonl"
{
"object": "file",
"id": "file-50CRdE0EoFDDVC2qPpUTq58N",
"purpose": "fine-tune",
"filename": "toy_chat_fine_tuning1.jsonl",
"bytes": 4272,
"created_at": 1697079119,
"status": "uploaded",
"status_details": null
}
Sample file:
https://drive.google.com/drive/folders/17eFxqizGSnocqVG_1VrdDw3_ZsgVSJEx?usp=sharing