Complete upload
uploads.complete(strupload_id, UploadCompleteParams**kwargs) -> Upload
POST/uploads/{upload_id}/complete
Completes the Upload.
Within the returned Upload object, there is a nested File object that is ready to use in the rest of the platform.
You can specify the order of the Parts by passing in an ordered list of the Part IDs.
The number of bytes uploaded upon completion must match the number of bytes initially specified when creating the Upload object. No Parts may be added after an Upload is completed.
Parameters
upload_id: str
The ordered list of Part IDs.
md5: Optional[str]
The optional md5 checksum for the file contents to verify if the bytes uploaded matches what you expect.
Returns
Complete upload
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
upload = client.uploads.complete(
upload_id="upload_abc123",
part_ids=["string"],
)
print(upload.id){
"id": "id",
"bytes": 0,
"created_at": 0,
"expires_at": 0,
"filename": "filename",
"object": "upload",
"purpose": "purpose",
"status": "pending",
"file": {
"id": "id",
"bytes": 0,
"created_at": 0,
"filename": "filename",
"object": "file",
"purpose": "assistants",
"status": "uploaded",
"expires_at": 0,
"status_details": "status_details"
}
}Returns Examples
{
"id": "id",
"bytes": 0,
"created_at": 0,
"expires_at": 0,
"filename": "filename",
"object": "upload",
"purpose": "purpose",
"status": "pending",
"file": {
"id": "id",
"bytes": 0,
"created_at": 0,
"filename": "filename",
"object": "file",
"purpose": "assistants",
"status": "uploaded",
"expires_at": 0,
"status_details": "status_details"
}
}