llama-cloud 0.1.9__py3-none-any.whl → 0.1.10__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.

Files changed (40) hide show
  1. llama_cloud/__init__.py +30 -8
  2. llama_cloud/resources/__init__.py +14 -3
  3. llama_cloud/resources/chat_apps/client.py +99 -133
  4. llama_cloud/resources/llama_extract/__init__.py +16 -2
  5. llama_cloud/resources/llama_extract/client.py +272 -102
  6. llama_cloud/resources/llama_extract/types/__init__.py +14 -3
  7. llama_cloud/resources/llama_extract/types/extract_agent_create_data_schema.py +9 -0
  8. llama_cloud/resources/llama_extract/types/{extract_agent_create_data_schema_value.py → extract_agent_create_data_schema_zero_value.py} +1 -1
  9. llama_cloud/resources/llama_extract/types/extract_agent_update_data_schema.py +9 -0
  10. llama_cloud/resources/llama_extract/types/{extract_agent_update_data_schema_value.py → extract_agent_update_data_schema_zero_value.py} +1 -1
  11. llama_cloud/resources/llama_extract/types/extract_schema_validate_request_data_schema.py +9 -0
  12. llama_cloud/resources/llama_extract/types/extract_schema_validate_request_data_schema_zero_value.py +7 -0
  13. llama_cloud/resources/organizations/client.py +8 -12
  14. llama_cloud/resources/parsing/client.py +64 -0
  15. llama_cloud/resources/reports/client.py +30 -26
  16. llama_cloud/resources/retrievers/client.py +16 -4
  17. llama_cloud/types/__init__.py +18 -4
  18. llama_cloud/types/chat_app.py +11 -9
  19. llama_cloud/types/chat_app_response.py +12 -10
  20. llama_cloud/types/cloud_mongo_db_atlas_vector_search.py +1 -0
  21. llama_cloud/types/extract_job_create.py +4 -2
  22. llama_cloud/types/extract_job_create_data_schema_override.py +9 -0
  23. llama_cloud/types/{extract_job_create_data_schema_override_value.py → extract_job_create_data_schema_override_zero_value.py} +1 -1
  24. llama_cloud/types/extract_run.py +2 -2
  25. llama_cloud/types/extract_run_data.py +11 -0
  26. llama_cloud/types/extract_run_data_item_value.py +5 -0
  27. llama_cloud/types/extract_run_data_zero_value.py +5 -0
  28. llama_cloud/types/extract_schema_validate_response.py +32 -0
  29. llama_cloud/types/extract_schema_validate_response_data_schema_value.py +7 -0
  30. llama_cloud/types/llama_extract_settings.py +4 -0
  31. llama_cloud/types/llama_parse_parameters.py +8 -0
  32. llama_cloud/types/plan.py +4 -0
  33. llama_cloud/types/preset_composite_retrieval_params.py +35 -0
  34. llama_cloud/types/report_file_info.py +37 -0
  35. llama_cloud/types/report_metadata.py +2 -1
  36. {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.10.dist-info}/METADATA +1 -1
  37. {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.10.dist-info}/RECORD +39 -28
  38. llama_cloud/types/extract_run_data_value.py +0 -5
  39. {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.10.dist-info}/LICENSE +0 -0
  40. {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.10.dist-info}/WHEEL +0 -0
@@ -15,10 +15,12 @@ from ...types.extract_job import ExtractJob
15
15
  from ...types.extract_job_create import ExtractJobCreate
16
16
  from ...types.extract_resultset import ExtractResultset
17
17
  from ...types.extract_run import ExtractRun
18
+ from ...types.extract_schema_validate_response import ExtractSchemaValidateResponse
18
19
  from ...types.http_validation_error import HttpValidationError
19
20
  from ...types.llama_extract_settings import LlamaExtractSettings
20
- from .types.extract_agent_create_data_schema_value import ExtractAgentCreateDataSchemaValue
21
- from .types.extract_agent_update_data_schema_value import ExtractAgentUpdateDataSchemaValue
21
+ from .types.extract_agent_create_data_schema import ExtractAgentCreateDataSchema
22
+ from .types.extract_agent_update_data_schema import ExtractAgentUpdateDataSchema
23
+ from .types.extract_schema_validate_request_data_schema import ExtractSchemaValidateRequestDataSchema
22
24
 
23
25
  try:
24
26
  import pydantic
@@ -36,14 +38,10 @@ class LlamaExtractClient:
36
38
  def __init__(self, *, client_wrapper: SyncClientWrapper):
37
39
  self._client_wrapper = client_wrapper
