@@ -99,7 +99,7 @@ The `hi_res` strategy supports different models, and the default is `layout_v1.1
9999 import os
100100
101101 from unstructured_client import UnstructuredClient
102- from unstructured_client.models import shared
102+ from unstructured_client.models import operations, shared
103103 from unstructured_client.models.errors import SDKError
104104
105105 client = UnstructuredClient(
@@ -109,21 +109,23 @@ The `hi_res` strategy supports different models, and the default is `layout_v1.1
109109
110110 filename = " sample-docs/layout-parser-paper.pdf"
111111 file = open (filename, " rb" )
112- req = shared.PartitionParameters(
113- # Note that this currently only supports a single file
114- files = shared.Files(
115- content = file .read(),
116- file_name = filename,
117- ),
118- strategy = shared.Strategy.HI_RES ,
119- hi_res_model_name = " layout_v1.1.0" ,
120- split_pdf_page = True ,
121- split_pdf_allow_failed = True ,
122- split_pdf_concurrency_level = 15
112+ req = operations.PartitionRequest(
113+ partition_parameters = shared.PartitionParameters(
114+ # Note that this currently only supports a single file.
115+ files = shared.Files(
116+ content = file .read(),
117+ file_name = filename,
118+ ),
119+ strategy = shared.Strategy.HI_RES ,
120+ hi_res_model_name = " layout_v1.1.0" ,
121+ split_pdf_page = True ,
122+ split_pdf_allow_failed = True ,
123+ split_pdf_concurrency_level = 15
124+ )
123125 )
124126
125127 try :
126- res = client.general.partition(req)
128+ res = client.general.partition(request = req)
127129 print (res.elements[0 ])
128130 except SDKError as e:
129131 print (e)
@@ -248,7 +250,7 @@ For better OCR results, you can specify what languages your document is in using
248250 import os
249251
250252 from unstructured_client import UnstructuredClient
251- from unstructured_client.models import shared
253+ from unstructured_client.models import operations, shared
252254 from unstructured_client.models.errors import SDKError
253255
254256 client = UnstructuredClient(
@@ -258,21 +260,23 @@ For better OCR results, you can specify what languages your document is in using
258260
259261 filename = " sample-docs/korean.png"
260262 file = open (filename, " rb" )
261- req = shared.PartitionParameters(
262- # Note that this currently only supports a single file
263- files = shared.Files(
264- content = file .read(),
265- file_name = filename,
266- ),
267- strategy = shared.Strategy.OCR_ONLY ,
268- languages = [" kor" ],
269- split_pdf_page = True ,
270- split_pdf_allow_failed = True ,
271- split_pdf_concurrency_level = 15
272- )
263+ req = operations.PartitionRequest(
264+ partition_parameters = shared.PartitionParameters(
265+ # Note that this currently only supports a single file.
266+ files = shared.Files(
267+ content = file .read(),
268+ file_name = filename,
269+ ),
270+ strategy = shared.Strategy.OCR_ONLY ,
271+ languages = [" kor" ],
272+ split_pdf_page = True ,
273+ split_pdf_allow_failed = True ,
274+ split_pdf_concurrency_level = 15
275+ )
276+ )
273277
274278 try :
275- res = client.general.partition(req)
279+ res = client.general.partition(request = req)
276280 print (res.elements[0 ])
277281 except SDKError as e:
278282 print (e)
@@ -394,7 +398,7 @@ Set the `coordinates` parameter to `true` to add this field to the elements in t
394398 import os
395399
396400 from unstructured_client import UnstructuredClient
397- from unstructured_client.models import shared
401+ from unstructured_client.models import operations, shared
398402 from unstructured_client.models.errors import SDKError
399403
400404 client = UnstructuredClient(
@@ -404,21 +408,23 @@ Set the `coordinates` parameter to `true` to add this field to the elements in t
404408
405409 filename = " sample-docs/layout-parser-paper.pdf"
406410 file = open (filename, " rb" )
407- req = shared.PartitionParameters(
408- # Note that this currently only supports a single file
409- files = shared.Files(
410- content = file .read(),
411- file_name = filename,
412- ),
413- strategy = shared.Strategy.HI_RES ,
414- coordinates = True ,
415- split_pdf_page = True ,
416- split_pdf_allow_failed = True ,
417- split_pdf_concurrency_level = 15
411+ req = operations.PartitionRequest(
412+ partition_parameters = shared.PartitionParameters(
413+ # Note that this currently only supports a single file.
414+ files = shared.Files(
415+ content = file .read(),
416+ file_name = filename,
417+ ),
418+ strategy = shared.Strategy.HI_RES ,
419+ coordinates = True ,
420+ split_pdf_page = True ,
421+ split_pdf_allow_failed = True ,
422+ split_pdf_concurrency_level = 15
423+ )
418424 )
419425
420426 try :
421- res = client.general.partition(req)
427+ res = client.general.partition(request = req)
422428 print (res.elements[0 ])
423429 except SDKError as e:
424430 print (e)
@@ -543,7 +549,7 @@ This can be helpful if you'd like to use the IDs as a primary key in a database,
543549 import os
544550
545551 from unstructured_client import UnstructuredClient
546- from unstructured_client.models import shared
552+ from unstructured_client.models import operations, shared
547553 from unstructured_client.models.errors import SDKError
548554
549555 client = UnstructuredClient(
@@ -553,21 +559,23 @@ This can be helpful if you'd like to use the IDs as a primary key in a database,
553559
554560 filename = " sample-docs/layout-parser-paper-fast.pdf"
555561 file = open (filename, " rb" )
556- req = shared.PartitionParameters(
557- # Note that this currently only supports a single file
558- files = shared.Files(
559- content = file .read(),
560- file_name = filename,
561- ),
562- unique_element_ids = True ,
563- strategy = shared.Strategy.HI_RES ,
564- split_pdf_page = True ,
565- split_pdf_allow_failed = True ,
566- split_pdf_concurrency_level = 15
562+ req = operations.PartitionRequest(
563+ partition_parameters = shared.PartitionParameters(
564+ # Note that this currently only supports a single file.
565+ files = shared.Files(
566+ content = file .read(),
567+ file_name = filename,
568+ ),
569+ unique_element_ids = True ,
570+ strategy = shared.Strategy.HI_RES ,
571+ split_pdf_page = True ,
572+ split_pdf_allow_failed = True ,
573+ split_pdf_concurrency_level = 15
574+ )
567575 )
568576
569577 try :
570- res = client.general.partition(req)
578+ res = client.general.partition(request = req)
571579 print (res.elements[0 ])
572580 except SDKError as e:
573581 print (e)
@@ -698,7 +706,7 @@ By default, the `chunking_strategy` is set to `None`, and no chunking is perform
698706 import os
699707
700708 from unstructured_client import UnstructuredClient
701- from unstructured_client.models import shared
709+ from unstructured_client.models import operations, shared
702710 from unstructured_client.models.errors import SDKError
703711
704712 client = UnstructuredClient(
@@ -708,22 +716,24 @@ By default, the `chunking_strategy` is set to `None`, and no chunking is perform
708716
709717 filename = " sample-docs/layout-parser-paper-fast.pdf"
710718 file = open (filename, " rb" )
711- req = shared.PartitionParameters(
712- # Note that this currently only supports a single file
713- files = shared.Files(
714- content = file .read(),
715- file_name = filename,
716- ),
717- chunking_strategy = " by_title" ,
718- max_characters = 1024 ,
719- strategy = shared.Strategy.HI_RES ,
720- split_pdf_page = True ,
721- split_pdf_allow_failed = True ,
722- split_pdf_concurrency_level = 15
719+ req = operations.PartitionRequest(
720+ partition_parameters = shared.PartitionParameters(
721+ # Note that this currently only supports a single file.
722+ files = shared.Files(
723+ content = file .read(),
724+ file_name = filename,
725+ ),
726+ chunking_strategy = " by_title" ,
727+ max_characters = 1024 ,
728+ strategy = shared.Strategy.HI_RES ,
729+ split_pdf_page = True ,
730+ split_pdf_allow_failed = True ,
731+ split_pdf_concurrency_level = 15
732+ )
723733 )
724734
725735 try :
726- res = client.general.partition(req)
736+ res = client.general.partition(request = req)
727737 print (res.elements[0 ])
728738 except SDKError as e:
729739 print (e)
0 commit comments