Creates an intermediate [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object that you can add [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to. Currently, an Upload can accept at most 8 GB in total and e
(
self,
*,
bytes: int,
filename: str,
mime_type: str,
purpose: FilePurpose,
expires_after: upload_create_params.ExpiresAfter | 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,
)
| 166 | return self.complete(upload_id=upload.id, part_ids=part_ids, md5=md5) |
| 167 | |
| 168 | def create( |
| 169 | self, |
| 170 | *, |
| 171 | bytes: int, |
| 172 | filename: str, |
| 173 | mime_type: str, |
| 174 | purpose: FilePurpose, |
| 175 | expires_after: upload_create_params.ExpiresAfter | Omit = omit, |
| 176 | # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. |
| 177 | # The extra values given here take precedence over values defined on the client or passed to this method. |
| 178 | extra_headers: Headers | None = None, |
| 179 | extra_query: Query | None = None, |
| 180 | extra_body: Body | None = None, |
| 181 | timeout: float | httpx.Timeout | None | NotGiven = not_given, |
| 182 | ) -> Upload: |
| 183 | """ |
| 184 | Creates an intermediate |
| 185 | [Upload](https://platform.openai.com/docs/api-reference/uploads/object) object |
| 186 | that you can add |
| 187 | [Parts](https://platform.openai.com/docs/api-reference/uploads/part-object) to. |
| 188 | Currently, an Upload can accept at most 8 GB in total and expires after an hour |
| 189 | after you create it. |
| 190 | |
| 191 | Once you complete the Upload, we will create a |
| 192 | [File](https://platform.openai.com/docs/api-reference/files/object) object that |
| 193 | contains all the parts you uploaded. This File is usable in the rest of our |
| 194 | platform as a regular File object. |
| 195 | |
| 196 | For certain `purpose` values, the correct `mime_type` must be specified. Please |
| 197 | refer to documentation for the |
| 198 | [supported MIME types for your use case](https://platform.openai.com/docs/assistants/tools/file-search#supported-files). |
| 199 | |
| 200 | For guidance on the proper filename extensions for each purpose, please follow |
| 201 | the documentation on |
| 202 | [creating a File](https://platform.openai.com/docs/api-reference/files/create). |
| 203 | |
| 204 | Returns the Upload object with status `pending`. |
| 205 | |
| 206 | Args: |
| 207 | bytes: The number of bytes in the file you are uploading. |
| 208 | |
| 209 | filename: The name of the file to upload. |
| 210 | |
| 211 | mime_type: The MIME type of the file. |
| 212 | |
| 213 | This must fall within the supported MIME types for your file purpose. See the |
| 214 | supported MIME types for assistants and vision. |
| 215 | |
| 216 | purpose: The intended purpose of the uploaded file. |
| 217 | |
| 218 | See the |
| 219 | [documentation on File purposes](https://platform.openai.com/docs/api-reference/files/create#files-create-purpose). |
| 220 | |
| 221 | expires_after: The expiration policy for a file. By default, files with `purpose=batch` expire |
| 222 | after 30 days and all other files are persisted until they are manually deleted. |
| 223 | |
| 224 | extra_headers: Send extra headers |
| 225 |
no test coverage detected