38
40
 
39
- def list_extraction_agents(
40
- self, *, project_id: typing.Optional[str] = None, name: typing.Optional[str] = None
41
- ) -> typing.List[ExtractAgent]:
41
+ def list_extraction_agents(self, *, project_id: typing.Optional[str] = None) -> typing.List[ExtractAgent]:
42
42
  """
43
43
  Parameters:
44
44
  - project_id: typing.Optional[str].
45
-
46
- - name: typing.Optional[str].
47
45
  ---
48
46
  from llama_cloud.client import LlamaCloud
49
47
 
@@ -55,7 +53,7 @@ class LlamaExtractClient:
55
53
  _response = self._client_wrapper.httpx_client.request(
56
54
  "GET",
57
55
  urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/extraction-agents"),
58
- params=remove_none_from_dict({"project_id": project_id, "name": name}),
56
+ params=remove_none_from_dict({"project_id": project_id}),
59
57
  headers=self._client_wrapper.get_headers(),
60
58
  timeout=60,
61
59
  )
@@ -75,7 +73,7 @@ class LlamaExtractClient:
75
73
  project_id: typing.Optional[str] = None,
76
74
  organization_id: typing.Optional[str] = None,
77
75
  name: str,
78
- data_schema: typing.Dict[str, typing.Optional[ExtractAgentCreateDataSchemaValue]],
76
+ data_schema: ExtractAgentCreateDataSchema,
79
77
  config: ExtractConfig,
80
78
  ) -> ExtractAgent:
81
79
  """
@@ -86,7 +84,7 @@ class LlamaExtractClient:
86
84
 
87
85
  - name: str. The name of the extraction schema
88
86
 
89
- - data_schema: typing.Dict[str, typing.Optional[ExtractAgentCreateDataSchemaValue]]. The schema of the data.
87
+ - data_schema: ExtractAgentCreateDataSchema. The schema of the data.
90
88
 
91
89
  - config: ExtractConfig. The configuration parameters for the extraction agent.
92
90
  ---
@@ -98,7 +96,6 @@ class LlamaExtractClient:
98
96
  )
99
97
  client.llama_extract.create_extraction_agent(
100
98
  name="string",
101
- data_schema={},
102
99
  config=ExtractConfig(
103
100
  extraction_mode=ExtractMode.PER_DOC,
104
101
  ),
@@ -122,6 +119,77 @@ class LlamaExtractClient:
122
119
  raise ApiError(status_code=_response.status_code, body=_response.text)
123
120
  raise ApiError(status_code=_response.status_code, body=_response_json)
124
121
 
122
+ def validate_extraction_schema(
123
+ self, *, data_schema: ExtractSchemaValidateRequestDataSchema
124
+ ) -> ExtractSchemaValidateResponse:
125
+ """
126
+ Validates an extraction agent's schema definition.
127
+ Returns the normalized and validated schema if valid, otherwise raises an HTTP 400.
128
+
129
+ Parameters:
130
+ - data_schema: ExtractSchemaValidateRequestDataSchema.
131
+ ---
132
+ from llama_cloud.client import LlamaCloud
133
+
134
+ client = LlamaCloud(
135
+ token="YOUR_TOKEN",
136
+ )
137
+ client.llama_extract.validate_extraction_schema()
138
+ """
139
+ _response = self._client_wrapper.httpx_client.request(
140
+ "POST",
141
+ urllib.parse.urljoin(
142
+ f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/extraction-agents/schema/validation"
143
+ ),
144
+ json=jsonable_encoder({"data_schema": data_schema}),
145
+ headers=self._client_wrapper.get_headers(),
146
+ timeout=60,
147
+ )
148
+ if 200 <= _response.status_code < 300:
149
+ return pydantic.parse_obj_as(ExtractSchemaValidateResponse, _response.json()) # type: ignore
150
+ if _response.status_code == 422:
151
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
152
+ try:
153
+ _response_json = _response.json()
154
+ except JSONDecodeError:
155
+ raise ApiError(status_code=_response.status_code, body=_response.text)
156
+ raise ApiError(status_code=_response.status_code, body=_response_json)
157
+
158
+ def get_extraction_agent_by_name(self, name: str, *, project_id: typing.Optional[str] = None) -> ExtractAgent:
159
+ """
160
+ Parameters:
161
+ - name: str.
162
+
163
+ - project_id: typing.Optional[str].
164
+ ---
165
+ from llama_cloud.client import LlamaCloud
166
+
167
+ client = LlamaCloud(
168
+ token="YOUR_TOKEN",
169
+ )
170
+ client.llama_extract.get_extraction_agent_by_name(
171
+ name="string",
172
+ )
173
+ """
174
+ _response = self._client_wrapper.httpx_client.request(
175
+ "GET",
176
+ urllib.parse.urljoin(
177
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/extraction-agents/by-name/{name}"
178
+ ),
179
+ params=remove_none_from_dict({"project_id": project_id}),
180
+ headers=self._client_wrapper.get_headers(),
181
+ timeout=60,
182
+ )
183
+ if 200 <= _response.status_code < 300:
184
+ return pydantic.parse_obj_as(ExtractAgent, _response.json()) # type: ignore
185
+ if _response.status_code == 422:
186
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
187
+ try:
188
+ _response_json = _response.json()
189
+ except JSONDecodeError:
190
+ raise ApiError(status_code=_response.status_code, body=_response.text)
191
+ raise ApiError(status_code=_response.status_code, body=_response_json)
192
+
125
193
  def get_extraction_agent(self, extraction_agent_id: str) -> ExtractAgent:
126
194
  """
127
195
  Parameters:
@@ -156,17 +224,13 @@ class LlamaExtractClient:
156
224
  raise ApiError(status_code=_response.status_code, body=_response_json)
157
225
 
158
226
  def update_extraction_agent(
159
- self,
160
- extraction_agent_id: str,
161
- *,
162
- data_schema: typing.Dict[str, typing.Optional[ExtractAgentUpdateDataSchemaValue]],
163
- config: ExtractConfig,
227
+ self, extraction_agent_id: str, *, data_schema: ExtractAgentUpdateDataSchema, config: ExtractConfig
164
228
  ) -> ExtractAgent:
165
229
  """
166
230
  Parameters:
167
231
  - extraction_agent_id: str.
168
232
 
169
- - data_schema: typing.Dict[str, typing.Optional[ExtractAgentUpdateDataSchemaValue]]. The schema of the data
233
+ - data_schema: ExtractAgentUpdateDataSchema. The schema of the data
170
234
 
171
235
  - config: ExtractConfig. The configuration parameters for the extraction agent.
172
236
  ---
@@ -178,7 +242,6 @@ class LlamaExtractClient:
178
242
  )
