Completes the [Upload](https://platform.openai.com/docs/api-reference/uploads/object). Within the returned Upload object, there is a nested [File](https://platform.openai.com/docs/api-reference/files/object) object that is ready to use in the rest of the pla
(
self,
upload_id: str,
*,
part_ids: SequenceNotStr[str],
md5: str | Omit = omit,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
extra_query: Query | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = not_given,
)
| 292 | ) |
| 293 | |
| 294 | def complete( |
| 295 | self, |
| 296 | upload_id: str, |
| 297 | *, |
| 298 | part_ids: SequenceNotStr[str], |
| 299 | md5: str | Omit = omit, |
| 300 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 301 | # The extra values given here take precedence over values defined on the client or passed to this method. |
| 302 | extra_headers: Headers | None = None, |
| 303 | extra_query: Query | None = None, |
| 304 | extra_body: Body | None = None, |
| 305 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 306 | ) -> Upload: |
| 307 | """ |
| 308 | Completes the |
| 309 | [Upload](https://platform.openai.com/docs/api-reference/uploads/object). |
| 310 | |
| 311 | Within the returned Upload object, there is a nested |
| 312 | [File](https://platform.openai.com/docs/api-reference/files/object) object that |
| 313 | is ready to use in the rest of the platform. |
| 314 | |
| 315 | You can specify the order of the Parts by passing in an ordered list of the Part |
| 316 | IDs. |
| 317 | |
| 318 | The number of bytes uploaded upon completion must match the number of bytes |
| 319 | initially specified when creating the Upload object. No Parts may be added after |
| 320 | an Upload is completed. Returns the Upload object with status `completed`, |
| 321 | including an additional `file` property containing the created usable File |
| 322 | object. |
| 323 | |
| 324 | Args: |
| 325 | part_ids: The ordered list of Part IDs. |
| 326 | |
| 327 | md5: The optional md5 checksum for the file contents to verify if the bytes uploaded |
| 328 | matches what you expect. |
| 329 | |
| 330 | extra_headers: Send extra headers |
| 331 | |
| 332 | extra_query: Add additional query parameters to the request |
| 333 | |
| 334 | extra_body: Add additional JSON properties to the request |
| 335 | |
| 336 | timeout: Override the client-level default timeout for this request, in seconds |
| 337 | """ |
| 338 | if not upload_id: |
| 339 | raise ValueError(f"Expected a non-empty value for `upload_id` but received {upload_id!r}") |
| 340 | return self._post( |
| 341 | path_template("/uploads/{upload_id}/complete", upload_id=upload_id), |
| 342 | body=maybe_transform( |
| 343 | { |
| 344 | "part_ids": part_ids, |
| 345 | "md5": md5, |
| 346 | }, |
| 347 | upload_complete_params.UploadCompleteParams, |
| 348 | ), |
| 349 | options=make_request_options( |
| 350 | extra_headers=extra_headers, |
| 351 | extra_query=extra_query, |