llama-cloud 0.1.7a1__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 +16 -16
- llama_cloud/client.py +0 -3
- llama_cloud/resources/__init__.py +0 -5
- llama_cloud/resources/chat_apps/client.py +10 -0
- llama_cloud/resources/files/client.py +305 -6
- llama_cloud/resources/llama_extract/client.py +376 -276
- llama_cloud/resources/parsing/client.py +106 -18
- llama_cloud/resources/reports/client.py +4 -4
- llama_cloud/types/__init__.py +16 -10
- llama_cloud/types/composite_retrieval_result.py +2 -2
- llama_cloud/types/{extraction_job.py → composite_retrieved_text_node_with_score.py} +5 -6
- llama_cloud/types/extract_job.py +3 -0
- llama_cloud/types/extract_resultset.py +2 -6
- llama_cloud/types/extract_run.py +54 -0
- llama_cloud/types/{extraction_result_data_value.py → extract_run_data_schema_value.py} +1 -1
- 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 +29 -0
- llama_cloud/types/{extraction_result.py → llama_extract_settings.py} +12 -11
- llama_cloud/types/llama_parse_parameters.py +6 -0
- llama_cloud/types/{extraction_schema.py → page_figure_metadata.py} +7 -12
- llama_cloud/types/report_metadata.py +4 -0
- {llama_cloud-0.1.7a1.dist-info → llama_cloud-0.1.9.dist-info}/METADATA +2 -1
- {llama_cloud-0.1.7a1.dist-info → llama_cloud-0.1.9.dist-info}/RECORD +26 -28
- {llama_cloud-0.1.7a1.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-0.1.7a1.dist-info → llama_cloud-0.1.9.dist-info}/LICENSE +0 -0
llama_cloud/__init__.py
CHANGED
|
@@ -50,6 +50,7 @@ from .types import (
|
|
|
50
50
|
CompositeRetrievalMode,
|
|
51
51
|
CompositeRetrievalResult,
|
|
52
52
|
CompositeRetrievedTextNode,
|
|
53
|
+
CompositeRetrievedTextNodeWithScore,
|
|
53
54
|
ConfigurableDataSinkNames,
|
|
54
55
|
ConfigurableDataSourceNames,
|
|
55
56
|
ConfigurableTransformationDefinition,
|
|
@@ -109,11 +110,11 @@ from .types import (
|
|
|
109
110
|
ExtractResultsetDataItemValue,
|
|
110
111
|
ExtractResultsetDataZeroValue,
|
|
111
112
|
ExtractResultsetExtractionMetadataValue,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
ExtractRun,
|
|
114
|
+
ExtractRunDataSchemaValue,
|
|
115
|
+
ExtractRunDataValue,
|
|
116
|
+
ExtractRunExtractionMetadataValue,
|
|
117
|
+
ExtractState,
|
|
117
118
|
File,
|
|
118
119
|
FilePermissionInfoValue,
|
|
119
120
|
FileResourceInfoValue,
|
|
@@ -133,6 +134,7 @@ from .types import (
|
|
|
133
134
|
JobNames,
|
|
134
135
|
JobRecord,
|
|
135
136
|
JobRecordWithUsageMetrics,
|
|
137
|
+
LlamaExtractSettings,
|
|
136
138
|
LlamaIndexCoreBaseLlmsTypesChatMessage,
|
|
137
139
|
LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem,
|
|
138
140
|
LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem_Image,
|
|
@@ -165,6 +167,7 @@ from .types import (
|
|
|
165
167
|
OpenAiEmbeddingConfig,
|
|
166
168
|
Organization,
|
|
167
169
|
OrganizationCreate,
|
|
170
|
+
PageFigureMetadata,
|
|
168
171
|
PageScreenshotMetadata,
|
|
169
172
|
PageScreenshotNodeWithScore,
|
|
170
173
|
PageSegmentationConfig,
|
|
@@ -298,8 +301,6 @@ from .resources import (
|
|
|
298
301
|
EmbeddingModelConfigCreateEmbeddingConfig_VertexaiEmbedding,
|
|
299
302
|
ExtractAgentCreateDataSchemaValue,
|
|
300
303
|
ExtractAgentUpdateDataSchemaValue,
|
|
301
|
-
ExtractionSchemaCreateDataSchemaValue,
|
|
302
|
-
ExtractionSchemaUpdateDataSchemaValue,
|
|
303
304
|
FileCreateFromUrlResourceInfoValue,
|
|
304
305
|
FileCreatePermissionInfoValue,
|
|
305
306
|
FileCreateResourceInfoValue,
|
|
@@ -320,7 +321,6 @@ from .resources import (
|
|
|
320
321
|
data_sources,
|
|
321
322
|
embedding_model_configs,
|
|
322
323
|
evals,
|
|
323
|
-
extraction,
|
|
324
324
|
files,
|
|
325
325
|
jobs,
|
|
326
326
|
llama_extract,
|
|
@@ -383,6 +383,7 @@ __all__ = [
|
|
|
383
383
|
"CompositeRetrievalMode",
|
|
384
384
|
"CompositeRetrievalResult",
|
|
385
385
|
"CompositeRetrievedTextNode",
|
|
386
|
+
"CompositeRetrievedTextNodeWithScore",
|
|
386
387
|
"ConfigurableDataSinkNames",
|
|
387
388
|
"ConfigurableDataSourceNames",
|
|
388
389
|
"ConfigurableTransformationDefinition",
|
|
@@ -455,13 +456,11 @@ __all__ = [
|
|
|
455
456
|
"ExtractResultsetDataItemValue",
|
|
456
457
|
"ExtractResultsetDataZeroValue",
|
|
457
458
|
"ExtractResultsetExtractionMetadataValue",
|
|
458
|
-
"
|
|
459
|
-
"
|
|
460
|
-
"
|
|
461
|
-
"
|
|
462
|
-
"
|
|
463
|
-
"ExtractionSchemaDataSchemaValue",
|
|
464
|
-
"ExtractionSchemaUpdateDataSchemaValue",
|
|
459
|
+
"ExtractRun",
|
|
460
|
+
"ExtractRunDataSchemaValue",
|
|
461
|
+
"ExtractRunDataValue",
|
|
462
|
+
"ExtractRunExtractionMetadataValue",
|
|
463
|
+
"ExtractState",
|
|
465
464
|
"File",
|
|
466
465
|
"FileCreateFromUrlResourceInfoValue",
|
|
467
466
|
"FileCreatePermissionInfoValue",
|
|
@@ -485,6 +484,7 @@ __all__ = [
|
|
|
485
484
|
"JobRecord",
|
|
486
485
|
"JobRecordWithUsageMetrics",
|
|
487
486
|
"LlamaCloudEnvironment",
|
|
487
|
+
"LlamaExtractSettings",
|
|
488
488
|
"LlamaIndexCoreBaseLlmsTypesChatMessage",
|
|
489
489
|
"LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem",
|
|
490
490
|
"LlamaIndexCoreBaseLlmsTypesChatMessageBlocksItem_Image",
|
|
@@ -517,6 +517,7 @@ __all__ = [
|
|
|
517
517
|
"OpenAiEmbeddingConfig",
|
|
518
518
|
"Organization",
|
|
519
519
|
"OrganizationCreate",
|
|
520
|
+
"PageFigureMetadata",
|
|
520
521
|
"PageScreenshotMetadata",
|
|
521
522
|
"PageScreenshotNodeWithScore",
|
|
522
523
|
"PageSegmentationConfig",
|
|
@@ -652,7 +653,6 @@ __all__ = [
|
|
|
652
653
|
"data_sources",
|
|
653
654
|
"embedding_model_configs",
|
|
654
655
|
"evals",
|
|
655
|
-
"extraction",
|
|
656
656
|
"files",
|
|
657
657
|
"jobs",
|
|
658
658
|
"llama_extract",
|
llama_cloud/client.py
CHANGED
|
@@ -12,7 +12,6 @@ from .resources.data_sinks.client import AsyncDataSinksClient, DataSinksClient
|
|
|
12
12
|
from .resources.data_sources.client import AsyncDataSourcesClient, DataSourcesClient
|
|
13
13
|
from .resources.embedding_model_configs.client import AsyncEmbeddingModelConfigsClient, EmbeddingModelConfigsClient
|
|
14
14
|
from .resources.evals.client import AsyncEvalsClient, EvalsClient
|
|
15
|
-
from .resources.extraction.client import AsyncExtractionClient, ExtractionClient
|
|
16
15
|
from .resources.files.client import AsyncFilesClient, FilesClient
|
|
17
16
|
from .resources.jobs.client import AsyncJobsClient, JobsClient
|
|
18
17
|
from .resources.llama_extract.client import AsyncLlamaExtractClient, LlamaExtractClient
|
|
@@ -52,7 +51,6 @@ class LlamaCloud:
|
|
|
52
51
|
self.parsing = ParsingClient(client_wrapper=self._client_wrapper)
|
|
53
52
|
self.component_definitions = ComponentDefinitionsClient(client_wrapper=self._client_wrapper)
|
|
54
53
|
self.chat_apps = ChatAppsClient(client_wrapper=self._client_wrapper)
|
|
55
|
-
self.extraction = ExtractionClient(client_wrapper=self._client_wrapper)
|
|
56
54
|
self.llama_extract = LlamaExtractClient(client_wrapper=self._client_wrapper)
|
|
57
55
|
self.reports = ReportsClient(client_wrapper=self._client_wrapper)
|
|
58
56
|
|
|
@@ -85,7 +83,6 @@ class AsyncLlamaCloud:
|
|
|
85
83
|
self.parsing = AsyncParsingClient(client_wrapper=self._client_wrapper)
|
|
86
84
|
self.component_definitions = AsyncComponentDefinitionsClient(client_wrapper=self._client_wrapper)
|
|
87
85
|
self.chat_apps = AsyncChatAppsClient(client_wrapper=self._client_wrapper)
|
|
88
|
-
self.extraction = AsyncExtractionClient(client_wrapper=self._client_wrapper)
|
|
89
86
|
self.llama_extract = AsyncLlamaExtractClient(client_wrapper=self._client_wrapper)
|
|
90
87
|
self.reports = AsyncReportsClient(client_wrapper=self._client_wrapper)
|
|
91
88
|
|
|
@@ -7,7 +7,6 @@ from . import (
|
|
|
7
7
|
data_sources,
|
|
8
8
|
embedding_model_configs,
|
|
9
9
|
evals,
|
|
10
|
-
extraction,
|
|
11
10
|
files,
|
|
12
11
|
jobs,
|
|
13
12
|
llama_extract,
|
|
@@ -30,7 +29,6 @@ from .embedding_model_configs import (
|
|
|
30
29
|
EmbeddingModelConfigCreateEmbeddingConfig_OpenaiEmbedding,
|
|
31
30
|
EmbeddingModelConfigCreateEmbeddingConfig_VertexaiEmbedding,
|
|
32
31
|
)
|
|
33
|
-
from .extraction import ExtractionSchemaCreateDataSchemaValue, ExtractionSchemaUpdateDataSchemaValue
|
|
34
32
|
from .files import FileCreateFromUrlResourceInfoValue, FileCreatePermissionInfoValue, FileCreateResourceInfoValue
|
|
35
33
|
from .llama_extract import ExtractAgentCreateDataSchemaValue, ExtractAgentUpdateDataSchemaValue
|
|
36
34
|
from .pipelines import (
|
|
@@ -61,8 +59,6 @@ __all__ = [
|
|
|
61
59
|
"EmbeddingModelConfigCreateEmbeddingConfig_VertexaiEmbedding",
|
|
62
60
|
"ExtractAgentCreateDataSchemaValue",
|
|
63
61
|
"ExtractAgentUpdateDataSchemaValue",
|
|
64
|
-
"ExtractionSchemaCreateDataSchemaValue",
|
|
65
|
-
"ExtractionSchemaUpdateDataSchemaValue",
|
|
66
62
|
"FileCreateFromUrlResourceInfoValue",
|
|
67
63
|
"FileCreatePermissionInfoValue",
|
|
68
64
|
"FileCreateResourceInfoValue",
|
|
@@ -83,7 +79,6 @@ __all__ = [
|
|
|
83
79
|
"data_sources",
|
|
84
80
|
"embedding_model_configs",
|
|
85
81
|
"evals",
|
|
86
|
-
"extraction",
|
|
87
82
|
"files",
|
|
88
83
|
"jobs",
|
|
89
84
|
"llama_extract",
|
|
@@ -70,6 +70,7 @@ class ChatAppsClient:
|
|
|
70
70
|
*,
|
|
71
71
|
project_id: typing.Optional[str] = None,
|
|
72
72
|
organization_id: typing.Optional[str] = None,
|
|
73
|
+
name: str,
|
|
73
74
|
pipeline_id: str,
|
|
74
75
|
llm_config: LlmParameters,
|
|
75
76
|
retrieval_config: PresetRetrievalParams,
|
|
@@ -83,6 +84,8 @@ class ChatAppsClient:
|
|
|
83
84
|
|
|
84
85
|
- organization_id: typing.Optional[str].
|
|
85
86
|
|
|
87
|
+
- name: str.
|
|
88
|
+
|
|
86
89
|
- pipeline_id: str.
|
|
87
90
|
|
|
88
91
|
- llm_config: LlmParameters.
|
|
@@ -105,6 +108,7 @@ class ChatAppsClient:
|
|
|
105
108
|
token="YOUR_TOKEN",
|
|
106
109
|
)
|
|
107
110
|
client.chat_apps.create_chat_app_api_v_1_apps_post(
|
|
111
|
+
name="string",
|
|
108
112
|
pipeline_id="string",
|
|
109
113
|
llm_config=LlmParameters(
|
|
110
114
|
model_name=SupportedLlmModelNames.GPT_3_5_TURBO,
|
|
@@ -125,6 +129,7 @@ class ChatAppsClient:
|
|
|
125
129
|
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
126
130
|
json=jsonable_encoder(
|
|
127
131
|
{
|
|
132
|
+
"name": name,
|
|
128
133
|
"pipeline_id": pipeline_id,
|
|
129
134
|
"llm_config": llm_config,
|
|
130
135
|
"retrieval_config": retrieval_config,
|
|
@@ -365,6 +370,7 @@ class AsyncChatAppsClient:
|
|
|
365
370
|
*,
|
|
366
371
|
project_id: typing.Optional[str] = None,
|
|
367
372
|
organization_id: typing.Optional[str] = None,
|
|
373
|
+
name: str,
|
|
368
374
|
pipeline_id: str,
|
|
369
375
|
llm_config: LlmParameters,
|
|
370
376
|
retrieval_config: PresetRetrievalParams,
|
|
@@ -378,6 +384,8 @@ class AsyncChatAppsClient:
|
|
|
378
384
|
|
|
379
385
|
- organization_id: typing.Optional[str].
|
|
380
386
|
|
|
387
|
+
- name: str.
|
|
388
|
+
|
|
381
389
|
- pipeline_id: str.
|
|
382
390
|
|
|
383
391
|
- llm_config: LlmParameters.
|
|
@@ -400,6 +408,7 @@ class AsyncChatAppsClient:
|
|
|
400
408
|
token="YOUR_TOKEN",
|
|
401
409
|
)
|
|
402
410
|
await client.chat_apps.create_chat_app_api_v_1_apps_post(
|
|
411
|
+
name="string",
|
|
403
412
|
pipeline_id="string",
|
|
404
413
|
llm_config=LlmParameters(
|
|
405
414
|
model_name=SupportedLlmModelNames.GPT_3_5_TURBO,
|
|
@@ -420,6 +429,7 @@ class AsyncChatAppsClient:
|
|
|
420
429
|
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
421
430
|
json=jsonable_encoder(
|
|
422
431
|
{
|
|
432
|
+
"name": name,
|
|
423
433
|
"pipeline_id": pipeline_id,
|
|
424
434
|
"llm_config": llm_config,
|
|
425
435
|
"retrieval_config": retrieval_config,
|
|
@@ -12,6 +12,7 @@ from ...core.remove_none_from_dict import remove_none_from_dict
|
|
|
12
12
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
13
13
|
from ...types.file import File
|
|
14
14
|
from ...types.http_validation_error import HttpValidationError
|
|
15
|
+
from ...types.page_figure_metadata import PageFigureMetadata
|
|
15
16
|
from ...types.page_screenshot_metadata import PageScreenshotMetadata
|
|
16
17
|
from ...types.presigned_url import PresignedUrl
|
|
17
18
|
from .types.file_create_from_url_resource_info_value import FileCreateFromUrlResourceInfoValue
|
|
@@ -186,6 +187,7 @@ class FilesClient:
|
|
|
186
187
|
def generate_presigned_url(
|
|
187
188
|
self,
|
|
188
189
|
*,
|
|
190
|
+
expires_at_seconds: typing.Optional[int] = None,
|
|
189
191
|
project_id: typing.Optional[str] = None,
|
|
190
192
|
organization_id: typing.Optional[str] = None,
|
|
191
193
|
name: str,
|
|
@@ -200,6 +202,8 @@ class FilesClient:
|
|
|
200
202
|
Create a presigned url for uploading a file.
|
|
201
203
|
|
|
202
204
|
Parameters:
|
|
205
|
+
- expires_at_seconds: typing.Optional[int].
|
|
206
|
+
|
|
203
207
|
- project_id: typing.Optional[str].
|
|
204
208
|
|
|
205
209
|
- organization_id: typing.Optional[str].
|
|
@@ -243,7 +247,9 @@ class FilesClient:
|
|
|
243
247
|
_response = self._client_wrapper.httpx_client.request(
|
|
244
248
|
"PUT",
|
|
245
249
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/files"),
|
|
246
|
-
params=remove_none_from_dict(
|
|
250
|
+
params=remove_none_from_dict(
|
|
251
|
+
{"expires_at_seconds": expires_at_seconds, "project_id": project_id, "organization_id": organization_id}
|
|
252
|
+
),
|
|
247
253
|
json=jsonable_encoder(_request),
|
|
248
254
|
headers=self._client_wrapper.get_headers(),
|
|
249
255
|
timeout=60,
|
|
@@ -369,7 +375,12 @@ class FilesClient:
|
|
|
369
375
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
370
376
|
|
|
371
377
|
def read_file_content(
|
|
372
|
-
self,
|
|
378
|
+
self,
|
|
379
|
+
id: str,
|
|
380
|
+
*,
|
|
381
|
+
expires_at_seconds: typing.Optional[int] = None,
|
|
382
|
+
project_id: typing.Optional[str] = None,
|
|
383
|
+
organization_id: typing.Optional[str] = None,
|
|
373
384
|
) -> PresignedUrl:
|
|
374
385
|
"""
|
|
375
386
|
Returns a presigned url to read the file content.
|
|
@@ -377,6 +388,8 @@ class FilesClient:
|
|
|
377
388
|
Parameters:
|
|
378
389
|
- id: str.
|
|
379
390
|
|
|
391
|
+
- expires_at_seconds: typing.Optional[int].
|
|
392
|
+
|
|
380
393
|
- project_id: typing.Optional[str].
|
|
381
394
|
|
|
382
395
|
- organization_id: typing.Optional[str].
|
|
@@ -393,7 +406,9 @@ class FilesClient:
|
|
|
393
406
|
_response = self._client_wrapper.httpx_client.request(
|
|
394
407
|
"GET",
|
|
395
408
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/content"),
|
|
396
|
-
params=remove_none_from_dict(
|
|
409
|
+
params=remove_none_from_dict(
|
|
410
|
+
{"expires_at_seconds": expires_at_seconds, "project_id": project_id, "organization_id": organization_id}
|
|
411
|
+
),
|
|
397
412
|
headers=self._client_wrapper.get_headers(),
|
|
398
413
|
timeout=60,
|
|
399
414
|
)
|
|
@@ -495,6 +510,141 @@ class FilesClient:
|
|
|
495
510
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
496
511
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
497
512
|
|
|
513
|
+
def list_file_pages_figures(
|
|
514
|
+
self, id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
515
|
+
) -> typing.List[PageFigureMetadata]:
|
|
516
|
+
"""
|
|
517
|
+
Parameters:
|
|
518
|
+
- id: str.
|
|
519
|
+
|
|
520
|
+
- project_id: typing.Optional[str].
|
|
521
|
+
|
|
522
|
+
- organization_id: typing.Optional[str].
|
|
523
|
+
---
|
|
524
|
+
from llama_cloud.client import LlamaCloud
|
|
525
|
+
|
|
526
|
+
client = LlamaCloud(
|
|
527
|
+
token="YOUR_TOKEN",
|
|
528
|
+
)
|
|
529
|
+
client.files.list_file_pages_figures(
|
|
530
|
+
id="string",
|
|
531
|
+
)
|
|
532
|
+
"""
|
|
533
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
534
|
+
"GET",
|
|
535
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/page-figures"),
|
|
536
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
537
|
+
headers=self._client_wrapper.get_headers(),
|
|
538
|
+
timeout=60,
|
|
539
|
+
)
|
|
540
|
+
if 200 <= _response.status_code < 300:
|
|
541
|
+
return pydantic.parse_obj_as(typing.List[PageFigureMetadata], _response.json()) # type: ignore
|
|
542
|
+
if _response.status_code == 422:
|
|
543
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
544
|
+
try:
|
|
545
|
+
_response_json = _response.json()
|
|
546
|
+
except JSONDecodeError:
|
|
547
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
548
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
549
|
+
|
|
550
|
+
def list_file_page_figures(
|
|
551
|
+
self,
|
|
552
|
+
id: str,
|
|
553
|
+
page_index: int,
|
|
554
|
+
*,
|
|
555
|
+
project_id: typing.Optional[str] = None,
|
|
556
|
+
organization_id: typing.Optional[str] = None,
|
|
557
|
+
) -> typing.List[PageFigureMetadata]:
|
|
558
|
+
"""
|
|
559
|
+
Parameters:
|
|
560
|
+
- id: str.
|
|
561
|
+
|
|
562
|
+
- page_index: int.
|
|
563
|
+
|
|
564
|
+
- project_id: typing.Optional[str].
|
|
565
|
+
|
|
566
|
+
- organization_id: typing.Optional[str].
|
|
567
|
+
---
|
|
568
|
+
from llama_cloud.client import LlamaCloud
|
|
569
|
+
|
|
570
|
+
client = LlamaCloud(
|
|
571
|
+
token="YOUR_TOKEN",
|
|
572
|
+
)
|
|
573
|
+
client.files.list_file_page_figures(
|
|
574
|
+
id="string",
|
|
575
|
+
page_index=1,
|
|
576
|
+
)
|
|
577
|
+
"""
|
|
578
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
579
|
+
"GET",
|
|
580
|
+
urllib.parse.urljoin(
|
|
581
|
+
f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/page-figures/{page_index}"
|
|
582
|
+
),
|
|
583
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
584
|
+
headers=self._client_wrapper.get_headers(),
|
|
585
|
+
timeout=60,
|
|
586
|
+
)
|
|
587
|
+
if 200 <= _response.status_code < 300:
|
|
588
|
+
return pydantic.parse_obj_as(typing.List[PageFigureMetadata], _response.json()) # type: ignore
|
|
589
|
+
if _response.status_code == 422:
|
|
590
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
591
|
+
try:
|
|
592
|
+
_response_json = _response.json()
|
|
593
|
+
except JSONDecodeError:
|
|
594
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
595
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
596
|
+
|
|
597
|
+
def get_file_page_figure(
|
|
598
|
+
self,
|
|
599
|
+
id: str,
|
|
600
|
+
page_index: int,
|
|
601
|
+
figure_name: str,
|
|
602
|
+
*,
|
|
603
|
+
project_id: typing.Optional[str] = None,
|
|
604
|
+
organization_id: typing.Optional[str] = None,
|
|
605
|
+
) -> typing.Any:
|
|
606
|
+
"""
|
|
607
|
+
Parameters:
|
|
608
|
+
- id: str.
|
|
609
|
+
|
|
610
|
+
- page_index: int.
|
|
611
|
+
|
|
612
|
+
- figure_name: str.
|
|
613
|
+
|
|
614
|
+
- project_id: typing.Optional[str].
|
|
615
|
+
|
|
616
|
+
- organization_id: typing.Optional[str].
|
|
617
|
+
---
|
|
618
|
+
from llama_cloud.client import LlamaCloud
|
|
619
|
+
|
|
620
|
+
client = LlamaCloud(
|
|
621
|
+
token="YOUR_TOKEN",
|
|
622
|
+
)
|
|
623
|
+
client.files.get_file_page_figure(
|
|
624
|
+
id="string",
|
|
625
|
+
page_index=1,
|
|
626
|
+
figure_name="string",
|
|
627
|
+
)
|
|
628
|
+
"""
|
|
629
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
630
|
+
"GET",
|
|
631
|
+
urllib.parse.urljoin(
|
|
632
|
+
f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/page-figures/{page_index}/{figure_name}"
|
|
633
|
+
),
|
|
634
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
635
|
+
headers=self._client_wrapper.get_headers(),
|
|
636
|
+
timeout=60,
|
|
637
|
+
)
|
|
638
|
+
if 200 <= _response.status_code < 300:
|
|
639
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
640
|
+
if _response.status_code == 422:
|
|
641
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
642
|
+
try:
|
|
643
|
+
_response_json = _response.json()
|
|
644
|
+
except JSONDecodeError:
|
|
645
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
646
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
647
|
+
|
|
498
648
|
|
|
499
649
|
class AsyncFilesClient:
|
|
500
650
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -652,6 +802,7 @@ class AsyncFilesClient:
|
|
|
652
802
|
async def generate_presigned_url(
|
|
653
803
|
self,
|
|
654
804
|
*,
|
|
805
|
+
expires_at_seconds: typing.Optional[int] = None,
|
|
655
806
|
project_id: typing.Optional[str] = None,
|
|
656
807
|
organization_id: typing.Optional[str] = None,
|
|
657
808
|
name: str,
|
|
@@ -666,6 +817,8 @@ class AsyncFilesClient:
|
|
|
666
817
|
Create a presigned url for uploading a file.
|
|
667
818
|
|
|
668
819
|
Parameters:
|
|
820
|
+
- expires_at_seconds: typing.Optional[int].
|
|
821
|
+
|
|
669
822
|
- project_id: typing.Optional[str].
|
|
670
823
|
|
|
671
824
|
- organization_id: typing.Optional[str].
|
|
@@ -709,7 +862,9 @@ class AsyncFilesClient:
|
|
|
709
862
|
_response = await self._client_wrapper.httpx_client.request(
|
|
710
863
|
"PUT",
|
|
711
864
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/files"),
|
|
712
|
-
params=remove_none_from_dict(
|
|
865
|
+
params=remove_none_from_dict(
|
|
866
|
+
{"expires_at_seconds": expires_at_seconds, "project_id": project_id, "organization_id": organization_id}
|
|
867
|
+
),
|
|
713
868
|
json=jsonable_encoder(_request),
|
|
714
869
|
headers=self._client_wrapper.get_headers(),
|
|
715
870
|
timeout=60,
|
|
@@ -835,7 +990,12 @@ class AsyncFilesClient:
|
|
|
835
990
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
836
991
|
|
|
837
992
|
async def read_file_content(
|
|
838
|
-
self,
|
|
993
|
+
self,
|
|
994
|
+
id: str,
|
|
995
|
+
*,
|
|
996
|
+
expires_at_seconds: typing.Optional[int] = None,
|
|
997
|
+
project_id: typing.Optional[str] = None,
|
|
998
|
+
organization_id: typing.Optional[str] = None,
|
|
839
999
|
) -> PresignedUrl:
|
|
840
1000
|
"""
|
|
841
1001
|
Returns a presigned url to read the file content.
|
|
@@ -843,6 +1003,8 @@ class AsyncFilesClient:
|
|
|
843
1003
|
Parameters:
|
|
844
1004
|
- id: str.
|
|
845
1005
|
|
|
1006
|
+
- expires_at_seconds: typing.Optional[int].
|
|
1007
|
+
|
|
846
1008
|
- project_id: typing.Optional[str].
|
|
847
1009
|
|
|
848
1010
|
- organization_id: typing.Optional[str].
|
|
@@ -859,7 +1021,9 @@ class AsyncFilesClient:
|
|
|
859
1021
|
_response = await self._client_wrapper.httpx_client.request(
|
|
860
1022
|
"GET",
|
|
861
1023
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/content"),
|
|
862
|
-
params=remove_none_from_dict(
|
|
1024
|
+
params=remove_none_from_dict(
|
|
1025
|
+
{"expires_at_seconds": expires_at_seconds, "project_id": project_id, "organization_id": organization_id}
|
|
1026
|
+
),
|
|
863
1027
|
headers=self._client_wrapper.get_headers(),
|
|
864
1028
|
timeout=60,
|
|
865
1029
|
)
|
|
@@ -960,3 +1124,138 @@ class AsyncFilesClient:
|
|
|
960
1124
|
except JSONDecodeError:
|
|
961
1125
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
962
1126
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1127
|
+
|
|
1128
|
+
async def list_file_pages_figures(
|
|
1129
|
+
self, id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
|
|
1130
|
+
) -> typing.List[PageFigureMetadata]:
|
|
1131
|
+
"""
|
|
1132
|
+
Parameters:
|
|
1133
|
+
- id: str.
|
|
1134
|
+
|
|
1135
|
+
- project_id: typing.Optional[str].
|
|
1136
|
+
|
|
1137
|
+
- organization_id: typing.Optional[str].
|
|
1138
|
+
---
|
|
1139
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1140
|
+
|
|
1141
|
+
client = AsyncLlamaCloud(
|
|
1142
|
+
token="YOUR_TOKEN",
|
|
1143
|
+
)
|
|
1144
|
+
await client.files.list_file_pages_figures(
|
|
1145
|
+
id="string",
|
|
1146
|
+
)
|
|
1147
|
+
"""
|
|
1148
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1149
|
+
"GET",
|
|
1150
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/page-figures"),
|
|
1151
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1152
|
+
headers=self._client_wrapper.get_headers(),
|
|
1153
|
+
timeout=60,
|
|
1154
|
+
)
|
|
1155
|
+
if 200 <= _response.status_code < 300:
|
|
1156
|
+
return pydantic.parse_obj_as(typing.List[PageFigureMetadata], _response.json()) # type: ignore
|
|
1157
|
+
if _response.status_code == 422:
|
|
1158
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1159
|
+
try:
|
|
1160
|
+
_response_json = _response.json()
|
|
1161
|
+
except JSONDecodeError:
|
|
1162
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1163
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1164
|
+
|
|
1165
|
+
async def list_file_page_figures(
|
|
1166
|
+
self,
|
|
1167
|
+
id: str,
|
|
1168
|
+
page_index: int,
|
|
1169
|
+
*,
|
|
1170
|
+
project_id: typing.Optional[str] = None,
|
|
1171
|
+
organization_id: typing.Optional[str] = None,
|
|
1172
|
+
) -> typing.List[PageFigureMetadata]:
|
|
1173
|
+
"""
|
|
1174
|
+
Parameters:
|
|
1175
|
+
- id: str.
|
|
1176
|
+
|
|
1177
|
+
- page_index: int.
|
|
1178
|
+
|
|
1179
|
+
- project_id: typing.Optional[str].
|
|
1180
|
+
|
|
1181
|
+
- organization_id: typing.Optional[str].
|
|
1182
|
+
---
|
|
1183
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1184
|
+
|
|
1185
|
+
client = AsyncLlamaCloud(
|
|
1186
|
+
token="YOUR_TOKEN",
|
|
1187
|
+
)
|
|
1188
|
+
await client.files.list_file_page_figures(
|
|
1189
|
+
id="string",
|
|
1190
|
+
page_index=1,
|
|
1191
|
+
)
|
|
1192
|
+
"""
|
|
1193
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1194
|
+
"GET",
|
|
1195
|
+
urllib.parse.urljoin(
|
|
1196
|
+
f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/page-figures/{page_index}"
|
|
1197
|
+
),
|
|
1198
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1199
|
+
headers=self._client_wrapper.get_headers(),
|
|
1200
|
+
timeout=60,
|
|
1201
|
+
)
|
|
1202
|
+
if 200 <= _response.status_code < 300:
|
|
1203
|
+
return pydantic.parse_obj_as(typing.List[PageFigureMetadata], _response.json()) # type: ignore
|
|
1204
|
+
if _response.status_code == 422:
|
|
1205
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1206
|
+
try:
|
|
1207
|
+
_response_json = _response.json()
|
|
1208
|
+
except JSONDecodeError:
|
|
1209
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1210
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1211
|
+
|
|
1212
|
+
async def get_file_page_figure(
|
|
1213
|
+
self,
|
|
1214
|
+
id: str,
|
|
1215
|
+
page_index: int,
|
|
1216
|
+
figure_name: str,
|
|
1217
|
+
*,
|
|
1218
|
+
project_id: typing.Optional[str] = None,
|
|
1219
|
+
organization_id: typing.Optional[str] = None,
|
|
1220
|
+
) -> typing.Any:
|
|
1221
|
+
"""
|
|
1222
|
+
Parameters:
|
|
1223
|
+
- id: str.
|
|
1224
|
+
|
|
1225
|
+
- page_index: int.
|
|
1226
|
+
|
|
1227
|
+
- figure_name: str.
|
|
1228
|
+
|
|
1229
|
+
- project_id: typing.Optional[str].
|
|
1230
|
+
|
|
1231
|
+
- organization_id: typing.Optional[str].
|
|
1232
|
+
---
|
|
1233
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
1234
|
+
|
|
1235
|
+
client = AsyncLlamaCloud(
|
|
1236
|
+
token="YOUR_TOKEN",
|
|
1237
|
+
)
|
|
1238
|
+
await client.files.get_file_page_figure(
|
|
1239
|
+
id="string",
|
|
1240
|
+
page_index=1,
|
|
1241
|
+
figure_name="string",
|
|
1242
|
+
)
|
|
1243
|
+
"""
|
|
1244
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1245
|
+
"GET",
|
|
1246
|
+
urllib.parse.urljoin(
|
|
1247
|
+
f"{self._client_wrapper.get_base_url()}/", f"api/v1/files/{id}/page-figures/{page_index}/{figure_name}"
|
|
1248
|
+
),
|
|
1249
|
+
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
1250
|
+
headers=self._client_wrapper.get_headers(),
|
|
1251
|
+
timeout=60,
|
|
1252
|
+
)
|
|
1253
|
+
if 200 <= _response.status_code < 300:
|
|
1254
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
1255
|
+
if _response.status_code == 422:
|
|
1256
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1257
|
+
try:
|
|
1258
|
+
_response_json = _response.json()
|
|
1259
|
+
except JSONDecodeError:
|
|
1260
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1261
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|