정의
Files are used to upload documents that can be used with features like Fine-tuning.
API
총 5개 API가 있습니다.
List files / Upload file / Delete file / Retrieve file / Retrieve file content
이 중 (2) Upload file에 대해 알아보겠습니다.
Upload file
POST https://api.openai.com/v1/files
Upload a file that contains document(s) to be used across various endpoints/features. Currently, the size of the files uploaded by one organization can be up to 1GB.
Request body
file (string / 필수) | Name of the JSON Lines file to be uploaded. | If the purpose is set to “fine-tune”, ech line is a JSON record with “prompt” and “completion” fields representing your training examples. |
purpose (string / 필수) | The intended purpose of the uploaded documents. | Use “fine-tune” for Fine-tuning. This allows us to validate the format of the uploaded file. |
Example request
curl https://api.openai.com/v1/files \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-F purpose="fine-tune" \
-F file="@mydata.jsonl"
Response
{
"id": "file-XjGxS3KTG0uNmNOK362iJua3",
"object": "file",
"bytes": 140,
"created_at": 1613779121,
"filename": "mydata.jsonl",
"purpose": "fine-tune"
}
결과
API 결과는 다음과 같습니다.