llama-cloud 0.1.8__py3-none-any.whl → 0.1.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of llama-cloud might be problematic. Click here for more details.
- llama_cloud/__init__.py +4 -16
- llama_cloud/client.py +0 -3
- llama_cloud/resources/__init__.py +0 -5
- llama_cloud/resources/files/client.py +34 -6
- llama_cloud/resources/llama_extract/client.py +126 -424
- llama_cloud/resources/parsing/client.py +82 -18
- llama_cloud/types/__init__.py +4 -10
- llama_cloud/types/extract_job.py +3 -1
- llama_cloud/types/extract_resultset.py +2 -6
- llama_cloud/types/extract_run.py +5 -0
- llama_cloud/types/extract_run_data_value.py +5 -0
- llama_cloud/types/{extraction_schema_data_schema_value.py → extract_run_extraction_metadata_value.py} +1 -1
- llama_cloud/types/extract_state.py +4 -4
- llama_cloud/types/llama_parse_parameters.py +3 -0
- {llama_cloud-0.1.8.dist-info → llama_cloud-0.1.9.dist-info}/METADATA +2 -1
- {llama_cloud-0.1.8.dist-info → llama_cloud-0.1.9.dist-info}/RECORD +18 -26
- {llama_cloud-0.1.8.dist-info → llama_cloud-0.1.9.dist-info}/WHEEL +1 -1
- llama_cloud/resources/extraction/__init__.py +0 -5
- llama_cloud/resources/extraction/client.py +0 -756
- llama_cloud/resources/extraction/types/__init__.py +0 -6
- llama_cloud/resources/extraction/types/extraction_schema_create_data_schema_value.py +0 -7
- llama_cloud/resources/extraction/types/extraction_schema_update_data_schema_value.py +0 -7
- llama_cloud/types/extraction_job.py +0 -35
- llama_cloud/types/extraction_result.py +0 -44
- llama_cloud/types/extraction_result_data_value.py +0 -5
- llama_cloud/types/extraction_schema.py +0 -41
- {llama_cloud-0.1.8.dist-info → llama_cloud-0.1.9.dist-info}/LICENSE +0 -0
|
@@ -103,8 +103,8 @@ class ParsingClient:
|
|
|
103
103
|
def upload_file(
|
|
104
104
|
self,
|
|
105
105
|
*,
|
|
106
|
-
project_id: typing.Optional[str] = None,
|
|
107
106
|
organization_id: typing.Optional[str] = None,
|
|
107
|
+
project_id: typing.Optional[str] = None,
|
|
108
108
|
file: typing.Optional[str] = OMIT,
|
|
109
109
|
annotate_links: bool,
|
|
110
110
|
auto_mode: bool,
|
|
@@ -137,6 +137,7 @@ class ParsingClient:
|
|
|
137
137
|
html_remove_navigation_elements: bool,
|
|
138
138
|
http_proxy: str,
|
|
139
139
|
input_s_3_path: str,
|
|
140
|
+
input_s_3_region: str,
|
|
140
141
|
input_url: str,
|
|
141
142
|
invalidate_cache: bool,
|
|
142
143
|
is_formatting_instruction: bool,
|
|
@@ -145,12 +146,14 @@ class ParsingClient:
|
|
|
145
146
|
max_pages: typing.Optional[int] = OMIT,
|
|
146
147
|
output_pdf_of_document: bool,
|
|
147
148
|
output_s_3_path_prefix: str,
|
|
149
|
+
output_s_3_region: str,
|
|
148
150
|
page_prefix: str,
|
|
149
151
|
page_separator: str,
|
|
150
152
|
page_suffix: str,
|
|
151
153
|
parsing_instruction: str,
|
|
152
154
|
premium_mode: bool,
|
|
153
155
|
skip_diagonal_text: bool,
|
|
156
|
+
spreadsheet_extract_sub_tables: bool,
|
|
154
157
|
structured_output: bool,
|
|
155
158
|
structured_output_json_schema: str,
|
|
156
159
|
structured_output_json_schema_name: str,
|
|
@@ -168,10 +171,10 @@ class ParsingClient:
|
|
|
168
171
|
Upload a file to s3 and create a job. return a job id
|
|
169
172
|
|
|
170
173
|
Parameters:
|
|
171
|
-
- project_id: typing.Optional[str].
|
|
172
|
-
|
|
173
174
|
- organization_id: typing.Optional[str].
|
|
174
175
|
|
|
176
|
+
- project_id: typing.Optional[str].
|
|
177
|
+
|
|
175
178
|
- file: typing.Optional[str].
|
|
176
179
|
|
|
177
180
|
- annotate_links: bool.
|
|
@@ -236,6 +239,8 @@ class ParsingClient:
|
|
|
236
239
|
|
|
237
240
|
- input_s_3_path: str.
|
|
238
241
|
|
|
242
|
+
- input_s_3_region: str.
|
|
243
|
+
|
|
239
244
|
- input_url: str.
|
|
240
245
|
|
|
241
246
|
- invalidate_cache: bool.
|
|
@@ -252,6 +257,8 @@ class ParsingClient:
|
|
|
252
257
|
|
|
253
258
|
- output_s_3_path_prefix: str.
|
|
254
259
|
|
|
260
|
+
- output_s_3_region: str.
|
|
261
|
+
|
|
255
262
|
- page_prefix: str.
|
|
256
263
|
|
|
257
264
|
- page_separator: str.
|
|
@@ -264,6 +271,8 @@ class ParsingClient:
|
|
|
264
271
|
|
|
265
272
|
- skip_diagonal_text: bool.
|
|
266
273
|
|
|
274
|
+
- spreadsheet_extract_sub_tables: bool.
|
|
275
|
+
|
|
267
276
|
- structured_output: bool.
|
|
268
277
|
|
|
269
278
|
- structured_output_json_schema: str.
|
|
@@ -320,6 +329,7 @@ class ParsingClient:
|
|
|
320
329
|
"html_remove_navigation_elements": html_remove_navigation_elements,
|
|
321
330
|
"http_proxy": http_proxy,
|
|
322
331
|
"input_s3_path": input_s_3_path,
|
|
332
|
+
"input_s3_region": input_s_3_region,
|
|
323
333
|
"input_url": input_url,
|
|
324
334
|
"invalidate_cache": invalidate_cache,
|
|
325
335
|
"is_formatting_instruction": is_formatting_instruction,
|
|
@@ -327,12 +337,14 @@ class ParsingClient:
|
|
|
327
337
|
"extract_layout": extract_layout,
|
|
328
338
|
"output_pdf_of_document": output_pdf_of_document,
|
|
329
339
|
"output_s3_path_prefix": output_s_3_path_prefix,
|
|
340
|
+
"output_s3_region": output_s_3_region,
|
|
330
341
|
"page_prefix": page_prefix,
|
|
331
342
|
"page_separator": page_separator,
|
|
332
343
|
"page_suffix": page_suffix,
|
|
333
344
|
"parsing_instruction": parsing_instruction,
|
|
334
345
|
"premium_mode": premium_mode,
|
|
335
346
|
"skip_diagonal_text": skip_diagonal_text,
|
|
347
|
+
"spreadsheet_extract_sub_tables": spreadsheet_extract_sub_tables,
|
|
336
348
|
"structured_output": structured_output,
|
|
337
349
|
"structured_output_json_schema": structured_output_json_schema,
|
|
338
350
|
"structured_output_json_schema_name": structured_output_json_schema_name,
|
|
@@ -353,7 +365,7 @@ class ParsingClient:
|
|
|
353
365
|
_response = self._client_wrapper.httpx_client.request(
|
|
354
366
|
"POST",
|
|
355
367
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/parsing/upload"),
|
|
356
|
-
params=remove_none_from_dict({"
|
|
368
|
+
params=remove_none_from_dict({"organization_id": organization_id, "project_id": project_id}),
|
|
357
369
|
json=jsonable_encoder(_request),
|
|
358
370
|
headers=self._client_wrapper.get_headers(),
|
|
359
371
|
timeout=60,
|
|
@@ -368,11 +380,13 @@ class ParsingClient:
|
|
|
368
380
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
369
381
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
370
382
|
|
|
371
|
-
def usage(self) -> ParsingUsage:
|
|
383
|
+
def usage(self, *, organization_id: typing.Optional[str] = None) -> ParsingUsage:
|
|
372
384
|
"""
|
|
373
385
|
DEPRECATED: use either /organizations/{organization_id}/usage or /projects/{project_id}/usage instead
|
|
374
386
|
Get parsing usage for user
|
|
375
387
|
|
|
388
|
+
Parameters:
|
|
389
|
+
- organization_id: typing.Optional[str].
|
|
376
390
|
---
|
|
377
391
|
from llama_cloud.client import LlamaCloud
|
|
378
392
|
|
|
@@ -384,6 +398,7 @@ class ParsingClient:
|
|
|
384
398
|
_response = self._client_wrapper.httpx_client.request(
|
|
385
399
|
"GET",
|
|
386
400
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/parsing/usage"),
|
|
401
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
387
402
|
headers=self._client_wrapper.get_headers(),
|
|
388
403
|
timeout=60,
|
|
389
404
|
)
|
|
@@ -461,12 +476,14 @@ class ParsingClient:
|
|
|
461
476
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
462
477
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
463
478
|
|
|
464
|
-
def get_job_text_result(self, job_id: str) -> ParsingJobTextResult:
|
|
479
|
+
def get_job_text_result(self, job_id: str, *, organization_id: typing.Optional[str] = None) -> ParsingJobTextResult:
|
|
465
480
|
"""
|
|
466
481
|
Get a job by id
|
|
467
482
|
|
|
468
483
|
Parameters:
|
|
469
484
|
- job_id: str.
|
|
485
|
+
|
|
486
|
+
- organization_id: typing.Optional[str].
|
|
470
487
|
---
|
|
471
488
|
from llama_cloud.client import LlamaCloud
|
|
472
489
|
|
|
@@ -480,6 +497,7 @@ class ParsingClient:
|
|
|
480
497
|
_response = self._client_wrapper.httpx_client.request(
|
|
481
498
|
"GET",
|
|
482
499
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/text"),
|
|
500
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
483
501
|
headers=self._client_wrapper.get_headers(),
|
|
484
502
|
timeout=60,
|
|
485
503
|
)
|
|
@@ -527,12 +545,16 @@ class ParsingClient:
|
|
|
527
545
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
528
546
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
529
547
|
|
|
530
|
-
def get_job_structured_result(
|
|
548
|
+
def get_job_structured_result(
|
|
549
|
+
self, job_id: str, *, organization_id: typing.Optional[str] = None
|
|
550
|
+
) -> ParsingJobStructuredResult:
|
|
531
551
|
"""
|
|
532
552
|
Get a job by id
|
|
533
553
|
|
|
534
554
|
Parameters:
|
|
535
555
|
- job_id: str.
|
|
556
|
+
|
|
557
|
+
- organization_id: typing.Optional[str].
|
|
536
558
|
---
|
|
537
559
|
from llama_cloud.client import LlamaCloud
|
|
538
560
|
|
|
@@ -548,6 +570,7 @@ class ParsingClient:
|
|
|
548
570
|
urllib.parse.urljoin(
|
|
549
571
|
f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/structured"
|
|
550
572
|
),
|
|
573
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
551
574
|
headers=self._client_wrapper.get_headers(),
|
|
552
575
|
timeout=60,
|
|
553
576
|
)
|
|
@@ -629,12 +652,14 @@ class ParsingClient:
|
|
|
629
652
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
630
653
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
631
654
|
|
|
632
|
-
def get_job_result(self, job_id: str) -> ParsingJobMarkdownResult:
|
|
655
|
+
def get_job_result(self, job_id: str, *, organization_id: typing.Optional[str] = None) -> ParsingJobMarkdownResult:
|
|
633
656
|
"""
|
|
634
657
|
Get a job by id
|
|
635
658
|
|
|
636
659
|
Parameters:
|
|
637
660
|
- job_id: str.
|
|
661
|
+
|
|
662
|
+
- organization_id: typing.Optional[str].
|
|
638
663
|
---
|
|
639
664
|
from llama_cloud.client import LlamaCloud
|
|
640
665
|
|
|
@@ -650,6 +675,7 @@ class ParsingClient:
|
|
|
650
675
|
urllib.parse.urljoin(
|
|
651
676
|
f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/markdown"
|
|
652
677
|
),
|
|
678
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
653
679
|
headers=self._client_wrapper.get_headers(),
|
|
654
680
|
timeout=60,
|
|
655
681
|
)
|
|
@@ -697,12 +723,14 @@ class ParsingClient:
|
|
|
697
723
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
698
724
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
699
725
|
|
|
700
|
-
def get_job_json_result(self, job_id: str) -> ParsingJobJsonResult:
|
|
726
|
+
def get_job_json_result(self, job_id: str, *, organization_id: typing.Optional[str] = None) -> ParsingJobJsonResult:
|
|
701
727
|
"""
|
|
702
728
|
Get a job by id
|
|
703
729
|
|
|
704
730
|
Parameters:
|
|
705
731
|
- job_id: str.
|
|
732
|
+
|
|
733
|
+
- organization_id: typing.Optional[str].
|
|
706
734
|
---
|
|
707
735
|
from llama_cloud.client import LlamaCloud
|
|
708
736
|
|
|
@@ -716,6 +744,7 @@ class ParsingClient:
|
|
|
716
744
|
_response = self._client_wrapper.httpx_client.request(
|
|
717
745
|
"GET",
|
|
718
746
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/json"),
|
|
747
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
719
748
|
headers=self._client_wrapper.get_headers(),
|
|
720
749
|
timeout=60,
|
|
721
750
|
)
|
|
@@ -899,8 +928,8 @@ class AsyncParsingClient:
|
|
|
899
928
|
async def upload_file(
|
|
900
929
|
self,
|
|
901
930
|
*,
|
|
902
|
-
project_id: typing.Optional[str] = None,
|
|
903
931
|
organization_id: typing.Optional[str] = None,
|
|
932
|
+
project_id: typing.Optional[str] = None,
|
|
904
933
|
file: typing.Optional[str] = OMIT,
|
|
905
934
|
annotate_links: bool,
|
|
906
935
|
auto_mode: bool,
|
|
@@ -933,6 +962,7 @@ class AsyncParsingClient:
|
|
|
933
962
|
html_remove_navigation_elements: bool,
|
|
934
963
|
http_proxy: str,
|
|
935
964
|
input_s_3_path: str,
|
|
965
|
+
input_s_3_region: str,
|
|
936
966
|
input_url: str,
|
|
937
967
|
invalidate_cache: bool,
|
|
938
968
|
is_formatting_instruction: bool,
|
|
@@ -941,12 +971,14 @@ class AsyncParsingClient:
|
|
|
941
971
|
max_pages: typing.Optional[int] = OMIT,
|
|
942
972
|
output_pdf_of_document: bool,
|
|
943
973
|
output_s_3_path_prefix: str,
|
|
974
|
+
output_s_3_region: str,
|
|
944
975
|
page_prefix: str,
|
|
945
976
|
page_separator: str,
|
|
946
977
|
page_suffix: str,
|
|
947
978
|
parsing_instruction: str,
|
|
948
979
|
premium_mode: bool,
|
|
949
980
|
skip_diagonal_text: bool,
|
|
981
|
+
spreadsheet_extract_sub_tables: bool,
|
|
950
982
|
structured_output: bool,
|
|
951
983
|
structured_output_json_schema: str,
|
|
952
984
|
structured_output_json_schema_name: str,
|
|
@@ -964,10 +996,10 @@ class AsyncParsingClient:
|
|
|
964
996
|
Upload a file to s3 and create a job. return a job id
|
|
965
997
|
|
|
966
998
|
Parameters:
|
|
967
|
-
- project_id: typing.Optional[str].
|
|
968
|
-
|
|
969
999
|
- organization_id: typing.Optional[str].
|
|
970
1000
|
|
|
1001
|
+
- project_id: typing.Optional[str].
|
|
1002
|
+
|
|
971
1003
|
- file: typing.Optional[str].
|
|
972
1004
|
|
|
973
1005
|
- annotate_links: bool.
|
|
@@ -1032,6 +1064,8 @@ class AsyncParsingClient:
|
|
|
1032
1064
|
|
|
1033
1065
|
- input_s_3_path: str.
|
|
1034
1066
|
|
|
1067
|
+
- input_s_3_region: str.
|
|
1068
|
+
|
|
1035
1069
|
- input_url: str.
|
|
1036
1070
|
|
|
1037
1071
|
- invalidate_cache: bool.
|
|
@@ -1048,6 +1082,8 @@ class AsyncParsingClient:
|
|
|
1048
1082
|
|
|
1049
1083
|
- output_s_3_path_prefix: str.
|
|
1050
1084
|
|
|
1085
|
+
- output_s_3_region: str.
|
|
1086
|
+
|
|
1051
1087
|
- page_prefix: str.
|
|
1052
1088
|
|
|
1053
1089
|
- page_separator: str.
|
|
@@ -1060,6 +1096,8 @@ class AsyncParsingClient:
|
|
|
1060
1096
|
|
|
1061
1097
|
- skip_diagonal_text: bool.
|
|
1062
1098
|
|
|
1099
|
+
- spreadsheet_extract_sub_tables: bool.
|
|
1100
|
+
|
|
1063
1101
|
- structured_output: bool.
|
|
1064
1102
|
|
|
1065
1103
|
- structured_output_json_schema: str.
|
|
@@ -1116,6 +1154,7 @@ class AsyncParsingClient:
|
|
|
1116
1154
|
"html_remove_navigation_elements": html_remove_navigation_elements,
|
|
1117
1155
|
"http_proxy": http_proxy,
|
|
1118
1156
|
"input_s3_path": input_s_3_path,
|
|
1157
|
+
"input_s3_region": input_s_3_region,
|
|
1119
1158
|
"input_url": input_url,
|
|
1120
1159
|
"invalidate_cache": invalidate_cache,
|
|
1121
1160
|
"is_formatting_instruction": is_formatting_instruction,
|
|
@@ -1123,12 +1162,14 @@ class AsyncParsingClient:
|
|
|
1123
1162
|
"extract_layout": extract_layout,
|
|
1124
1163
|
"output_pdf_of_document": output_pdf_of_document,
|
|
1125
1164
|
"output_s3_path_prefix": output_s_3_path_prefix,
|
|
1165
|
+
"output_s3_region": output_s_3_region,
|
|
1126
1166
|
"page_prefix": page_prefix,
|
|
1127
1167
|
"page_separator": page_separator,
|
|
1128
1168
|
"page_suffix": page_suffix,
|
|
1129
1169
|
"parsing_instruction": parsing_instruction,
|
|
1130
1170
|
"premium_mode": premium_mode,
|
|
1131
1171
|
"skip_diagonal_text": skip_diagonal_text,
|
|
1172
|
+
"spreadsheet_extract_sub_tables": spreadsheet_extract_sub_tables,
|
|
1132
1173
|
"structured_output": structured_output,
|
|
1133
1174
|
"structured_output_json_schema": structured_output_json_schema,
|
|
1134
1175
|
"structured_output_json_schema_name": structured_output_json_schema_name,
|
|
@@ -1149,7 +1190,7 @@ class AsyncParsingClient:
|
|
|
1149
1190
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1150
1191
|
"POST",
|
|
1151
1192
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/parsing/upload"),
|
|
1152
|
-
params=remove_none_from_dict({"
|
|
1193
|
+
params=remove_none_from_dict({"organization_id": organization_id, "project_id": project_id}),
|
|
1153
1194
|
json=jsonable_encoder(_request),
|
|
1154
1195
|
headers=self._client_wrapper.get_headers(),
|
|
1155
1196
|
timeout=60,
|
|
@@ -1164,11 +1205,13 @@ class AsyncParsingClient:
|
|
|
1164
1205
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1165
1206
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1166
1207
|
|
|
1167
|
-
async def usage(self) -> ParsingUsage:
|
|
1208
|
+
async def usage(self, *, organization_id: typing.Optional[str] = None) -> ParsingUsage:
|
|
1168
1209
|
"""
|
|
1169
1210
|
DEPRECATED: use either /organizations/{organization_id}/usage or /projects/{project_id}/usage instead
|
|
1170
1211
|
Get parsing usage for user
|
|
1171
1212
|
|
|
1213
|
+
Parameters:
|
|
1214
|
+
- organization_id: typing.Optional[str].
|
|
1172
1215
|
---
|
|
1173
1216
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1174
1217
|
|
|
@@ -1180,6 +1223,7 @@ class AsyncParsingClient:
|
|
|
1180
1223
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1181
1224
|
"GET",
|
|
1182
1225
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/parsing/usage"),
|
|
1226
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
1183
1227
|
headers=self._client_wrapper.get_headers(),
|
|
1184
1228
|
timeout=60,
|
|
1185
1229
|
)
|
|
@@ -1257,12 +1301,16 @@ class AsyncParsingClient:
|
|
|
1257
1301
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1258
1302
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1259
1303
|
|
|
1260
|
-
async def get_job_text_result(
|
|
1304
|
+
async def get_job_text_result(
|
|
1305
|
+
self, job_id: str, *, organization_id: typing.Optional[str] = None
|
|
1306
|
+
) -> ParsingJobTextResult:
|
|
1261
1307
|
"""
|
|
1262
1308
|
Get a job by id
|
|
1263
1309
|
|
|
1264
1310
|
Parameters:
|
|
1265
1311
|
- job_id: str.
|
|
1312
|
+
|
|
1313
|
+
- organization_id: typing.Optional[str].
|
|
1266
1314
|
---
|
|
1267
1315
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1268
1316
|
|
|
@@ -1276,6 +1324,7 @@ class AsyncParsingClient:
|
|
|
1276
1324
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1277
1325
|
"GET",
|
|
1278
1326
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/text"),
|
|
1327
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
1279
1328
|
headers=self._client_wrapper.get_headers(),
|
|
1280
1329
|
timeout=60,
|
|
1281
1330
|
)
|
|
@@ -1323,12 +1372,16 @@ class AsyncParsingClient:
|
|
|
1323
1372
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1324
1373
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1325
1374
|
|
|
1326
|
-
async def get_job_structured_result(
|
|
1375
|
+
async def get_job_structured_result(
|
|
1376
|
+
self, job_id: str, *, organization_id: typing.Optional[str] = None
|
|
1377
|
+
) -> ParsingJobStructuredResult:
|
|
1327
1378
|
"""
|
|
1328
1379
|
Get a job by id
|
|
1329
1380
|
|
|
1330
1381
|
Parameters:
|
|
1331
1382
|
- job_id: str.
|
|
1383
|
+
|
|
1384
|
+
- organization_id: typing.Optional[str].
|
|
1332
1385
|
---
|
|
1333
1386
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1334
1387
|
|
|
@@ -1344,6 +1397,7 @@ class AsyncParsingClient:
|
|
|
1344
1397
|
urllib.parse.urljoin(
|
|
1345
1398
|
f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/structured"
|
|
1346
1399
|
),
|
|
1400
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
1347
1401
|
headers=self._client_wrapper.get_headers(),
|
|
1348
1402
|
timeout=60,
|
|
1349
1403
|
)
|
|
@@ -1425,12 +1479,16 @@ class AsyncParsingClient:
|
|
|
1425
1479
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1426
1480
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1427
1481
|
|
|
1428
|
-
async def get_job_result(
|
|
1482
|
+
async def get_job_result(
|
|
1483
|
+
self, job_id: str, *, organization_id: typing.Optional[str] = None
|
|
1484
|
+
) -> ParsingJobMarkdownResult:
|
|
1429
1485
|
"""
|
|
1430
1486
|
Get a job by id
|
|
1431
1487
|
|
|
1432
1488
|
Parameters:
|
|
1433
1489
|
- job_id: str.
|
|
1490
|
+
|
|
1491
|
+
- organization_id: typing.Optional[str].
|
|
1434
1492
|
---
|
|
1435
1493
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1436
1494
|
|
|
@@ -1446,6 +1504,7 @@ class AsyncParsingClient:
|
|
|
1446
1504
|
urllib.parse.urljoin(
|
|
1447
1505
|
f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/markdown"
|
|
1448
1506
|
),
|
|
1507
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
1449
1508
|
headers=self._client_wrapper.get_headers(),
|
|
1450
1509
|
timeout=60,
|
|
1451
1510
|
)
|
|
@@ -1493,12 +1552,16 @@ class AsyncParsingClient:
|
|
|
1493
1552
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1494
1553
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1495
1554
|
|
|
1496
|
-
async def get_job_json_result(
|
|
1555
|
+
async def get_job_json_result(
|
|
1556
|
+
self, job_id: str, *, organization_id: typing.Optional[str] = None
|
|
1557
|
+
) -> ParsingJobJsonResult:
|
|
1497
1558
|
"""
|
|
1498
1559
|
Get a job by id
|
|
1499
1560
|
|
|
1500
1561
|
Parameters:
|
|
1501
1562
|
- job_id: str.
|
|
1563
|
+
|
|
1564
|
+
- organization_id: typing.Optional[str].
|
|
1502
1565
|
---
|
|
1503
1566
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1504
1567
|
|
|
@@ -1512,6 +1575,7 @@ class AsyncParsingClient:
|
|
|
1512
1575
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1513
1576
|
"GET",
|
|
1514
1577
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/parsing/job/{job_id}/result/json"),
|
|
1578
|
+
params=remove_none_from_dict({"organization_id": organization_id}),
|
|
1515
1579
|
headers=self._client_wrapper.get_headers(),
|
|
1516
1580
|
timeout=60,
|
|
1517
1581
|
)
|
llama_cloud/types/__init__.py
CHANGED
|
@@ -119,12 +119,9 @@ from .extract_resultset_data_zero_value import ExtractResultsetDataZeroValue
|
|
|
119
119
|
from .extract_resultset_extraction_metadata_value import ExtractResultsetExtractionMetadataValue
|
|
120
120
|
from .extract_run import ExtractRun
|
|
121
121
|
from .extract_run_data_schema_value import ExtractRunDataSchemaValue
|
|
122
|
+
from .extract_run_data_value import ExtractRunDataValue
|
|
123
|
+
from .extract_run_extraction_metadata_value import ExtractRunExtractionMetadataValue
|
|
122
124
|
from .extract_state import ExtractState
|
|
123
|
-
from .extraction_job import ExtractionJob
|
|
124
|
-
from .extraction_result import ExtractionResult
|
|
125
|
-
from .extraction_result_data_value import ExtractionResultDataValue
|
|
126
|
-
from .extraction_schema import ExtractionSchema
|
|
127
|
-
from .extraction_schema_data_schema_value import ExtractionSchemaDataSchemaValue
|
|
128
125
|
from .file import File
|
|
129
126
|
from .file_permission_info_value import FilePermissionInfoValue
|
|
130
127
|
from .file_resource_info_value import FileResourceInfoValue
|
|
@@ -418,12 +415,9 @@ __all__ = [
|
|
|
418
415
|
"ExtractResultsetExtractionMetadataValue",
|
|
419
416
|
"ExtractRun",
|
|
420
417
|
"ExtractRunDataSchemaValue",
|
|
418
|
+
"ExtractRunDataValue",
|
|
419
|
+
"ExtractRunExtractionMetadataValue",
|
|
421
420
|
"ExtractState",
|
|
422
|
-
"ExtractionJob",
|
|
423
|
-
"ExtractionResult",
|
|
424
|
-
"ExtractionResultDataValue",
|
|
425
|
-
"ExtractionSchema",
|
|
426
|
-
"ExtractionSchemaDataSchemaValue",
|
|
427
421
|
"File",
|
|
428
422
|
"FilePermissionInfoValue",
|
|
429
423
|
"FileResourceInfoValue",
|
llama_cloud/types/extract_job.py
CHANGED
|
@@ -4,6 +4,7 @@ import datetime as dt
|
|
|
4
4
|
import typing
|
|
5
5
|
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
|
7
|
+
from .extract_agent import ExtractAgent
|
|
7
8
|
from .file import File
|
|
8
9
|
from .status_enum import StatusEnum
|
|
9
10
|
|
|
@@ -18,8 +19,9 @@ except ImportError:
|
|
|
18
19
|
|
|
19
20
|
class ExtractJob(pydantic.BaseModel):
|
|
20
21
|
id: str = pydantic.Field(description="The id of the extraction job")
|
|
21
|
-
|
|
22
|
+
extraction_agent: ExtractAgent = pydantic.Field(description="The agent that the job was run on.")
|
|
22
23
|
status: StatusEnum = pydantic.Field(description="The status of the extraction job")
|
|
24
|
+
error: typing.Optional[str]
|
|
23
25
|
file: File = pydantic.Field(description="The file that the extract was extracted from")
|
|
24
26
|
|
|
25
27
|
def json(self, **kwargs: typing.Any) -> str:
|
|
@@ -6,7 +6,6 @@ import typing
|
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
|
7
7
|
from .extract_resultset_data import ExtractResultsetData
|
|
8
8
|
from .extract_resultset_extraction_metadata_value import ExtractResultsetExtractionMetadataValue
|
|
9
|
-
from .extract_run import ExtractRun
|
|
10
9
|
|
|
11
10
|
try:
|
|
12
11
|
import pydantic
|
|
@@ -19,18 +18,15 @@ except ImportError:
|
|
|
19
18
|
|
|
20
19
|
class ExtractResultset(pydantic.BaseModel):
|
|
21
20
|
"""
|
|
22
|
-
Schema for an extraction
|
|
21
|
+
Schema for an extraction resultset.
|
|
23
22
|
"""
|
|
24
23
|
|
|
25
|
-
|
|
26
|
-
created_at: typing.Optional[dt.datetime]
|
|
27
|
-
updated_at: typing.Optional[dt.datetime]
|
|
24
|
+
run_id: str = pydantic.Field(description="The id of the extraction run")
|
|
28
25
|
extraction_agent_id: str = pydantic.Field(description="The id of the extraction agent")
|
|
29
26
|
data: typing.Optional[ExtractResultsetData] = pydantic.Field(description="The data extracted from the file")
|
|
30
27
|
extraction_metadata: typing.Dict[str, typing.Optional[ExtractResultsetExtractionMetadataValue]] = pydantic.Field(
|
|
31
28
|
description="The metadata extracted from the file"
|
|
32
29
|
)
|
|
33
|
-
extraction_run: ExtractRun = pydantic.Field(description="The extraction run that produced the resultset.")
|
|
34
30
|
|
|
35
31
|
def json(self, **kwargs: typing.Any) -> str:
|
|
36
32
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
llama_cloud/types/extract_run.py
CHANGED
|
@@ -6,6 +6,8 @@ import typing
|
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
|
7
7
|
from .extract_config import ExtractConfig
|
|
8
8
|
from .extract_run_data_schema_value import ExtractRunDataSchemaValue
|
|
9
|
+
from .extract_run_data_value import ExtractRunDataValue
|
|
10
|
+
from .extract_run_extraction_metadata_value import ExtractRunExtractionMetadataValue
|
|
9
11
|
from .extract_state import ExtractState
|
|
10
12
|
from .file import File
|
|
11
13
|
|
|
@@ -34,6 +36,9 @@ class ExtractRun(pydantic.BaseModel):
|
|
|
34
36
|
file: File = pydantic.Field(description="The file that the extract was extracted from")
|
|
35
37
|
status: ExtractState = pydantic.Field(description="The status of the extraction run")
|
|
36
38
|
error: typing.Optional[str]
|
|
39
|
+
job_id: typing.Optional[str]
|
|
40
|
+
data: typing.Optional[typing.Dict[str, typing.Optional[ExtractRunDataValue]]]
|
|
41
|
+
extraction_metadata: typing.Optional[typing.Dict[str, typing.Optional[ExtractRunExtractionMetadataValue]]]
|
|
37
42
|
|
|
38
43
|
def json(self, **kwargs: typing.Any) -> str:
|
|
39
44
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
@@ -8,21 +8,21 @@ T_Result = typing.TypeVar("T_Result")
|
|
|
8
8
|
|
|
9
9
|
class ExtractState(str, enum.Enum):
|
|
10
10
|
CREATED = "CREATED"
|
|
11
|
-
|
|
11
|
+
PENDING = "PENDING"
|
|
12
12
|
SUCCESS = "SUCCESS"
|
|
13
13
|
ERROR = "ERROR"
|
|
14
14
|
|
|
15
15
|
def visit(
|
|
16
16
|
self,
|
|
17
17
|
created: typing.Callable[[], T_Result],
|
|
18
|
-
|
|
18
|
+
pending: typing.Callable[[], T_Result],
|
|
19
19
|
success: typing.Callable[[], T_Result],
|
|
20
20
|
error: typing.Callable[[], T_Result],
|
|
21
21
|
) -> T_Result:
|
|
22
22
|
if self is ExtractState.CREATED:
|
|
23
23
|
return created()
|
|
24
|
-
if self is ExtractState.
|
|
25
|
-
return
|
|
24
|
+
if self is ExtractState.PENDING:
|
|
25
|
+
return pending()
|
|
26
26
|
if self is ExtractState.SUCCESS:
|
|
27
27
|
return success()
|
|
28
28
|
if self is ExtractState.ERROR:
|
|
@@ -57,7 +57,9 @@ class LlamaParseParameters(pydantic.BaseModel):
|
|
|
57
57
|
premium_mode: typing.Optional[bool]
|
|
58
58
|
continuous_mode: typing.Optional[bool]
|
|
59
59
|
s_3_input_path: typing.Optional[str] = pydantic.Field(alias="s3_input_path")
|
|
60
|
+
input_s_3_region: typing.Optional[str] = pydantic.Field(alias="input_s3_region")
|
|
60
61
|
s_3_output_path_prefix: typing.Optional[str] = pydantic.Field(alias="s3_output_path_prefix")
|
|
62
|
+
output_s_3_region: typing.Optional[str] = pydantic.Field(alias="output_s3_region")
|
|
61
63
|
project_id: typing.Optional[str]
|
|
62
64
|
azure_openai_deployment_name: typing.Optional[str]
|
|
63
65
|
azure_openai_endpoint: typing.Optional[str]
|
|
@@ -79,6 +81,7 @@ class LlamaParseParameters(pydantic.BaseModel):
|
|
|
79
81
|
formatting_instruction: typing.Optional[str]
|
|
80
82
|
complemental_formatting_instruction: typing.Optional[str]
|
|
81
83
|
content_guideline_instruction: typing.Optional[str]
|
|
84
|
+
spreadsheet_extract_sub_tables: typing.Optional[bool]
|
|
82
85
|
|
|
83
86
|
def json(self, **kwargs: typing.Any) -> str:
|
|
84
87
|
kwargs_with_defaults: typing.Any = {"by_alias": True, "exclude_unset": True, **kwargs}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: llama-cloud
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary:
|
|
5
5
|
License: MIT
|
|
6
6
|
Author: Logan Markewich
|
|
@@ -13,6 +13,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.10
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
17
|
Requires-Dist: certifi (>=2024.7.4,<2025.0.0)
|
|
17
18
|
Requires-Dist: httpx (>=0.20.0)
|
|
18
19
|
Requires-Dist: pydantic (>=1.10)
|