179
243
  client.llama_extract.update_extraction_agent(
180
244
  extraction_agent_id="string",
181
- data_schema={},
182
245
  config=ExtractConfig(
183
246
  extraction_mode=ExtractMode.PER_DOC,
184
247
  ),
@@ -350,6 +413,7 @@ class LlamaExtractClient:
350
413
  ExtractJobCreate,
351
414
  ExtractMode,
352
415
  LlamaExtractSettings,
416
+ LlamaParseParameters,
353
417
  )
354
418
  from llama_cloud.client import LlamaCloud
355
419
 
@@ -364,7 +428,9 @@ class LlamaExtractClient:
364
428
  extraction_mode=ExtractMode.PER_DOC,
365
429
  ),
366
430
  ),
367
- extract_settings=LlamaExtractSettings(),
431
+ extract_settings=LlamaExtractSettings(
432
+ llama_parse_params=LlamaParseParameters(),
433
+ ),
368
434
  )
369
435
  """
370
436
  _request: typing.Dict[str, typing.Any] = {"job_create": job_create}
@@ -439,6 +505,7 @@ class LlamaExtractClient:
439
505
  ExtractJobCreate,
440
506
  ExtractMode,
441
507
  LlamaExtractSettings,
508
+ LlamaParseParameters,
442
509
  )
443
510
  from llama_cloud.client import LlamaCloud
444
511
 
@@ -453,7 +520,9 @@ class LlamaExtractClient:
453
520
  extraction_mode=ExtractMode.PER_DOC,
454
521
  ),
455
522
  ),
456
- extract_settings=LlamaExtractSettings(),
523
+ extract_settings=LlamaExtractSettings(
524
+ llama_parse_params=LlamaParseParameters(),
525
+ ),
457
526
  )
458
527
  """
459
528
  _request: typing.Dict[str, typing.Any] = {"job_create": job_create}
@@ -476,32 +545,61 @@ class LlamaExtractClient:
476
545
  raise ApiError(status_code=_response.status_code, body=_response.text)
477
546
  raise ApiError(status_code=_response.status_code, body=_response_json)
478
547
 
