@@ -245,9 +245,10 @@ def create_and_poll(
245
245
* ,
246
246
vector_store_id : str ,
247
247
poll_interval_ms : int | NotGiven = NOT_GIVEN ,
248
+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
248
249
) -> VectorStoreFile :
249
250
"""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 )
251
252
252
253
return self .poll (
253
254
file_id ,
@@ -301,27 +302,30 @@ def upload(
301
302
* ,
302
303
vector_store_id : str ,
303
304
file : FileTypes ,
305
+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
304
306
) -> VectorStoreFile :
305
307
"""Upload a file to the `files` API and then attach it to the given vector store.
306
308
307
309
Note the file will be asynchronously processed (you can use the alternative
308
310
polling helper method to wait for processing to complete).
309
311
"""
310
312
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 )
312
314
313
315
def upload_and_poll (
314
316
self ,
315
317
* ,
316
318
vector_store_id : str ,
317
319
file : FileTypes ,
318
320
poll_interval_ms : int | NotGiven = NOT_GIVEN ,
321
+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
319
322
) -> VectorStoreFile :
320
323
"""Add a file to a vector store and poll until processing is complete."""
321
324
file_obj = self ._client .files .create (file = file , purpose = "assistants" )
322
325
return self .create_and_poll (
323
326
vector_store_id = vector_store_id ,
324
327
file_id = file_obj .id ,
328
+ chunking_strategy = chunking_strategy ,
325
329
poll_interval_ms = poll_interval_ms ,
326
330
)
327
331
@@ -542,9 +546,10 @@ async def create_and_poll(
542
546
* ,
543
547
vector_store_id : str ,
544
548
poll_interval_ms : int | NotGiven = NOT_GIVEN ,
549
+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
545
550
) -> VectorStoreFile :
546
551
"""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 )
548
553
549
554
return await self .poll (
550
555
file_id ,
@@ -598,28 +603,31 @@ async def upload(
598
603
* ,
599
604
vector_store_id : str ,
600
605
file : FileTypes ,
606
+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
601
607
) -> VectorStoreFile :
602
608
"""Upload a file to the `files` API and then attach it to the given vector store.
603
609
604
610
Note the file will be asynchronously processed (you can use the alternative
605
611
polling helper method to wait for processing to complete).
606
612
"""
607
613
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 )
609
615
610
616
async def upload_and_poll (
611
617
self ,
612
618
* ,
613
619
vector_store_id : str ,
614
620
file : FileTypes ,
615
621
poll_interval_ms : int | NotGiven = NOT_GIVEN ,
622
+ chunking_strategy : file_create_params .ChunkingStrategy | NotGiven = NOT_GIVEN ,
616
623
) -> VectorStoreFile :
617
624
"""Add a file to a vector store and poll until processing is complete."""
618
625
file_obj = await self ._client .files .create (file = file , purpose = "assistants" )
619
626
return await self .create_and_poll (
620
627
vector_store_id = vector_store_id ,
621
628
file_id = file_obj .id ,
622
629
poll_interval_ms = poll_interval_ms ,
630
+ chunking_strategy = chunking_strategy
623
631
)
624
632
625
633
0 commit comments