Files
"Files" are used to upload documents that can be used with features like "Inference Batch API". You need to first create the file object using "/v1/files" and get the presigned upload url. Then upload the file through presigned url.
Functionality
Max File Size
File Extension
File Format Required
Inference Batch API
100 MB
.jsonl
The file upload API returns a presigned upload URL, and the file needs to be uploaded using this presigned URL. The presigned URL is valid for 2 hours.
Step 1: Create a File Object
In this step, you create a file object, which initializes the upload process by providing essential metadata like the file name and type. The "purpose" parameter must be set to "batch".
Example Request:
curl --location 'https://api.netmind.ai/v1/files' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API_TOKEN}}' \
--data '{"file_name":"text.jsonl","purpose":"batch"}'import requests
import json
url = "https://api.netmind.ai/v1/files"
payload = json.dumps({
"file_name": "text.jsonl",
"purpose": "fine-tune"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer {{API_TOKEN}}'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)Example Response:
{
"id": "c67b7...298f3",
"presigned_url": "https://FAKE_PRESIGNED_URL/..."
}Step 2: Upload File Using Presigned URL
Example Request:
Example Response:
Last updated
Was this helpful?