479
- def run_jobs_in_batch(self, *, extraction_agent_id: str, file_ids: typing.List[str]) -> typing.List[ExtractJob]:
548
+ def get_job_result(self, job_id: str) -> ExtractResultset:
480
549
  """
481
550
  Parameters:
482
- - extraction_agent_id: str. The id of the extraction agent
551
+ - job_id: str.
552
+ ---
553
+ from llama_cloud.client import LlamaCloud
554
+
555
+ client = LlamaCloud(
556
+ token="YOUR_TOKEN",
557
+ )
558
+ client.llama_extract.get_job_result(
559
+ job_id="string",
560
+ )
561
+ """
562
+ _response = self._client_wrapper.httpx_client.request(
563
+ "GET",
564
+ urllib.parse.urljoin(
565
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/jobs/{job_id}/result"
566
+ ),
567
+ headers=self._client_wrapper.get_headers(),
568
+ timeout=60,
569
+ )
570
+ if 200 <= _response.status_code < 300:
571
+ return pydantic.parse_obj_as(ExtractResultset, _response.json()) # type: ignore
572
+ if _response.status_code == 422:
573
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
574
+ try:
575
+ _response_json = _response.json()
576
+ except JSONDecodeError:
577
+ raise ApiError(status_code=_response.status_code, body=_response.text)
578
+ raise ApiError(status_code=_response.status_code, body=_response_json)
483
579
 
484
- - file_ids: typing.List[str]. The ids of the files
580
+ def list_extract_runs(self, *, extraction_agent_id: str) -> typing.List[ExtractRun]:
581
+ """
582
+ Parameters:
583
+ - extraction_agent_id: str.
485
584
  ---
486
585
  from llama_cloud.client import LlamaCloud
487
586
 
488
587
  client = LlamaCloud(
489
588
  token="YOUR_TOKEN",
490
589
  )
491
- client.llama_extract.run_jobs_in_batch(
590
+ client.llama_extract.list_extract_runs(
492
591
  extraction_agent_id="string",
493
- file_ids=[],
494
592
  )
495
593
  """
496
594
  _response = self._client_wrapper.httpx_client.request(
497
- "POST",
498
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/jobs/batch"),
499
- json=jsonable_encoder({"extraction_agent_id": extraction_agent_id, "file_ids": file_ids}),
595
+ "GET",
596
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/runs"),
597
+ params=remove_none_from_dict({"extraction_agent_id": extraction_agent_id}),
500
598
  headers=self._client_wrapper.get_headers(),
501
599
  timeout=60,
502
600
  )
503
601
  if 200 <= _response.status_code < 300:
504
- return pydantic.parse_obj_as(typing.List[ExtractJob], _response.json()) # type: ignore
602
+ return pydantic.parse_obj_as(typing.List[ExtractRun], _response.json()) # type: ignore
505
603
  if _response.status_code == 422:
506
604
  raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
507
605
  try:
@@ -510,7 +608,7 @@ class LlamaExtractClient:
510
608
  raise ApiError(status_code=_response.status_code, body=_response.text)
511
609
  raise ApiError(status_code=_response.status_code, body=_response_json)
512
610
 
513
- def get_job_result(self, job_id: str) -> ExtractResultset:
611
+ def get_run_by_job_id(self, job_id: str) -> ExtractRun:
514
612
  """
515
613
  Parameters:
516
614
  - job_id: str.
@@ -520,20 +618,20 @@ class LlamaExtractClient:
520
618
  client = LlamaCloud(
521
619
  token="YOUR_TOKEN",
522
620
  )
523
- client.llama_extract.get_job_result(
621
+ client.llama_extract.get_run_by_job_id(
524
622
  job_id="string",
525
623
  )
526
624
  """
527
625
  _response = self._client_wrapper.httpx_client.request(
528
626
  "GET",
529
627
  urllib.parse.urljoin(
530
- f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/jobs/{job_id}/result"
628
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/runs/by-job/{job_id}"
531
629
  ),
532
630
  headers=self._client_wrapper.get_headers(),
533
631
  timeout=60,
534
632
  )
535
633
  if 200 <= _response.status_code < 300:
536
- return pydantic.parse_obj_as(ExtractResultset, _response.json()) # type: ignore
634
+ return pydantic.parse_obj_as(ExtractRun, _response.json()) # type: ignore
537
635
  if _response.status_code == 422:
538
636
  raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
539
637
  try:
@@ -542,39 +640,28 @@ class LlamaExtractClient:
542
640
  raise ApiError(status_code=_response.status_code, body=_response.text)
543
641
  raise ApiError(status_code=_response.status_code, body=_response_json)
544
642
 
