llama-cloud 0.1.7a1__py3-none-any.whl → 0.1.8__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 +12 -0
- llama_cloud/resources/chat_apps/client.py +10 -0
- llama_cloud/resources/files/client.py +271 -0
- llama_cloud/resources/llama_extract/client.py +398 -0
- llama_cloud/resources/parsing/client.py +24 -0
- llama_cloud/resources/reports/client.py +4 -4
- llama_cloud/types/__init__.py +12 -0
- llama_cloud/types/composite_retrieval_result.py +2 -2
- llama_cloud/types/composite_retrieved_text_node_with_score.py +34 -0
- llama_cloud/types/extract_job.py +1 -0
- llama_cloud/types/extract_resultset.py +2 -2
- llama_cloud/types/extract_run.py +49 -0
- llama_cloud/types/extract_run_data_schema_value.py +5 -0
- llama_cloud/types/extract_state.py +29 -0
- llama_cloud/types/llama_extract_settings.py +45 -0
- llama_cloud/types/llama_parse_parameters.py +3 -0
- llama_cloud/types/page_figure_metadata.py +36 -0
- llama_cloud/types/report_metadata.py +4 -0
- {llama_cloud-0.1.7a1.dist-info → llama_cloud-0.1.8.dist-info}/METADATA +1 -1
- {llama_cloud-0.1.7a1.dist-info → llama_cloud-0.1.8.dist-info}/RECORD +22 -16
- {llama_cloud-0.1.7a1.dist-info → llama_cloud-0.1.8.dist-info}/LICENSE +0 -0
- {llama_cloud-0.1.7a1.dist-info → llama_cloud-0.1.8.dist-info}/WHEEL +0 -0
|
@@ -14,7 +14,9 @@ from ...types.extract_config import ExtractConfig
|
|
|
14
14
|
from ...types.extract_job import ExtractJob
|
|
15
15
|
from ...types.extract_job_create import ExtractJobCreate
|
|
16
16
|
from ...types.extract_resultset import ExtractResultset
|
|
17
|
+
from ...types.extract_run import ExtractRun
|
|
17
18
|
from ...types.http_validation_error import HttpValidationError
|
|
19
|
+
from ...types.llama_extract_settings import LlamaExtractSettings
|
|
18
20
|
from .types.extract_agent_create_data_schema_value import ExtractAgentCreateDataSchemaValue
|
|
19
21
|
from .types.extract_agent_update_data_schema_value import ExtractAgentUpdateDataSchemaValue
|
|
20
22
|
|
|
@@ -122,6 +124,45 @@ class LlamaExtractClient:
|
|
|
122
124
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
123
125
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
124
126
|
|
|
127
|
+
def get_extraction_agent_by_name(
|
|
128
|
+
self, *, name: str, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
129
|
+
) -> ExtractAgent:
|
|
130
|
+
"""
|
|
131
|
+
Parameters:
|
|
132
|
+
- name: str.
|
|
133
|
+
|
|
134
|
+
- project_id: typing.Optional[str].
|
|
135
|
+
|
|
136
|
+
- organization_id: typing.Optional[str].
|
|
137
|
+
---
|
|
138
|
+
from llama_cloud.client import LlamaCloud
|
|
139
|
+
|
|
140
|
+
client = LlamaCloud(
|
|
141
|
+
token="YOUR_TOKEN",
|
|
142
|
+
)
|
|
143
|
+
client.llama_extract.get_extraction_agent_by_name(
|
|
144
|
+
name="string",
|
|
145
|
+
)
|
|
146
|
+
"""
|
|
147
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
148
|
+
"GET",
|
|
149
|
+
urllib.parse.urljoin(
|
|
150
|
+
f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/extraction_agents/by_name"
|
|
151
|
+
),
|
|
152
|
+
params=remove_none_from_dict({"name": name, "project_id": project_id, "organization_id": organization_id}),
|
|
153
|
+
headers=self._client_wrapper.get_headers(),
|
|
154
|
+
timeout=60,
|
|
155
|
+
)
|
|
156
|
+
if 200 <= _response.status_code < 300:
|
|
157
|
+
return pydantic.parse_obj_as(ExtractAgent, _response.json()) # type: ignore
|
|
158
|
+
if _response.status_code == 422:
|
|
159
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
160
|
+
try:
|
|
161
|
+
_response_json = _response.json()
|
|
162
|
+
except JSONDecodeError:
|
|
163
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
164
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
165
|
+
|
|
125
166
|
def get_extraction_agent(
|
|
126
167
|
self,
|
|
127
168
|
extraction_agent_id: str,
|
|
@@ -399,6 +440,67 @@ class LlamaExtractClient:
|
|
|
399
440
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
400
441
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
401
442
|
|
|
443
|
+
def run_job_with_parsed_file_test(
|
|
444
|
+
self,
|
|
445
|
+
*,
|
|
446
|
+
project_id: typing.Optional[str] = None,
|
|
447
|
+
organization_id: typing.Optional[str] = None,
|
|
448
|
+
job_create: ExtractJobCreate,
|
|
449
|
+
extract_settings: typing.Optional[LlamaExtractSettings] = OMIT,
|
|
450
|
+
) -> typing.Optional[ExtractResultset]:
|
|
451
|
+
"""
|
|
452
|
+
Parameters:
|
|
453
|
+
- project_id: typing.Optional[str].
|
|
454
|
+
|
|
455
|
+
- organization_id: typing.Optional[str].
|
|
456
|
+
|
|
457
|
+
- job_create: ExtractJobCreate.
|
|
458
|
+
|
|
459
|
+
- extract_settings: typing.Optional[LlamaExtractSettings].
|
|
460
|
+
---
|
|
461
|
+
from llama_cloud import (
|
|
462
|
+
ExtractConfig,
|
|
463
|
+
ExtractJobCreate,
|
|
464
|
+
ExtractMode,
|
|
465
|
+
LlamaExtractSettings,
|
|
466
|
+
)
|
|
467
|
+
from llama_cloud.client import LlamaCloud
|
|
468
|
+
|
|
469
|
+
client = LlamaCloud(
|
|
470
|
+
token="YOUR_TOKEN",
|
|
471
|
+
)
|
|
472
|
+
client.llama_extract.run_job_with_parsed_file_test(
|
|
473
|
+
job_create=ExtractJobCreate(
|
|
474
|
+
extraction_agent_id="string",
|
|
475
|
+
file_id="string",
|
|
476
|
+
config_override=ExtractConfig(
|
|
477
|
+
extraction_mode=ExtractMode.PER_DOC,
|
|
478
|
+
),
|
|
479
|
+
),
|
|
480
|
+
extract_settings=LlamaExtractSettings(),
|
|
481
|
+
)
|
|
482
|
+
"""
|
|
483
|
+
_request: typing.Dict[str, typing.Any] = {"job_create": job_create}
|
|
484
|
+
if extract_settings is not OMIT:
|
|
485
|
+
_request["extract_settings"] = extract_settings
|
|
486
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
487
|
+
"POST",
|
|
488
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/jobs/parsed/test"),
|
|
489
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
490
|
+
json=jsonable_encoder(_request),
|
|
491
|
+
headers=self._client_wrapper.get_headers(),
|
|
492
|
+
timeout=60,
|
|
493
|
+
)
|
|
494
|
+
if 200 <= _response.status_code < 300:
|
|
495
|
+
return pydantic.parse_obj_as(typing.Optional[ExtractResultset], _response.json()) # type: ignore
|
|
496
|
+
if _response.status_code == 422:
|
|
497
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
498
|
+
try:
|
|
499
|
+
_response_json = _response.json()
|
|
500
|
+
except JSONDecodeError:
|
|
501
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
502
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
503
|
+
|
|
402
504
|
def run_job_with_parsed_file(
|
|
403
505
|
self,
|
|
404
506
|
*,
|
|
@@ -448,6 +550,67 @@ class LlamaExtractClient:
|
|
|
448
550
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
449
551
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
450
552
|
|
|
553
|
+
def run_job_test_user(
|
|
554
|
+
self,
|
|
555
|
+
*,
|
|
556
|
+
project_id: typing.Optional[str] = None,
|
|
557
|
+
organization_id: typing.Optional[str] = None,
|
|
558
|
+
job_create: ExtractJobCreate,
|
|
559
|
+
extract_settings: typing.Optional[LlamaExtractSettings] = OMIT,
|
|
560
|
+
) -> ExtractJob:
|
|
561
|
+
"""
|
|
562
|
+
Parameters:
|
|
563
|
+
- project_id: typing.Optional[str].
|
|
564
|
+
|
|
565
|
+
- organization_id: typing.Optional[str].
|
|
566
|
+
|
|
567
|
+
- job_create: ExtractJobCreate.
|
|
568
|
+
|
|
569
|
+
- extract_settings: typing.Optional[LlamaExtractSettings].
|
|
570
|
+
---
|
|
571
|
+
from llama_cloud import (
|
|
572
|
+
ExtractConfig,
|
|
573
|
+
ExtractJobCreate,
|
|
574
|
+
ExtractMode,
|
|
575
|
+
LlamaExtractSettings,
|
|
576
|
+
)
|
|
577
|
+
from llama_cloud.client import LlamaCloud
|
|
578
|
+
|
|
579
|
+
client = LlamaCloud(
|
|
580
|
+
token="YOUR_TOKEN",
|
|
581
|
+
)
|
|
582
|
+
client.llama_extract.run_job_test_user(
|
|
583
|
+
job_create=ExtractJobCreate(
|
|
584
|
+
extraction_agent_id="string",
|
|
585
|
+
file_id="string",
|
|
586
|
+
config_override=ExtractConfig(
|
|
587
|
+
extraction_mode=ExtractMode.PER_DOC,
|
|
588
|
+
),
|
|
589
|
+
),
|
|
590
|
+
extract_settings=LlamaExtractSettings(),
|
|
591
|
+
)
|
|
592
|
+
"""
|
|
593
|
+
_request: typing.Dict[str, typing.Any] = {"job_create": job_create}
|
|
594
|
+
if extract_settings is not OMIT:
|
|
595
|
+
_request["extract_settings"] = extract_settings
|
|
596
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
597
|
+
"POST",
|
|
598
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/jobs/test"),
|
|
599
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
600
|
+
json=jsonable_encoder(_request),
|
|
601
|
+
headers=self._client_wrapper.get_headers(),
|
|
602
|
+
timeout=60,
|
|
603
|
+
)
|
|
604
|
+
if 200 <= _response.status_code < 300:
|
|
605
|
+
return pydantic.parse_obj_as(ExtractJob, _response.json()) # type: ignore
|
|
606
|
+
if _response.status_code == 422:
|
|
607
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
608
|
+
try:
|
|
609
|
+
_response_json = _response.json()
|
|
610
|
+
except JSONDecodeError:
|
|
611
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
612
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
613
|
+
|
|
451
614
|
def run_jobs_in_batch(
|
|
452
615
|
self,
|
|
453
616
|
*,
|
|
@@ -533,6 +696,43 @@ class LlamaExtractClient:
|
|
|
533
696
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
534
697
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
535
698
|
|
|
699
|
+
def get_extract_run_api_v_1_extractionv_2_runs_run_id_get(
|
|
700
|
+
self, run_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
701
|
+
) -> ExtractRun:
|
|
702
|
+
"""
|
|
703
|
+
Parameters:
|
|
704
|
+
- run_id: str.
|
|
705
|
+
|
|
706
|
+
- project_id: typing.Optional[str].
|
|
707
|
+
|
|
708
|
+
- organization_id: typing.Optional[str].
|
|
709
|
+
---
|
|
710
|
+
from llama_cloud.client import LlamaCloud
|
|
711
|
+
|
|
712
|
+
client = LlamaCloud(
|
|
713
|
+
token="YOUR_TOKEN",
|
|
714
|
+
)
|
|
715
|
+
client.llama_extract.get_extract_run_api_v_1_extractionv_2_runs_run_id_get(
|
|
716
|
+
run_id="string",
|
|
717
|
+
)
|
|
718
|
+
"""
|
|
719
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
720
|
+
"GET",
|
|
721
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/runs/{run_id}"),
|
|
722
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
723
|
+
headers=self._client_wrapper.get_headers(),
|
|
724
|
+
timeout=60,
|
|
725
|
+
)
|
|
726
|
+
if 200 <= _response.status_code < 300:
|
|
727
|
+
return pydantic.parse_obj_as(ExtractRun, _response.json()) # type: ignore
|
|
728
|
+
if _response.status_code == 422:
|
|
729
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
730
|
+
try:
|
|
731
|
+
_response_json = _response.json()
|
|
732
|
+
except JSONDecodeError:
|
|
733
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
734
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
735
|
+
|
|
536
736
|
|
|
537
737
|
class AsyncLlamaExtractClient:
|
|
538
738
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -626,6 +826,45 @@ class AsyncLlamaExtractClient:
|
|
|
626
826
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
627
827
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
628
828
|
|
|
829
|
+
async def get_extraction_agent_by_name(
|
|
830
|
+
self, *, name: str, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
831
|
+
) -> ExtractAgent:
|
|
832
|
+
"""
|
|
833
|
+
Parameters:
|
|
834
|
+
- name: str.
|
|
835
|
+
|
|
836
|
+
- project_id: typing.Optional[str].
|
|
837
|
+
|
|
838
|
+
- organization_id: typing.Optional[str].
|
|
839
|
+
---
|
|
840
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
841
|
+
|
|
842
|
+
client = AsyncLlamaCloud(
|
|
843
|
+
token="YOUR_TOKEN",
|
|
844
|
+
)
|
|
845
|
+
await client.llama_extract.get_extraction_agent_by_name(
|
|
846
|
+
name="string",
|
|
847
|
+
)
|
|
848
|
+
"""
|
|
849
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
850
|
+
"GET",
|
|
851
|
+
urllib.parse.urljoin(
|
|
852
|
+
f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/extraction_agents/by_name"
|
|
853
|
+
),
|
|
854
|
+
params=remove_none_from_dict({"name": name, "project_id": project_id, "organization_id": organization_id}),
|
|
855
|
+
headers=self._client_wrapper.get_headers(),
|
|
856
|
+
timeout=60,
|
|
857
|
+
)
|
|
858
|
+
if 200 <= _response.status_code < 300:
|
|
859
|
+
return pydantic.parse_obj_as(ExtractAgent, _response.json()) # type: ignore
|
|
860
|
+
if _response.status_code == 422:
|
|
861
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
862
|
+
try:
|
|
863
|
+
_response_json = _response.json()
|
|
864
|
+
except JSONDecodeError:
|
|
865
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
866
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
867
|
+
|
|
629
868
|
async def get_extraction_agent(
|
|
630
869
|
self,
|
|
631
870
|
extraction_agent_id: str,
|
|
@@ -903,6 +1142,67 @@ class AsyncLlamaExtractClient:
|
|
|
903
1142
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
904
1143
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
905
1144
|
|
|
1145
|
+
async def run_job_with_parsed_file_test(
|
|
1146
|
+
self,
|
|
1147
|
+
*,
|
|
1148
|
+
project_id: typing.Optional[str] = None,
|
|
1149
|
+
organization_id: typing.Optional[str] = None,
|
|
1150
|
+
job_create: ExtractJobCreate,
|
|
1151
|
+
extract_settings: typing.Optional[LlamaExtractSettings] = OMIT,
|
|
1152
|
+
) -> typing.Optional[ExtractResultset]:
|
|
1153
|
+
"""
|
|
1154
|
+
Parameters:
|
|
1155
|
+
- project_id: typing.Optional[str].
|
|
1156
|
+
|
|
1157
|
+
- organization_id: typing.Optional[str].
|
|
1158
|
+
|
|
1159
|
+
- job_create: ExtractJobCreate.
|
|
1160
|
+
|
|
1161
|
+
- extract_settings: typing.Optional[LlamaExtractSettings].
|
|
1162
|
+
---
|
|
1163
|
+
from llama_cloud import (
|
|
1164
|
+
ExtractConfig,
|
|
1165
|
+
ExtractJobCreate,
|
|
1166
|
+
ExtractMode,
|
|
1167
|
+
LlamaExtractSettings,
|
|
1168
|
+
)
|
|
1169
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1170
|
+
|
|
1171
|
+
client = AsyncLlamaCloud(
|
|
1172
|
+
token="YOUR_TOKEN",
|
|
1173
|
+
)
|
|
1174
|
+
await client.llama_extract.run_job_with_parsed_file_test(
|
|
1175
|
+
job_create=ExtractJobCreate(
|
|
1176
|
+
extraction_agent_id="string",
|
|
1177
|
+
file_id="string",
|
|
1178
|
+
config_override=ExtractConfig(
|
|
1179
|
+
extraction_mode=ExtractMode.PER_DOC,
|
|
1180
|
+
),
|
|
1181
|
+
),
|
|
1182
|
+
extract_settings=LlamaExtractSettings(),
|
|
1183
|
+
)
|
|
1184
|
+
"""
|
|
1185
|
+
_request: typing.Dict[str, typing.Any] = {"job_create": job_create}
|
|
1186
|
+
if extract_settings is not OMIT:
|
|
1187
|
+
_request["extract_settings"] = extract_settings
|
|
1188
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1189
|
+
"POST",
|
|
1190
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/jobs/parsed/test"),
|
|
1191
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1192
|
+
json=jsonable_encoder(_request),
|
|
1193
|
+
headers=self._client_wrapper.get_headers(),
|
|
1194
|
+
timeout=60,
|
|
1195
|
+
)
|
|
1196
|
+
if 200 <= _response.status_code < 300:
|
|
1197
|
+
return pydantic.parse_obj_as(typing.Optional[ExtractResultset], _response.json()) # type: ignore
|
|
1198
|
+
if _response.status_code == 422:
|
|
1199
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1200
|
+
try:
|
|
1201
|
+
_response_json = _response.json()
|
|
1202
|
+
except JSONDecodeError:
|
|
1203
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1204
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1205
|
+
|
|
906
1206
|
async def run_job_with_parsed_file(
|
|
907
1207
|
self,
|
|
908
1208
|
*,
|
|
@@ -952,6 +1252,67 @@ class AsyncLlamaExtractClient:
|
|
|
952
1252
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
953
1253
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
954
1254
|
|
|
1255
|
+
async def run_job_test_user(
|
|
1256
|
+
self,
|
|
1257
|
+
*,
|
|
1258
|
+
project_id: typing.Optional[str] = None,
|
|
1259
|
+
organization_id: typing.Optional[str] = None,
|
|
1260
|
+
job_create: ExtractJobCreate,
|
|
1261
|
+
extract_settings: typing.Optional[LlamaExtractSettings] = OMIT,
|
|
1262
|
+
) -> ExtractJob:
|
|
1263
|
+
"""
|
|
1264
|
+
Parameters:
|
|
1265
|
+
- project_id: typing.Optional[str].
|
|
1266
|
+
|
|
1267
|
+
- organization_id: typing.Optional[str].
|
|
1268
|
+
|
|
1269
|
+
- job_create: ExtractJobCreate.
|
|
1270
|
+
|
|
1271
|
+
- extract_settings: typing.Optional[LlamaExtractSettings].
|
|
1272
|
+
---
|
|
1273
|
+
from llama_cloud import (
|
|
1274
|
+
ExtractConfig,
|
|
1275
|
+
ExtractJobCreate,
|
|
1276
|
+
ExtractMode,
|
|
1277
|
+
LlamaExtractSettings,
|
|
1278
|
+
)
|
|
1279
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1280
|
+
|
|
1281
|
+
client = AsyncLlamaCloud(
|
|
1282
|
+
token="YOUR_TOKEN",
|
|
1283
|
+
)
|
|
1284
|
+
await client.llama_extract.run_job_test_user(
|
|
1285
|
+
job_create=ExtractJobCreate(
|
|
1286
|
+
extraction_agent_id="string",
|
|
1287
|
+
file_id="string",
|
|
1288
|
+
config_override=ExtractConfig(
|
|
1289
|
+
extraction_mode=ExtractMode.PER_DOC,
|
|
1290
|
+
),
|
|
1291
|
+
),
|
|
1292
|
+
extract_settings=LlamaExtractSettings(),
|
|
1293
|
+
)
|
|
1294
|
+
"""
|
|
1295
|
+
_request: typing.Dict[str, typing.Any] = {"job_create": job_create}
|
|
1296
|
+
if extract_settings is not OMIT:
|
|
1297
|
+
_request["extract_settings"] = extract_settings
|
|
1298
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1299
|
+
"POST",
|
|
1300
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/jobs/test"),
|
|
1301
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1302
|
+
json=jsonable_encoder(_request),
|
|
1303
|
+
headers=self._client_wrapper.get_headers(),
|
|
1304
|
+
timeout=60,
|
|
1305
|
+
)
|
|
1306
|
+
if 200 <= _response.status_code < 300:
|
|
1307
|
+
return pydantic.parse_obj_as(ExtractJob, _response.json()) # type: ignore
|
|
1308
|
+
if _response.status_code == 422:
|
|
1309
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1310
|
+
try:
|
|
1311
|
+
_response_json = _response.json()
|
|
1312
|
+
except JSONDecodeError:
|
|
1313
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1314
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1315
|
+
|
|
955
1316
|
async def run_jobs_in_batch(
|
|
956
1317
|
self,
|
|
957
1318
|
*,
|
|
@@ -1036,3 +1397,40 @@ class AsyncLlamaExtractClient:
|
|
|
1036
1397
|
except JSONDecodeError:
|
|
1037
1398
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1038
1399
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1400
|
+
|
|
1401
|
+
async def get_extract_run_api_v_1_extractionv_2_runs_run_id_get(
|
|
1402
|
+
self, run_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
1403
|
+
) -> ExtractRun:
|
|
1404
|
+
"""
|
|
1405
|
+
Parameters:
|
|
1406
|
+
- run_id: str.
|
|
1407
|
+
|
|
1408
|
+
- project_id: typing.Optional[str].
|
|
1409
|
+
|
|
1410
|
+
- organization_id: typing.Optional[str].
|
|
1411
|
+
---
|
|
1412
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1413
|
+
|
|
1414
|
+
client = AsyncLlamaCloud(
|
|
1415
|
+
token="YOUR_TOKEN",
|
|
1416
|
+
)
|
|
1417
|
+
await client.llama_extract.get_extract_run_api_v_1_extractionv_2_runs_run_id_get(
|
|
1418
|
+
run_id="string",
|
|
1419
|
+
)
|
|
1420
|
+
"""
|
|
1421
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1422
|
+
"GET",
|
|
1423
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/runs/{run_id}"),
|
|
1424
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1425
|
+
headers=self._client_wrapper.get_headers(),
|
|
1426
|
+
timeout=60,
|
|
1427
|
+
)
|
|
1428
|
+
if 200 <= _response.status_code < 300:
|
|
1429
|
+
return pydantic.parse_obj_as(ExtractRun, _response.json()) # type: ignore
|
|
1430
|
+
if _response.status_code == 422:
|
|
1431
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1432
|
+
try:
|
|
1433
|
+
_response_json = _response.json()
|
|
1434
|
+
except JSONDecodeError:
|
|
1435
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1436
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -120,6 +120,8 @@ class ParsingClient:
|
|
|
120
120
|
bbox_left: float,
|
|
121
121
|
bbox_right: float,
|
|
122
122
|
bbox_top: float,
|
|
123
|
+
complemental_formatting_instruction: str,
|
|
124
|
+
content_guideline_instruction: str,
|
|
123
125
|
continuous_mode: bool,
|
|
124
126
|
disable_ocr: bool,
|
|
125
127
|
disable_reconstruction: bool,
|
|
@@ -128,6 +130,7 @@ class ParsingClient:
|
|
|
128
130
|
do_not_unroll_columns: bool,
|
|
129
131
|
extract_charts: bool,
|
|
130
132
|
fast_mode: bool,
|
|
133
|
+
formatting_instruction: str,
|
|
131
134
|
guess_xlsx_sheet_name: bool,
|
|
132
135
|
html_make_all_elements_visible: bool,
|
|
133
136
|
html_remove_fixed_elements: bool,
|
|
@@ -199,6 +202,10 @@ class ParsingClient:
|
|
|
199
202
|
|
|
200
203
|
- bbox_top: float.
|
|
201
204
|
|
|
205
|
+
- complemental_formatting_instruction: str.
|
|
206
|
+
|
|
207
|
+
- content_guideline_instruction: str.
|
|
208
|
+
|
|
202
209
|
- continuous_mode: bool.
|
|
203
210
|
|
|
204
211
|
- disable_ocr: bool.
|
|
@@ -215,6 +222,8 @@ class ParsingClient:
|
|
|
215
222
|
|
|
216
223
|
- fast_mode: bool.
|
|
217
224
|
|
|
225
|
+
- formatting_instruction: str.
|
|
226
|
+
|
|
218
227
|
- guess_xlsx_sheet_name: bool.
|
|
219
228
|
|
|
220
229
|
- html_make_all_elements_visible: bool.
|
|
@@ -294,6 +303,8 @@ class ParsingClient:
|
|
|
294
303
|
"bbox_left": bbox_left,
|
|
295
304
|
"bbox_right": bbox_right,
|
|
296
305
|
"bbox_top": bbox_top,
|
|
306
|
+
"complemental_formatting_instruction": complemental_formatting_instruction,
|
|
307
|
+
"content_guideline_instruction": content_guideline_instruction,
|
|
297
308
|
"continuous_mode": continuous_mode,
|
|
298
309
|
"disable_ocr": disable_ocr,
|
|
299
310
|
"disable_reconstruction": disable_reconstruction,
|
|
@@ -302,6 +313,7 @@ class ParsingClient:
|
|
|
302
313
|
"do_not_unroll_columns": do_not_unroll_columns,
|
|
303
314
|
"extract_charts": extract_charts,
|
|
304
315
|
"fast_mode": fast_mode,
|
|
316
|
+
"formatting_instruction": formatting_instruction,
|
|
305
317
|
"guess_xlsx_sheet_name": guess_xlsx_sheet_name,
|
|
306
318
|
"html_make_all_elements_visible": html_make_all_elements_visible,
|
|
307
319
|
"html_remove_fixed_elements": html_remove_fixed_elements,
|
|
@@ -904,6 +916,8 @@ class AsyncParsingClient:
|
|
|
904
916
|
bbox_left: float,
|
|
905
917
|
bbox_right: float,
|
|
906
918
|
bbox_top: float,
|
|
919
|
+
complemental_formatting_instruction: str,
|
|
920
|
+
content_guideline_instruction: str,
|
|
907
921
|
continuous_mode: bool,
|
|
908
922
|
disable_ocr: bool,
|
|
909
923
|
disable_reconstruction: bool,
|
|
@@ -912,6 +926,7 @@ class AsyncParsingClient:
|
|
|
912
926
|
do_not_unroll_columns: bool,
|
|
913
927
|
extract_charts: bool,
|
|
914
928
|
fast_mode: bool,
|
|
929
|
+
formatting_instruction: str,
|
|
915
930
|
guess_xlsx_sheet_name: bool,
|
|
916
931
|
html_make_all_elements_visible: bool,
|
|
917
932
|
html_remove_fixed_elements: bool,
|
|
@@ -983,6 +998,10 @@ class AsyncParsingClient:
|
|
|
983
998
|
|
|
984
999
|
- bbox_top: float.
|
|
985
1000
|
|
|
1001
|
+
- complemental_formatting_instruction: str.
|
|
1002
|
+
|
|
1003
|
+
- content_guideline_instruction: str.
|
|
1004
|
+
|
|
986
1005
|
- continuous_mode: bool.
|
|
987
1006
|
|
|
988
1007
|
- disable_ocr: bool.
|
|
@@ -999,6 +1018,8 @@ class AsyncParsingClient:
|
|
|
999
1018
|
|
|
1000
1019
|
- fast_mode: bool.
|
|
1001
1020
|
|
|
1021
|
+
- formatting_instruction: str.
|
|
1022
|
+
|
|
1002
1023
|
- guess_xlsx_sheet_name: bool.
|
|
1003
1024
|
|
|
1004
1025
|
- html_make_all_elements_visible: bool.
|
|
@@ -1078,6 +1099,8 @@ class AsyncParsingClient:
|
|
|
1078
1099
|
"bbox_left": bbox_left,
|
|
1079
1100
|
"bbox_right": bbox_right,
|
|
1080
1101
|
"bbox_top": bbox_top,
|
|
1102
|
+
"complemental_formatting_instruction": complemental_formatting_instruction,
|
|
1103
|
+
"content_guideline_instruction": content_guideline_instruction,
|
|
1081
1104
|
"continuous_mode": continuous_mode,
|
|
1082
1105
|
"disable_ocr": disable_ocr,
|
|
1083
1106
|
"disable_reconstruction": disable_reconstruction,
|
|
@@ -1086,6 +1109,7 @@ class AsyncParsingClient:
|
|
|
1086
1109
|
"do_not_unroll_columns": do_not_unroll_columns,
|
|
1087
1110
|
"extract_charts": extract_charts,
|
|
1088
1111
|
"fast_mode": fast_mode,
|
|
1112
|
+
"formatting_instruction": formatting_instruction,
|
|
1089
1113
|
"guess_xlsx_sheet_name": guess_xlsx_sheet_name,
|
|
1090
1114
|
"html_make_all_elements_visible": html_make_all_elements_visible,
|
|
1091
1115
|
"html_remove_fixed_elements": html_remove_fixed_elements,
|
|
@@ -581,7 +581,7 @@ class ReportsClient:
|
|
|
581
581
|
self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
582
582
|
) -> typing.Any:
|
|
583
583
|
"""
|
|
584
|
-
Restart a report.
|
|
584
|
+
Restart a report from scratch.
|
|
585
585
|
|
|
586
586
|
Parameters:
|
|
587
587
|
- report_id: str.
|
|
@@ -601,7 +601,7 @@ class ReportsClient:
|
|
|
601
601
|
"""
|
|
602
602
|
_response = self._client_wrapper.httpx_client.request(
|
|
603
603
|
"POST",
|
|
604
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/
|
|
604
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/restart"),
|
|
605
605
|
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
606
606
|
headers=self._client_wrapper.get_headers(),
|
|
607
607
|
timeout=60,
|
|
@@ -1162,7 +1162,7 @@ class AsyncReportsClient:
|
|
|
1162
1162
|
self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
1163
1163
|
) -> typing.Any:
|
|
1164
1164
|
"""
|
|
1165
|
-
Restart a report.
|
|
1165
|
+
Restart a report from scratch.
|
|
1166
1166
|
|
|
1167
1167
|
Parameters:
|
|
1168
1168
|
- report_id: str.
|
|
@@ -1182,7 +1182,7 @@ class AsyncReportsClient:
|
|
|
1182
1182
|
"""
|
|
1183
1183
|
_response = await self._client_wrapper.httpx_client.request(
|
|
1184
1184
|
"POST",
|
|
1185
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/
|
|
1185
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/restart"),
|
|
1186
1186
|
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1187
1187
|
headers=self._client_wrapper.get_headers(),
|
|
1188
1188
|
timeout=60,
|
llama_cloud/types/__init__.py
CHANGED
|
@@ -53,6 +53,7 @@ from .cohere_embedding_config import CohereEmbeddingConfig
|
|
|
53
53
|
from .composite_retrieval_mode import CompositeRetrievalMode
|
|
54
54
|
from .composite_retrieval_result import CompositeRetrievalResult
|
|
55
55
|
from .composite_retrieved_text_node import CompositeRetrievedTextNode
|
|
56
|
+
from .composite_retrieved_text_node_with_score import CompositeRetrievedTextNodeWithScore
|
|
56
57
|
from .configurable_data_sink_names import ConfigurableDataSinkNames
|
|
57
58
|
from .configurable_data_source_names import ConfigurableDataSourceNames
|
|
58
59
|
from .configurable_transformation_definition import ConfigurableTransformationDefinition
|
|
@@ -116,6 +117,9 @@ from .extract_resultset_data import ExtractResultsetData
|
|
|
116
117
|
from .extract_resultset_data_item_value import ExtractResultsetDataItemValue
|
|
117
118
|
from .extract_resultset_data_zero_value import ExtractResultsetDataZeroValue
|
|
118
119
|
from .extract_resultset_extraction_metadata_value import ExtractResultsetExtractionMetadataValue
|
|
120
|
+
from .extract_run import ExtractRun
|
|
121
|
+
from .extract_run_data_schema_value import ExtractRunDataSchemaValue
|
|
122
|
+
from .extract_state import ExtractState
|
|
119
123
|
from .extraction_job import ExtractionJob
|
|
120
124
|
from .extraction_result import ExtractionResult
|
|
121
125
|
from .extraction_result_data_value import ExtractionResultDataValue
|
|
@@ -140,6 +144,7 @@ from .job_name_mapping import JobNameMapping
|
|
|
140
144
|
from .job_names import JobNames
|
|
141
145
|
from .job_record import JobRecord
|
|
142
146
|
from .job_record_with_usage_metrics import JobRecordWithUsageMetrics
|
|
147
|
+
from .llama_extract_settings import LlamaExtractSettings
|
|
143
148
|
from .llama_index_core_base_llms_types_chat_message import LlamaIndexCoreBaseLlmsTypesChatMessage
|
|
144
149
|
from .llama_index_core_base_llms_types_chat_message_blocks_item import (
|
|
145
150
|
LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem,
|
|
@@ -174,6 +179,7 @@ from .open_ai_embedding import OpenAiEmbedding
|
|
|
174
179
|
from .open_ai_embedding_config import OpenAiEmbeddingConfig
|
|
175
180
|
from .organization import Organization
|
|
176
181
|
from .organization_create import OrganizationCreate
|
|
182
|
+
from .page_figure_metadata import PageFigureMetadata
|
|
177
183
|
from .page_screenshot_metadata import PageScreenshotMetadata
|
|
178
184
|
from .page_screenshot_node_with_score import PageScreenshotNodeWithScore
|
|
179
185
|
from .page_segmentation_config import PageSegmentationConfig
|
|
@@ -350,6 +356,7 @@ __all__ = [
|
|
|
350
356
|
"CompositeRetrievalMode",
|
|
351
357
|
"CompositeRetrievalResult",
|
|
352
358
|
"CompositeRetrievedTextNode",
|
|
359
|
+
"CompositeRetrievedTextNodeWithScore",
|
|
353
360
|
"ConfigurableDataSinkNames",
|
|
354
361
|
"ConfigurableDataSourceNames",
|
|
355
362
|
"ConfigurableTransformationDefinition",
|
|
@@ -409,6 +416,9 @@ __all__ = [
|
|
|
409
416
|
"ExtractResultsetDataItemValue",
|
|
410
417
|
"ExtractResultsetDataZeroValue",
|
|
411
418
|
"ExtractResultsetExtractionMetadataValue",
|
|
419
|
+
"ExtractRun",
|
|
420
|
+
"ExtractRunDataSchemaValue",
|
|
421
|
+
"ExtractState",
|
|
412
422
|
"ExtractionJob",
|
|
413
423
|
"ExtractionResult",
|
|
414
424
|
"ExtractionResultDataValue",
|
|
@@ -433,6 +443,7 @@ __all__ = [
|
|
|
433
443
|
"JobNames",
|
|
434
444
|
"JobRecord",
|
|
435
445
|
"JobRecordWithUsageMetrics",
|
|
446
|
+
"LlamaExtractSettings",
|
|
436
447
|
"LlamaIndexCoreBaseLlmsTypesChatMessage",
|
|
437
448
|
"LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem",
|
|
438
449
|
"LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem_Image",
|
|
@@ -465,6 +476,7 @@ __all__ = [
|
|
|
465
476
|
"OpenAiEmbeddingConfig",
|
|
466
477
|
"Organization",
|
|
467
478
|
"OrganizationCreate",
|
|
479
|
+
"PageFigureMetadata",
|
|
468
480
|
"PageScreenshotMetadata",
|
|
469
481
|
"PageScreenshotNodeWithScore",
|
|
470
482
|
"PageSegmentationConfig",
|
|
@@ -4,7 +4,7 @@ import datetime as dt
|
|
|
4
4
|
import typing
|
|
5
5
|
|
|
6
6
|
from ..core.datetime_utils import serialize_datetime
|
|
7
|
-
from .
|
|
7
|
+
from .composite_retrieved_text_node_with_score import CompositeRetrievedTextNodeWithScore
|
|
8
8
|
from .page_screenshot_node_with_score import PageScreenshotNodeWithScore
|
|
9
9
|
|
|
10
10
|
try:
|
|
@@ -17,7 +17,7 @@ except ImportError:
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
class CompositeRetrievalResult(pydantic.BaseModel):
|
|
20
|
-
nodes: typing.Optional[typing.List[
|
|
20
|
+
nodes: typing.Optional[typing.List[CompositeRetrievedTextNodeWithScore]] = pydantic.Field(
|
|
21
21
|
description="The retrieved nodes from the composite retrieval."
|
|
22
22
|
)
|
|
23
23
|
image_nodes: typing.Optional[typing.List[PageScreenshotNodeWithScore]] = pydantic.Field(
|