@@ -245,9 +245,10 @@ def create_and_poll(
245245 * ,
246246 vector_store_id : str ,
247247 poll_interval_ms : int | NotGiven = NOT_GIVEN ,
248+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
248249 ) -> VectorStoreFile :
249250 """Attach a file to the given vector store and wait for it to be processed."""
250- self .create (vector_store_id = vector_store_id , file_id = file_id )
251+ self .create (vector_store_id = vector_store_id , file_id = file_id , chunking_strategy = chunking_strategy )
251252
252253 return self .poll (
253254 file_id ,
@@ -301,27 +302,30 @@ def upload(
301302 * ,
302303 vector_store_id : str ,
303304 file : FileTypes ,
305+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
304306 ) -> VectorStoreFile :
305307 """Upload a file to the `files` API and then attach it to the given vector store.
306308
307309 Note the file will be asynchronously processed (you can use the alternative
308310 polling helper method to wait for processing to complete).
309311 """
310312 file_obj = self ._client .files .create (file = file , purpose = "assistants" )
311- return self .create (vector_store_id = vector_store_id , file_id = file_obj .id )
313+ return self .create (vector_store_id = vector_store_id , file_id = file_obj .id , chunking_strategy = chunking_strategy )
312314
313315 def upload_and_poll (
314316 self ,
315317 * ,
316318 vector_store_id : str ,
317319 file : FileTypes ,
318320 poll_interval_ms : int | NotGiven = NOT_GIVEN ,
321+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
319322 ) -> VectorStoreFile :
320323 """Add a file to a vector store and poll until processing is complete."""
321324 file_obj = self ._client .files .create (file = file , purpose = "assistants" )
322325 return self .create_and_poll (
323326 vector_store_id = vector_store_id ,
324327 file_id = file_obj .id ,
328+ chunking_strategy = chunking_strategy ,
325329 poll_interval_ms = poll_interval_ms ,
326330 )
327331
@@ -542,9 +546,10 @@ async def create_and_poll(
542546 * ,
543547 vector_store_id : str ,
544548 poll_interval_ms : int | NotGiven = NOT_GIVEN ,
549+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
545550 ) -> VectorStoreFile :
546551 """Attach a file to the given vector store and wait for it to be processed."""
547- await self .create (vector_store_id = vector_store_id , file_id = file_id )
552+ await self .create (vector_store_id = vector_store_id , file_id = file_id , chunking_strategy = chunking_strategy )
548553
549554 return await self .poll (
550555 file_id ,
@@ -598,28 +603,31 @@ async def upload(
598603 * ,
599604 vector_store_id : str ,
600605 file : FileTypes ,
606+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
601607 ) -> VectorStoreFile :
602608 """Upload a file to the `files` API and then attach it to the given vector store.
603609
604610 Note the file will be asynchronously processed (you can use the alternative
605611 polling helper method to wait for processing to complete).
606612 """
607613 file_obj = await self ._client .files .create (file = file , purpose = "assistants" )
608- return await self .create (vector_store_id = vector_store_id , file_id = file_obj .id )
614+ return await self .create (vector_store_id = vector_store_id , file_id = file_obj .id , chunking_strategy = chunking_strategy )
609615
610616 async def upload_and_poll (
611617 self ,
612618 * ,
613619 vector_store_id : str ,
614620 file : FileTypes ,
615621 poll_interval_ms : int | NotGiven = NOT_GIVEN ,
622+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
616623 ) -> VectorStoreFile :
617624 """Add a file to a vector store and poll until processing is complete."""
618625 file_obj = await self ._client .files .create (file = file , purpose = "assistants" )
619626 return await self .create_and_poll (
620627 vector_store_id = vector_store_id ,
621628 file_id = file_obj .id ,
622629 poll_interval_ms = poll_interval_ms ,
630+ chunking_strategy = chunking_strategy
623631 )
624632
625633
0 commit comments