545
- def list_extract_runs(
546
- self,
547
- *,
548
- extraction_agent_id: typing.Optional[str] = None,
549
- run_id: typing.Optional[str] = None,
550
- job_id: typing.Optional[str] = None,
551
- ) -> typing.List[ExtractRun]:
643
+ def get_run(self, run_id: str) -> ExtractRun:
552
644
  """
553
645
  Parameters:
554
- - extraction_agent_id: typing.Optional[str].
555
-
556
- - run_id: typing.Optional[str].
557
-
558
- - job_id: typing.Optional[str].
646
+ - run_id: str.
559
647
  ---
560
648
  from llama_cloud.client import LlamaCloud
561
649
 
562
650
  client = LlamaCloud(
563
651
  token="YOUR_TOKEN",
564
652
  )
565
- client.llama_extract.list_extract_runs()
653
+ client.llama_extract.get_run(
654
+ run_id="string",
655
+ )
566
656
  """
567
657
  _response = self._client_wrapper.httpx_client.request(
568
658
  "GET",
569
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/runs"),
570
- params=remove_none_from_dict(
571
- {"extraction_agent_id": extraction_agent_id, "run_id": run_id, "job_id": job_id}
572
- ),
659
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/runs/{run_id}"),
573
660
  headers=self._client_wrapper.get_headers(),
574
661
  timeout=60,
575
662
  )
576
663
  if 200 <= _response.status_code < 300:
577
- return pydantic.parse_obj_as(typing.List[ExtractRun], _response.json()) # type: ignore
664
+ return pydantic.parse_obj_as(ExtractRun, _response.json()) # type: ignore
578
665
  if _response.status_code == 422:
579
666
  raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
580
667
  try:
@@ -588,14 +675,10 @@ class AsyncLlamaExtractClient:
588
675
  def __init__(self, *, client_wrapper: AsyncClientWrapper):
589
676
  self._client_wrapper = client_wrapper
590
677
 
591
- async def list_extraction_agents(
592
- self, *, project_id: typing.Optional[str] = None, name: typing.Optional[str] = None
593
- ) -> typing.List[ExtractAgent]:
678
+ async def list_extraction_agents(self, *, project_id: typing.Optional[str] = None) -> typing.List[ExtractAgent]:
594
679
  """
595
680
  Parameters:
596
681
  - project_id: typing.Optional[str].
597
-
598
- - name: typing.Optional[str].
599
682
  ---
600
683
  from llama_cloud.client import AsyncLlamaCloud
601
684
 
@@ -607,7 +690,7 @@ class AsyncLlamaExtractClient:
607
690
  _response = await self._client_wrapper.httpx_client.request(
608
691
  "GET",
609
692
  urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/extraction-agents"),
610
- params=remove_none_from_dict({"project_id": project_id, "name": name}),
693
+ params=remove_none_from_dict({"project_id": project_id}),
611
694
  headers=self._client_wrapper.get_headers(),
612
695
  timeout=60,
613
696
  )
@@ -627,7 +710,7 @@ class AsyncLlamaExtractClient:
627
710
  project_id: typing.Optional[str] = None,
628
711
  organization_id: typing.Optional[str] = None,
629
712
  name: str,
630
- data_schema: typing.Dict[str, typing.Optional[ExtractAgentCreateDataSchemaValue]],
713
+ data_schema: ExtractAgentCreateDataSchema,
631
714
  config: ExtractConfig,
632
715
  ) -> ExtractAgent:
633
716
  """
@@ -638,7 +721,7 @@ class AsyncLlamaExtractClient:
638
721
 
639
722
  - name: str. The name of the extraction schema
640
723
 
641
- - data_schema: typing.Dict[str, typing.Optional[ExtractAgentCreateDataSchemaValue]]. The schema of the data.
724
+ - data_schema: ExtractAgentCreateDataSchema. The schema of the data.
642
725
 
643
726
  - config: ExtractConfig. The configuration parameters for the extraction agent.
644
727
  ---
@@ -650,7 +733,6 @@ class AsyncLlamaExtractClient:
650
733
  )
