99
1010from ...lib import polling
1111from ..._types import Body , Omit , Query , Headers , NotGiven , FileTypes , SequenceNotStr , omit , not_given
12+ from ...lib .multipart_upload import MultipartUploadOptions
1213from ..._utils import maybe_transform , async_maybe_transform
1314from ..._compat import cached_property
1415from ..._resource import SyncAPIResource , AsyncAPIResource
@@ -495,6 +496,7 @@ def upload(
495496 external_id : Optional [str ] | Omit = omit ,
496497 overwrite : bool | Omit = omit ,
497498 experimental : file_create_params .Experimental | Omit = omit ,
499+ multipart_upload : bool | MultipartUploadOptions | None = None ,
498500 ** kwargs : Any ,
499501 ) -> StoreFile :
500502 """Upload a file to the `files` API and then attach it to the given store.
@@ -509,14 +511,19 @@ def upload(
509511 external_id: External identifier for this file in the store
510512 overwrite: If true, overwrite an existing file with the same external_id
511513 experimental: Configuration for a file.
514+ multipart_upload: Controls multipart upload behavior for the file upload.
515+ None (default) auto-detects based on file size.
516+ True forces multipart with default options.
517+ False disables multipart.
518+ MultipartUploadOptions for custom settings.
512519 extra_headers: Send extra headers
513520 extra_query: Add additional query parameters to the request
514521 extra_body: Add additional JSON properties to the request
515522 timeout: Override the client-level default timeout for this request, in seconds
516523 Returns:
517524 The file object once it reaches a terminal state
518525 """
519- file_obj = self ._client .files .create (file = file , ** kwargs )
526+ file_obj = self ._client .files .create (file = file , multipart_upload = multipart_upload , ** kwargs )
520527 return self .create (
521528 store_identifier = store_identifier ,
522529 file_id = file_obj .id ,
@@ -538,12 +545,13 @@ def upload_and_poll(
538545 external_id : Optional [str ] | Omit = omit ,
539546 overwrite : bool | Omit = omit ,
540547 experimental : file_create_params .Experimental | Omit = omit ,
548+ multipart_upload : bool | MultipartUploadOptions | None = None ,
541549 poll_interval_ms : int | NotGiven = not_given ,
542550 poll_timeout_ms : float | NotGiven = not_given ,
543551 ** kwargs : Any ,
544552 ) -> StoreFile :
545553 """Add a file to a store and poll until processing is complete.
546-
554+
547555 Args:
548556 store_identifier: The ID or name of the store
549557 file: The file to upload
@@ -552,12 +560,17 @@ def upload_and_poll(
552560 external_id: External identifier for this file in the store
553561 overwrite: If true, overwrite an existing file with the same external_id
554562 experimental: Configuration for a file.
563+ multipart_upload: Controls multipart upload behavior for the file upload.
564+ None (default) auto-detects based on file size.
565+ True forces multipart with default options.
566+ False disables multipart.
567+ MultipartUploadOptions for custom settings.
555568 poll_interval_ms: The interval between polls in milliseconds
556569 poll_timeout_ms: The maximum time to poll for in milliseconds
557570 Returns:
558571 The file object once it reaches a terminal state
559572 """
560- file_obj = self ._client .files .create (file = file , ** kwargs )
573+ file_obj = self ._client .files .create (file = file , multipart_upload = multipart_upload , ** kwargs )
561574 return self .create_and_poll (
562575 store_identifier = store_identifier ,
563576 file_id = file_obj .id ,
@@ -1038,6 +1051,7 @@ async def upload(
10381051 external_id : Optional [str ] | Omit = omit ,
10391052 overwrite : bool | Omit = omit ,
10401053 experimental : file_create_params .Experimental | Omit = omit ,
1054+ multipart_upload : bool | MultipartUploadOptions | None = None ,
10411055 ** kwargs : Any ,
10421056 ) -> StoreFile :
10431057 """Upload a file to the `files` API and then attach it to the given vector store.
@@ -1052,12 +1066,15 @@ async def upload(
10521066 external_id: External identifier for this file in the store
10531067 overwrite: If true, overwrite an existing file with the same external_id
10541068 experimental: Configuration for a file.
1055- poll_interval_ms: The interval between polls in milliseconds
1056- poll_timeout_ms: The maximum time to poll for in milliseconds
1069+ multipart_upload: Controls multipart upload behavior for the file upload.
1070+ None (default) auto-detects based on file size.
1071+ True forces multipart with default options.
1072+ False disables multipart.
1073+ MultipartUploadOptions for custom settings.
10571074 Returns:
10581075 The file object once it reaches a terminal state
10591076 """
1060- file_obj = await self ._client .files .create (file = file , ** kwargs )
1077+ file_obj = await self ._client .files .create (file = file , multipart_upload = multipart_upload , ** kwargs )
10611078 return await self .create (
10621079 store_identifier = store_identifier ,
10631080 file_id = file_obj .id ,
@@ -1079,12 +1096,13 @@ async def upload_and_poll(
10791096 external_id : Optional [str ] | Omit = omit ,
10801097 overwrite : bool | Omit = omit ,
10811098 experimental : file_create_params .Experimental | Omit = omit ,
1099+ multipart_upload : bool | MultipartUploadOptions | None = None ,
10821100 poll_interval_ms : int | NotGiven = not_given ,
10831101 poll_timeout_ms : float | NotGiven = not_given ,
10841102 ** kwargs : Any ,
10851103 ) -> StoreFile :
10861104 """Add a file to a store and poll until processing is complete.
1087-
1105+
10881106 Args:
10891107 store_identifier: The ID or name of the store
10901108 file: The file to upload
@@ -1093,12 +1111,17 @@ async def upload_and_poll(
10931111 external_id: External identifier for this file in the store
10941112 overwrite: If true, overwrite an existing file with the same external_id
10951113 experimental: Configuration for a file.
1114+ multipart_upload: Controls multipart upload behavior for the file upload.
1115+ None (default) auto-detects based on file size.
1116+ True forces multipart with default options.
1117+ False disables multipart.
1118+ MultipartUploadOptions for custom settings.
10961119 poll_interval_ms: The interval between polls in milliseconds
10971120 poll_timeout_ms: The maximum time to poll for in milliseconds
10981121 Returns:
10991122 The file object once it reaches a terminal state
11001123 """
1101- file_obj = await self ._client .files .create (file = file , ** kwargs )
1124+ file_obj = await self ._client .files .create (file = file , multipart_upload = multipart_upload , ** kwargs )
11021125 return await self .create_and_poll (
11031126 store_identifier = store_identifier ,
11041127 file_id = file_obj .id ,
0 commit comments