651
734
  await client.llama_extract.create_extraction_agent(
652
735
  name="string",
653
- data_schema={},
654
736
  config=ExtractConfig(
655
737
  extraction_mode=ExtractMode.PER_DOC,
656
738
  ),
@@ -674,6 +756,77 @@ class AsyncLlamaExtractClient:
674
756
  raise ApiError(status_code=_response.status_code, body=_response.text)
675
757
  raise ApiError(status_code=_response.status_code, body=_response_json)
676
758
 
759
+ async def validate_extraction_schema(
760
+ self, *, data_schema: ExtractSchemaValidateRequestDataSchema
761
+ ) -> ExtractSchemaValidateResponse:
762
+ """
763
+ Validates an extraction agent's schema definition.
764
+ Returns the normalized and validated schema if valid, otherwise raises an HTTP 400.
765
+
766
+ Parameters:
767
+ - data_schema: ExtractSchemaValidateRequestDataSchema.
768
+ ---
769
+ from llama_cloud.client import AsyncLlamaCloud
770
+
771
+ client = AsyncLlamaCloud(
772
+ token="YOUR_TOKEN",
773
+ )
774
+ await client.llama_extract.validate_extraction_schema()
775
+ """
776
+ _response = await self._client_wrapper.httpx_client.request(
777
+ "POST",
778
+ urllib.parse.urljoin(
779
+ f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/extraction-agents/schema/validation"
780
+ ),
781
+ json=jsonable_encoder({"data_schema": data_schema}),
782
+ headers=self._client_wrapper.get_headers(),
783
+ timeout=60,
784
+ )
785
+ if 200 <= _response.status_code < 300:
786
+ return pydantic.parse_obj_as(ExtractSchemaValidateResponse, _response.json()) # type: ignore
787
+ if _response.status_code == 422:
788
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
789
+ try:
790
+ _response_json = _response.json()
791
+ except JSONDecodeError:
792
+ raise ApiError(status_code=_response.status_code, body=_response.text)
793
+ raise ApiError(status_code=_response.status_code, body=_response_json)
794
+
795
+ async def get_extraction_agent_by_name(self, name: str, *, project_id: typing.Optional[str] = None) -> ExtractAgent:
796
+ """
797
+ Parameters:
798
+ - name: str.
799
+
800
+ - project_id: typing.Optional[str].
801
+ ---
802
+ from llama_cloud.client import AsyncLlamaCloud
803
+
804
+ client = AsyncLlamaCloud(
805
+ token="YOUR_TOKEN",
806
+ )
807
+ await client.llama_extract.get_extraction_agent_by_name(
808
+ name="string",
809
+ )
810
+ """
811
+ _response = await self._client_wrapper.httpx_client.request(
812
+ "GET",
813
+ urllib.parse.urljoin(
814
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/extraction-agents/by-name/{name}"
815
+ ),
816
+ params=remove_none_from_dict({"project_id": project_id}),
817
+ headers=self._client_wrapper.get_headers(),
818
+ timeout=60,
819
+ )
820
+ if 200 <= _response.status_code < 300:
821
+ return pydantic.parse_obj_as(ExtractAgent, _response.json()) # type: ignore
822
+ if _response.status_code == 422:
823
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
824
+ try:
825
+ _response_json = _response.json()
826
+ except JSONDecodeError:
827
+ raise ApiError(status_code=_response.status_code, body=_response.text)
828
+ raise ApiError(status_code=_response.status_code, body=_response_json)
829
+
677
830
  async def get_extraction_agent(self, extraction_agent_id: str) -> ExtractAgent:
678
831
  """
679
832
  Parameters:
@@ -708,17 +861,13 @@ class AsyncLlamaExtractClient:
708
861
  raise ApiError(status_code=_response.status_code, body=_response_json)
709
862
 
710
863
  async def update_extraction_agent(
711
- self,
712
- extraction_agent_id: str,
713
- *,
714
- data_schema: typing.Dict[str, typing.Optional[ExtractAgentUpdateDataSchemaValue]],
715
- config: ExtractConfig,
864
+ self, extraction_agent_id: str, *, data_schema: ExtractAgentUpdateDataSchema, config: ExtractConfig
716
865
  ) -> ExtractAgent:
717
866
  """
718
867
  Parameters:
719
868
  - extraction_agent_id: str.
720
869
 
721
- - data_schema: typing.Dict[str, typing.Optional[ExtractAgentUpdateDataSchemaValue]]. The schema of the data
870
+ - data_schema: ExtractAgentUpdateDataSchema. The schema of the data
722
871
 
723
872
  - config: ExtractConfig. The configuration parameters for the extraction agent.
724
873
  ---
@@ -730,7 +879,6 @@ class AsyncLlamaExtractClient:
730
879
  )
731
880
  await client.llama_extract.update_extraction_agent(
732
881
  extraction_agent_id="string",
733
- data_schema={},
734
882
  config=ExtractConfig(
735
883
  extraction_mode=ExtractMode.PER_DOC,
736
884
  ),
@@ -902,6 +1050,7 @@ class AsyncLlamaExtractClient:
902
1050
  ExtractJobCreate,
903
1051
  ExtractMode,
904
1052
  LlamaExtractSettings,
1053
+ LlamaParseParameters,
905
1054
  )
906
1055
  from llama_cloud.client import AsyncLlamaCloud
907
1056
 
@@ -916,7 +1065,9 @@ class AsyncLlamaExtractClient:
916
1065
  extraction_mode=ExtractMode.PER_DOC,
917
1066
  ),
918
1067
  ),
919
- extract_settings=LlamaExtractSettings(),
1068
+ extract_settings=LlamaExtractSettings(
1069
+ llama_parse_params=LlamaParseParameters(),
1070
+ ),
920
1071
  )
921
1072
  """
922
1073
  _request: typing.Dict[str, typing.Any] = {"job_create": job_create}
@@ -991,6 +1142,7 @@ class AsyncLlamaExtractClient:
991
1142
  ExtractJobCreate,
992
1143
  ExtractMode,
993
1144
  LlamaExtractSettings,
1145
+ LlamaParseParameters,
994
1146
  )
995
1147
  from llama_cloud.client import AsyncLlamaCloud
996
1148
 
@@ -1005,7 +1157,9 @@ class AsyncLlamaExtractClient:
1005
1157
  extraction_mode=ExtractMode.PER_DOC,
1006
1158
  ),
1007
1159
  ),
1008
- extract_settings=LlamaExtractSettings(),
1160
+ extract_settings=LlamaExtractSettings(
1161
+ llama_parse_params=LlamaParseParameters(),
1162
+ ),
1009
1163
  )
1010
1164
  """
1011
1165
  _request: typing.Dict[str, typing.Any] = {"job_create": job_create}
@@ -1028,34 +1182,61 @@ class AsyncLlamaExtractClient:
1028
1182
  raise ApiError(status_code=_response.status_code, body=_response.text)
1029
1183
  raise ApiError(status_code=_response.status_code, body=_response_json)
1030
1184
 
1031
- async def run_jobs_in_batch(
1032
- self, *, extraction_agent_id: str, file_ids: typing.List[str]
1033
- ) -> typing.List[ExtractJob]:
1185
+ async def get_job_result(self, job_id: str) -> ExtractResultset:
1034
1186
  """
1035
1187
  Parameters:
1036
- - extraction_agent_id: str. The id of the extraction agent
1188
+ - job_id: str.
1189
+ ---
1190
+ from llama_cloud.client import AsyncLlamaCloud
1191
+
1192
+ client = AsyncLlamaCloud(
1193
+ token="YOUR_TOKEN",
1194
+ )
1195
+ await client.llama_extract.get_job_result(
1196
+ job_id="string",
1197
+ )
1198
+ """
1199
+ _response = await self._client_wrapper.httpx_client.request(
1200
+ "GET",
1201
+ urllib.parse.urljoin(
1202
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/jobs/{job_id}/result"
1203
+ ),
1204
+ headers=self._client_wrapper.get_headers(),
1205
+ timeout=60,
1206
+ )
1207
+ if 200 <= _response.status_code < 300:
1208
+ return pydantic.parse_obj_as(ExtractResultset, _response.json()) # type: ignore
1209
+ if _response.status_code == 422:
1210
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1211
+ try:
1212
+ _response_json = _response.json()
1213
+ except JSONDecodeError:
1214
+ raise ApiError(status_code=_response.status_code, body=_response.text)
1215
+ raise ApiError(status_code=_response.status_code, body=_response_json)
1037
1216
 
1038
- - file_ids: typing.List[str]. The ids of the files
1217
+ async def list_extract_runs(self, *, extraction_agent_id: str) -> typing.List[ExtractRun]:
1218
+ """
1219
+ Parameters:
1220
+ - extraction_agent_id: str.
1039
1221
  ---
1040
1222
  from llama_cloud.client import AsyncLlamaCloud
1041
1223
 
1042
1224
  client = AsyncLlamaCloud(
1043
1225
  token="YOUR_TOKEN",
1044
1226
  )
1045
- await client.llama_extract.run_jobs_in_batch(
1227
+ await client.llama_extract.list_extract_runs(
1046
1228
  extraction_agent_id="string",
1047
- file_ids=[],
1048
1229
  )
1049
1230
  """
1050
1231
  _response = await self._client_wrapper.httpx_client.request(
1051
- "POST",
1052
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/jobs/batch"),
1053
- json=jsonable_encoder({"extraction_agent_id": extraction_agent_id, "file_ids": file_ids}),
1232
+ "GET",
1233
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/runs"),
1234
+ params=remove_none_from_dict({"extraction_agent_id": extraction_agent_id}),
1054
1235
  headers=self._client_wrapper.get_headers(),
1055
1236
  timeout=60,
1056
1237
  )
1057
1238
  if 200 <= _response.status_code < 300:
1058
- return pydantic.parse_obj_as(typing.List[ExtractJob], _response.json()) # type: ignore
1239
+ return pydantic.parse_obj_as(typing.List[ExtractRun], _response.json()) # type: ignore
1059
1240
  if _response.status_code == 422:
1060
1241
  raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1061
1242
  try:
@@ -1064,7 +1245,7 @@ class AsyncLlamaExtractClient:
1064
1245
  raise ApiError(status_code=_response.status_code, body=_response.text)
1065
1246
  raise ApiError(status_code=_response.status_code, body=_response_json)
1066
1247
 
1067
- async def get_job_result(self, job_id: str) -> ExtractResultset:
1248
+ async def get_run_by_job_id(self, job_id: str) -> ExtractRun:
1068
1249
  """
1069
1250
  Parameters:
1070
1251
  - job_id: str.
@@ -1074,20 +1255,20 @@ class AsyncLlamaExtractClient:
1074
1255
  client = AsyncLlamaCloud(
1075
1256
  token="YOUR_TOKEN",
1076
1257
  )
1077
- await client.llama_extract.get_job_result(
1258
+ await client.llama_extract.get_run_by_job_id(
1078
1259
  job_id="string",
1079
1260
  )
1080
1261
  """
1081
1262
  _response = await self._client_wrapper.httpx_client.request(
1082
1263
  "GET",
1083
1264
  urllib.parse.urljoin(
1084
- f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/jobs/{job_id}/result"
1265
+ f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/runs/by-job/{job_id}"
1085
1266
  ),
1086
1267
  headers=self._client_wrapper.get_headers(),
1087
1268
  timeout=60,
1088
1269
  )
1089
1270
  if 200 <= _response.status_code < 300:
1090
- return pydantic.parse_obj_as(ExtractResultset, _response.json()) # type: ignore
1271
+ return pydantic.parse_obj_as(ExtractRun, _response.json()) # type: ignore
1091
1272
  if _response.status_code == 422:
1092
1273
  raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1093
1274
  try:
@@ -1096,39 +1277,28 @@ class AsyncLlamaExtractClient:
1096
1277
  raise ApiError(status_code=_response.status_code, body=_response.text)
1097
1278
  raise ApiError(status_code=_response.status_code, body=_response_json)
1098
1279
 
1099
- async def list_extract_runs(
1100
- self,
1101
- *,
1102
- extraction_agent_id: typing.Optional[str] = None,
1103
- run_id: typing.Optional[str] = None,
1104
- job_id: typing.Optional[str] = None,
1105
- ) -> typing.List[ExtractRun]:
1280
+ async def get_run(self, run_id: str) -> ExtractRun:
1106
1281
  """
1107
1282
  Parameters:
1108
- - extraction_agent_id: typing.Optional[str].
1109
-
1110
- - run_id: typing.Optional[str].
1111
-
1112
- - job_id: typing.Optional[str].
1283
+ - run_id: str.
1113
1284
  ---
1114
1285
  from llama_cloud.client import AsyncLlamaCloud
1115
1286
 
1116
1287
  client = AsyncLlamaCloud(
1117
1288
  token="YOUR_TOKEN",
1118
1289
  )
1119
- await client.llama_extract.list_extract_runs()
1290
+ await client.llama_extract.get_run(
1291
+ run_id="string",
1292
+ )
1120
1293
  """
1121
1294
  _response = await self._client_wrapper.httpx_client.request(
1122
1295
  "GET",
1123
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/extractionv2/runs"),
1124
- params=remove_none_from_dict(
1125
- {"extraction_agent_id": extraction_agent_id, "run_id": run_id, "job_id": job_id}
1126
- ),
1296
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/extractionv2/runs/{run_id}"),
1127
1297
  headers=self._client_wrapper.get_headers(),
1128
1298
  timeout=60,
1129
1299
  )
1130
1300
  if 200 <= _response.status_code < 300:
1131
- return pydantic.parse_obj_as(typing.List[ExtractRun], _response.json()) # type: ignore
1301
+ return pydantic.parse_obj_as(ExtractRun, _response.json()) # type: ignore
1132
1302
  if _response.status_code == 422:
1133
1303
  raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1134
1304
  try: