llama-cloud 0.0.9__py3-none-any.whl → 0.0.11__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 +22 -2
- llama_cloud/resources/__init__.py +2 -1
- llama_cloud/resources/data_sources/types/data_source_update_component_one.py +2 -0
- llama_cloud/resources/extraction/__init__.py +2 -2
- llama_cloud/resources/extraction/client.py +172 -48
- llama_cloud/resources/extraction/types/__init__.py +2 -1
- llama_cloud/resources/extraction/types/extraction_schema_create_data_schema_value.py +7 -0
- llama_cloud/resources/organizations/client.py +81 -0
- llama_cloud/resources/parsing/client.py +104 -0
- llama_cloud/resources/pipelines/client.py +315 -43
- llama_cloud/types/__init__.py +20 -2
- llama_cloud/types/auto_transform_config.py +32 -0
- llama_cloud/types/{chat_params.py → chat_data.py} +3 -3
- llama_cloud/types/cloud_azure_ai_search_vector_store.py +1 -1
- llama_cloud/types/cloud_confluence_data_source.py +45 -0
- llama_cloud/types/configurable_data_source_names.py +4 -0
- llama_cloud/types/data_source_component_one.py +2 -0
- llama_cloud/types/data_source_create_component_one.py +2 -0
- llama_cloud/types/embedding_config.py +36 -0
- llama_cloud/types/embedding_config_component.py +19 -0
- llama_cloud/types/embedding_config_type.py +41 -0
- llama_cloud/types/extraction_job.py +35 -0
- llama_cloud/types/extraction_schema.py +1 -1
- llama_cloud/types/llama_parse_parameters.py +5 -0
- llama_cloud/types/pipeline.py +0 -3
- llama_cloud/types/pipeline_create.py +8 -3
- llama_cloud/types/pipeline_data_source_component_one.py +2 -0
- llama_cloud/types/transform_config.py +36 -0
- llama_cloud/types/transform_config_mode.py +21 -0
- llama_cloud/types/user_organization.py +10 -1
- llama_cloud/types/user_organization_delete.py +36 -0
- {llama_cloud-0.0.9.dist-info → llama_cloud-0.0.11.dist-info}/METADATA +1 -1
- {llama_cloud-0.0.9.dist-info → llama_cloud-0.0.11.dist-info}/RECORD +35 -25
- {llama_cloud-0.0.9.dist-info → llama_cloud-0.0.11.dist-info}/WHEEL +1 -1
- {llama_cloud-0.0.9.dist-info → llama_cloud-0.0.11.dist-info}/LICENSE +0 -0
|
@@ -9,11 +9,13 @@ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
|
9
9
|
from ...core.jsonable_encoder import jsonable_encoder
|
|
10
10
|
from ...core.remove_none_from_dict import remove_none_from_dict
|
|
11
11
|
from ...errors.unprocessable_entity_error import UnprocessableEntityError
|
|
12
|
-
from ...types.
|
|
12
|
+
from ...types.chat_data import ChatData
|
|
13
|
+
from ...types.chat_message import ChatMessage
|
|
13
14
|
from ...types.cloud_document import CloudDocument
|
|
14
15
|
from ...types.cloud_document_create import CloudDocumentCreate
|
|
15
16
|
from ...types.configured_transformation_item import ConfiguredTransformationItem
|
|
16
17
|
from ...types.data_sink_create import DataSinkCreate
|
|
18
|
+
from ...types.embedding_config import EmbeddingConfig
|
|
17
19
|
from ...types.eval_dataset_job_record import EvalDatasetJobRecord
|
|
18
20
|
from ...types.eval_execution_params import EvalExecutionParams
|
|
19
21
|
from ...types.eval_execution_params_override import EvalExecutionParamsOverride
|
|
@@ -33,6 +35,8 @@ from ...types.pipeline_type import PipelineType
|
|
|
33
35
|
from ...types.preset_retrieval_params import PresetRetrievalParams
|
|
34
36
|
from ...types.retrieval_mode import RetrievalMode
|
|
35
37
|
from ...types.retrieve_results import RetrieveResults
|
|
38
|
+
from ...types.text_node import TextNode
|
|
39
|
+
from ...types.transform_config import TransformConfig
|
|
36
40
|
from .types.pipeline_file_update_custom_metadata_value import PipelineFileUpdateCustomMetadataValue
|
|
37
41
|
|
|
38
42
|
try:
|
|
@@ -115,8 +119,11 @@ class PipelinesClient:
|
|
|
115
119
|
- request: PipelineCreate.
|
|
116
120
|
---
|
|
117
121
|
from llama_cloud import (
|
|
122
|
+
AutoTransformConfig,
|
|
118
123
|
ConfigurableDataSinkNames,
|
|
119
124
|
DataSinkCreate,
|
|
125
|
+
EmbeddingConfig,
|
|
126
|
+
EmbeddingConfigType,
|
|
120
127
|
EvalExecutionParams,
|
|
121
128
|
FilterCondition,
|
|
122
129
|
LlamaParseParameters,
|
|
@@ -126,6 +133,8 @@ class PipelinesClient:
|
|
|
126
133
|
PresetRetrievalParams,
|
|
127
134
|
RetrievalMode,
|
|
128
135
|
SupportedEvalLlmModelNames,
|
|
136
|
+
TransformConfig,
|
|
137
|
+
TransformConfigMode,
|
|
129
138
|
)
|
|
130
139
|
from llama_cloud.client import LlamaCloud
|
|
131
140
|
|
|
@@ -134,6 +143,13 @@ class PipelinesClient:
|
|
|
134
143
|
)
|
|
135
144
|
client.pipelines.create_pipeline(
|
|
136
145
|
request=PipelineCreate(
|
|
146
|
+
embedding_config=EmbeddingConfig(
|
|
147
|
+
type=EmbeddingConfigType.OPENAI_EMBEDDING,
|
|
148
|
+
),
|
|
149
|
+
transform_config=TransformConfig(
|
|
150
|
+
mode=TransformConfigMode.AUTO,
|
|
151
|
+
config=AutoTransformConfig(),
|
|
152
|
+
),
|
|
137
153
|
data_sink=DataSinkCreate(
|
|
138
154
|
name="string",
|
|
139
155
|
sink_type=ConfigurableDataSinkNames.CHROMA,
|
|
@@ -183,8 +199,11 @@ class PipelinesClient:
|
|
|
183
199
|
- request: PipelineCreate.
|
|
184
200
|
---
|
|
185
201
|
from llama_cloud import (
|
|
202
|
+
AutoTransformConfig,
|
|
186
203
|
ConfigurableDataSinkNames,
|
|
187
204
|
DataSinkCreate,
|
|
205
|
+
EmbeddingConfig,
|
|
206
|
+
EmbeddingConfigType,
|
|
188
207
|
EvalExecutionParams,
|
|
189
208
|
FilterCondition,
|
|
190
209
|
LlamaParseParameters,
|
|
@@ -194,6 +213,8 @@ class PipelinesClient:
|
|
|
194
213
|
PresetRetrievalParams,
|
|
195
214
|
RetrievalMode,
|
|
196
215
|
SupportedEvalLlmModelNames,
|
|
216
|
+
TransformConfig,
|
|
217
|
+
TransformConfigMode,
|
|
197
218
|
)
|
|
198
219
|
from llama_cloud.client import LlamaCloud
|
|
199
220
|
|
|
@@ -202,6 +223,13 @@ class PipelinesClient:
|
|
|
202
223
|
)
|
|
203
224
|
client.pipelines.upsert_pipeline(
|
|
204
225
|
request=PipelineCreate(
|
|
226
|
+
embedding_config=EmbeddingConfig(
|
|
227
|
+
type=EmbeddingConfigType.OPENAI_EMBEDDING,
|
|
228
|
+
),
|
|
229
|
+
transform_config=TransformConfig(
|
|
230
|
+
mode=TransformConfigMode.AUTO,
|
|
231
|
+
config=AutoTransformConfig(),
|
|
232
|
+
),
|
|
205
233
|
data_sink=DataSinkCreate(
|
|
206
234
|
name="string",
|
|
207
235
|
sink_type=ConfigurableDataSinkNames.CHROMA,
|
|
@@ -276,12 +304,13 @@ class PipelinesClient:
|
|
|
276
304
|
self,
|
|
277
305
|
pipeline_id: str,
|
|
278
306
|
*,
|
|
307
|
+
embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
|
|
308
|
+
transform_config: typing.Optional[TransformConfig] = OMIT,
|
|
279
309
|
configured_transformations: typing.Optional[typing.List[ConfiguredTransformationItem]] = OMIT,
|
|
280
310
|
data_sink_id: typing.Optional[str] = OMIT,
|
|
281
311
|
data_sink: typing.Optional[DataSinkCreate] = OMIT,
|
|
282
312
|
preset_retrieval_parameters: typing.Optional[PresetRetrievalParams] = OMIT,
|
|
283
313
|
eval_parameters: typing.Optional[EvalExecutionParams] = OMIT,
|
|
284
|
-
llama_parse_enabled: typing.Optional[bool] = OMIT,
|
|
285
314
|
llama_parse_parameters: typing.Optional[LlamaParseParameters] = OMIT,
|
|
286
315
|
name: typing.Optional[str] = OMIT,
|
|
287
316
|
managed_pipeline_id: typing.Optional[str] = OMIT,
|
|
@@ -292,7 +321,11 @@ class PipelinesClient:
|
|
|
292
321
|
Parameters:
|
|
293
322
|
- pipeline_id: str.
|
|
294
323
|
|
|
295
|
-
-
|
|
324
|
+
- embedding_config: typing.Optional[EmbeddingConfig]. Configuration for the embedding model.
|
|
325
|
+
|
|
326
|
+
- transform_config: typing.Optional[TransformConfig]. Configuration for the transformation.
|
|
327
|
+
|
|
328
|
+
- configured_transformations: typing.Optional[typing.List[ConfiguredTransformationItem]]. List of configured transformations.
|
|
296
329
|
|
|
297
330
|
- data_sink_id: typing.Optional[str]. Data sink ID. When provided instead of data_sink, the data sink will be looked up by ID.
|
|
298
331
|
|
|
@@ -302,8 +335,6 @@ class PipelinesClient:
|
|
|
302
335
|
|
|
303
336
|
- eval_parameters: typing.Optional[EvalExecutionParams]. Eval parameters for the pipeline.
|
|
304
337
|
|
|
305
|
-
- llama_parse_enabled: typing.Optional[bool]. Whether to use LlamaParse during pipeline execution.
|
|
306
|
-
|
|
307
338
|
- llama_parse_parameters: typing.Optional[LlamaParseParameters]. Settings that can be configured for how to use LlamaParse to parse files within a LlamaCloud pipeline.
|
|
308
339
|
|
|
309
340
|
- name: typing.Optional[str].
|
|
@@ -311,8 +342,11 @@ class PipelinesClient:
|
|
|
311
342
|
- managed_pipeline_id: typing.Optional[str]. The ID of the ManagedPipeline this playground pipeline is linked to.
|
|
312
343
|
---
|
|
313
344
|
from llama_cloud import (
|
|
345
|
+
AutoTransformConfig,
|
|
314
346
|
ConfigurableDataSinkNames,
|
|
315
347
|
DataSinkCreate,
|
|
348
|
+
EmbeddingConfig,
|
|
349
|
+
EmbeddingConfigType,
|
|
316
350
|
EvalExecutionParams,
|
|
317
351
|
FilterCondition,
|
|
318
352
|
LlamaParseParameters,
|
|
@@ -320,6 +354,8 @@ class PipelinesClient:
|
|
|
320
354
|
PresetRetrievalParams,
|
|
321
355
|
RetrievalMode,
|
|
322
356
|
SupportedEvalLlmModelNames,
|
|
357
|
+
TransformConfig,
|
|
358
|
+
TransformConfigMode,
|
|
323
359
|
)
|
|
324
360
|
from llama_cloud.client import LlamaCloud
|
|
325
361
|
|
|
@@ -328,6 +364,13 @@ class PipelinesClient:
|
|
|
328
364
|
)
|
|
329
365
|
client.pipelines.update_existing_pipeline(
|
|
330
366
|
pipeline_id="string",
|
|
367
|
+
embedding_config=EmbeddingConfig(
|
|
368
|
+
type=EmbeddingConfigType.OPENAI_EMBEDDING,
|
|
369
|
+
),
|
|
370
|
+
transform_config=TransformConfig(
|
|
371
|
+
mode=TransformConfigMode.AUTO,
|
|
372
|
+
config=AutoTransformConfig(),
|
|
373
|
+
),
|
|
331
374
|
data_sink=DataSinkCreate(
|
|
332
375
|
name="string",
|
|
333
376
|
sink_type=ConfigurableDataSinkNames.CHROMA,
|
|
@@ -346,6 +389,10 @@ class PipelinesClient:
|
|
|
346
389
|
)
|
|
347
390
|
"""
|
|
348
391
|
_request: typing.Dict[str, typing.Any] = {}
|
|
392
|
+
if embedding_config is not OMIT:
|
|
393
|
+
_request["embedding_config"] = embedding_config
|
|
394
|
+
if transform_config is not OMIT:
|
|
395
|
+
_request["transform_config"] = transform_config
|
|
349
396
|
if configured_transformations is not OMIT:
|
|
350
397
|
_request["configured_transformations"] = configured_transformations
|
|
351
398
|
if data_sink_id is not OMIT:
|
|
@@ -356,8 +403,6 @@ class PipelinesClient:
|
|
|
356
403
|
_request["preset_retrieval_parameters"] = preset_retrieval_parameters
|
|
357
404
|
if eval_parameters is not OMIT:
|
|
358
405
|
_request["eval_parameters"] = eval_parameters
|
|
359
|
-
if llama_parse_enabled is not OMIT:
|
|
360
|
-
_request["llama_parse_enabled"] = llama_parse_enabled
|
|
361
406
|
if llama_parse_parameters is not OMIT:
|
|
362
407
|
_request["llama_parse_parameters"] = llama_parse_parameters
|
|
363
408
|
if name is not OMIT:
|
|
@@ -477,6 +522,38 @@ class PipelinesClient:
|
|
|
477
522
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
478
523
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
479
524
|
|
|
525
|
+
def copy_pipeline(self, pipeline_id: str) -> Pipeline:
|
|
526
|
+
"""
|
|
527
|
+
Copy a pipeline by ID.
|
|
528
|
+
|
|
529
|
+
Parameters:
|
|
530
|
+
- pipeline_id: str.
|
|
531
|
+
---
|
|
532
|
+
from llama_cloud.client import LlamaCloud
|
|
533
|
+
|
|
534
|
+
client = LlamaCloud(
|
|
535
|
+
token="YOUR_TOKEN",
|
|
536
|
+
)
|
|
537
|
+
client.pipelines.copy_pipeline(
|
|
538
|
+
pipeline_id="string",
|
|
539
|
+
)
|
|
540
|
+
"""
|
|
541
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
542
|
+
"POST",
|
|
543
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/pipelines/{pipeline_id}/copy"),
|
|
544
|
+
headers=self._client_wrapper.get_headers(),
|
|
545
|
+
timeout=60,
|
|
546
|
+
)
|
|
547
|
+
if 200 <= _response.status_code < 300:
|
|
548
|
+
return pydantic.parse_obj_as(Pipeline, _response.json()) # type: ignore
|
|
549
|
+
if _response.status_code == 422:
|
|
550
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
551
|
+
try:
|
|
552
|
+
_response_json = _response.json()
|
|
553
|
+
except JSONDecodeError:
|
|
554
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
555
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
556
|
+
|
|
480
557
|
def get_eval_dataset_executions(self, pipeline_id: str, eval_dataset_id: str) -> typing.List[EvalDatasetJobRecord]:
|
|
481
558
|
"""
|
|
482
559
|
Get the status of an EvalDatasetExecution.
|
|
@@ -1231,17 +1308,26 @@ class PipelinesClient:
|
|
|
1231
1308
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1232
1309
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1233
1310
|
|
|
1234
|
-
def chat(
|
|
1311
|
+
def chat(
|
|
1312
|
+
self,
|
|
1313
|
+
pipeline_id: str,
|
|
1314
|
+
*,
|
|
1315
|
+
messages: typing.List[ChatMessage],
|
|
1316
|
+
data: ChatData,
|
|
1317
|
+
class_name: typing.Optional[str] = OMIT,
|
|
1318
|
+
) -> typing.Any:
|
|
1235
1319
|
"""
|
|
1236
1320
|
Parameters:
|
|
1237
1321
|
- pipeline_id: str.
|
|
1238
1322
|
|
|
1239
|
-
-
|
|
1323
|
+
- messages: typing.List[ChatMessage].
|
|
1324
|
+
|
|
1325
|
+
- data: ChatData.
|
|
1240
1326
|
|
|
1241
|
-
-
|
|
1327
|
+
- class_name: typing.Optional[str].
|
|
1242
1328
|
---
|
|
1243
1329
|
from llama_cloud import (
|
|
1244
|
-
|
|
1330
|
+
ChatData,
|
|
1245
1331
|
FilterCondition,
|
|
1246
1332
|
MetadataFilters,
|
|
1247
1333
|
PresetRetrievalParams,
|
|
@@ -1254,22 +1340,25 @@ class PipelinesClient:
|
|
|
1254
1340
|
)
|
|
1255
1341
|
client.pipelines.chat(
|
|
1256
1342
|
pipeline_id="string",
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1343
|
+
messages=[],
|
|
1344
|
+
data=ChatData(
|
|
1345
|
+
retrieval_parameters=PresetRetrievalParams(
|
|
1346
|
+
search_filters=MetadataFilters(
|
|
1347
|
+
filters=[],
|
|
1348
|
+
condition=FilterCondition.AND,
|
|
1349
|
+
),
|
|
1350
|
+
retrieval_mode=RetrievalMode.CHUNKS,
|
|
1261
1351
|
),
|
|
1262
|
-
retrieval_mode=RetrievalMode.CHUNKS,
|
|
1263
|
-
),
|
|
1264
|
-
data=ChatParams(
|
|
1265
|
-
messages=[],
|
|
1266
1352
|
),
|
|
1267
1353
|
)
|
|
1268
1354
|
"""
|
|
1355
|
+
_request: typing.Dict[str, typing.Any] = {"messages": messages, "data": data}
|
|
1356
|
+
if class_name is not OMIT:
|
|
1357
|
+
_request["class_name"] = class_name
|
|
1269
1358
|
_response = self._client_wrapper.httpx_client.request(
|
|
1270
1359
|
"POST",
|
|
1271
1360
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/pipelines/{pipeline_id}/chat"),
|
|
1272
|
-
json=jsonable_encoder(
|
|
1361
|
+
json=jsonable_encoder(_request),
|
|
1273
1362
|
headers=self._client_wrapper.get_headers(),
|
|
1274
1363
|
timeout=60,
|
|
1275
1364
|
)
|
|
@@ -1284,7 +1373,13 @@ class PipelinesClient:
|
|
|
1284
1373
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1285
1374
|
|
|
1286
1375
|
def list_pipeline_documents(
|
|
1287
|
-
self,
|
|
1376
|
+
self,
|
|
1377
|
+
pipeline_id: str,
|
|
1378
|
+
*,
|
|
1379
|
+
skip: typing.Optional[int] = None,
|
|
1380
|
+
limit: typing.Optional[int] = None,
|
|
1381
|
+
file_id: typing.Optional[str] = None,
|
|
1382
|
+
only_direct_upload: typing.Optional[bool] = None,
|
|
1288
1383
|
) -> typing.List[CloudDocument]:
|
|
1289
1384
|
"""
|
|
1290
1385
|
Return a list of documents for a pipeline.
|
|
@@ -1295,6 +1390,10 @@ class PipelinesClient:
|
|
|
1295
1390
|
- skip: typing.Optional[int].
|
|
1296
1391
|
|
|
1297
1392
|
- limit: typing.Optional[int].
|
|
1393
|
+
|
|
1394
|
+
- file_id: typing.Optional[str].
|
|
1395
|
+
|
|
1396
|
+
- only_direct_upload: typing.Optional[bool].
|
|
1298
1397
|
---
|
|
1299
1398
|
from llama_cloud.client import LlamaCloud
|
|
1300
1399
|
|
|
@@ -1310,7 +1409,9 @@ class PipelinesClient:
|
|
|
1310
1409
|
urllib.parse.urljoin(
|
|
1311
1410
|
f"{self._client_wrapper.get_base_url()}/", f"api/v1/pipelines/{pipeline_id}/documents"
|
|
1312
1411
|
),
|
|
1313
|
-
params=remove_none_from_dict(
|
|
1412
|
+
params=remove_none_from_dict(
|
|
1413
|
+
{"skip": skip, "limit": limit, "file_id": file_id, "only_direct_upload": only_direct_upload}
|
|
1414
|
+
),
|
|
1314
1415
|
headers=self._client_wrapper.get_headers(),
|
|
1315
1416
|
timeout=60,
|
|
1316
1417
|
)
|
|
@@ -1516,6 +1617,44 @@ class PipelinesClient:
|
|
|
1516
1617
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1517
1618
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1518
1619
|
|
|
1620
|
+
def list_pipeline_document_chunks(self, pipeline_id: str, document_id: str) -> typing.List[TextNode]:
|
|
1621
|
+
"""
|
|
1622
|
+
Return a list of chunks for a pipeline document.
|
|
1623
|
+
|
|
1624
|
+
Parameters:
|
|
1625
|
+
- pipeline_id: str.
|
|
1626
|
+
|
|
1627
|
+
- document_id: str.
|
|
1628
|
+
---
|
|
1629
|
+
from llama_cloud.client import LlamaCloud
|
|
1630
|
+
|
|
1631
|
+
client = LlamaCloud(
|
|
1632
|
+
token="YOUR_TOKEN",
|
|
1633
|
+
)
|
|
1634
|
+
client.pipelines.list_pipeline_document_chunks(
|
|
1635
|
+
pipeline_id="string",
|
|
1636
|
+
document_id="string",
|
|
1637
|
+
)
|
|
1638
|
+
"""
|
|
1639
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
1640
|
+
"GET",
|
|
1641
|
+
urllib.parse.urljoin(
|
|
1642
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
1643
|
+
f"api/v1/pipelines/{pipeline_id}/documents/{document_id}/chunks",
|
|
1644
|
+
),
|
|
1645
|
+
headers=self._client_wrapper.get_headers(),
|
|
1646
|
+
timeout=60,
|
|
1647
|
+
)
|
|
1648
|
+
if 200 <= _response.status_code < 300:
|
|
1649
|
+
return pydantic.parse_obj_as(typing.List[TextNode], _response.json()) # type: ignore
|
|
1650
|
+
if _response.status_code == 422:
|
|
1651
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
1652
|
+
try:
|
|
1653
|
+
_response_json = _response.json()
|
|
1654
|
+
except JSONDecodeError:
|
|
1655
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1656
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1657
|
+
|
|
1519
1658
|
|
|
1520
1659
|
class AsyncPipelinesClient:
|
|
1521
1660
|
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
@@ -1585,8 +1724,11 @@ class AsyncPipelinesClient:
|
|
|
1585
1724
|
- request: PipelineCreate.
|
|
1586
1725
|
---
|
|
1587
1726
|
from llama_cloud import (
|
|
1727
|
+
AutoTransformConfig,
|
|
1588
1728
|
ConfigurableDataSinkNames,
|
|
1589
1729
|
DataSinkCreate,
|
|
1730
|
+
EmbeddingConfig,
|
|
1731
|
+
EmbeddingConfigType,
|
|
1590
1732
|
EvalExecutionParams,
|
|
1591
1733
|
FilterCondition,
|
|
1592
1734
|
LlamaParseParameters,
|
|
@@ -1596,6 +1738,8 @@ class AsyncPipelinesClient:
|
|
|
1596
1738
|
PresetRetrievalParams,
|
|
1597
1739
|
RetrievalMode,
|
|
1598
1740
|
SupportedEvalLlmModelNames,
|
|
1741
|
+
TransformConfig,
|
|
1742
|
+
TransformConfigMode,
|
|
1599
1743
|
)
|
|
1600
1744
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1601
1745
|
|
|
@@ -1604,6 +1748,13 @@ class AsyncPipelinesClient:
|
|
|
1604
1748
|
)
|
|
1605
1749
|
await client.pipelines.create_pipeline(
|
|
1606
1750
|
request=PipelineCreate(
|
|
1751
|
+
embedding_config=EmbeddingConfig(
|
|
1752
|
+
type=EmbeddingConfigType.OPENAI_EMBEDDING,
|
|
1753
|
+
),
|
|
1754
|
+
transform_config=TransformConfig(
|
|
1755
|
+
mode=TransformConfigMode.AUTO,
|
|
1756
|
+
config=AutoTransformConfig(),
|
|
1757
|
+
),
|
|
1607
1758
|
data_sink=DataSinkCreate(
|
|
1608
1759
|
name="string",
|
|
1609
1760
|
sink_type=ConfigurableDataSinkNames.CHROMA,
|
|
@@ -1653,8 +1804,11 @@ class AsyncPipelinesClient:
|
|
|
1653
1804
|
- request: PipelineCreate.
|
|
1654
1805
|
---
|
|
1655
1806
|
from llama_cloud import (
|
|
1807
|
+
AutoTransformConfig,
|
|
1656
1808
|
ConfigurableDataSinkNames,
|
|
1657
1809
|
DataSinkCreate,
|
|
1810
|
+
EmbeddingConfig,
|
|
1811
|
+
EmbeddingConfigType,
|
|
1658
1812
|
EvalExecutionParams,
|
|
1659
1813
|
FilterCondition,
|
|
1660
1814
|
LlamaParseParameters,
|
|
@@ -1664,6 +1818,8 @@ class AsyncPipelinesClient:
|
|
|
1664
1818
|
PresetRetrievalParams,
|
|
1665
1819
|
RetrievalMode,
|
|
1666
1820
|
SupportedEvalLlmModelNames,
|
|
1821
|
+
TransformConfig,
|
|
1822
|
+
TransformConfigMode,
|
|
1667
1823
|
)
|
|
1668
1824
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1669
1825
|
|
|
@@ -1672,6 +1828,13 @@ class AsyncPipelinesClient:
|
|
|
1672
1828
|
)
|
|
1673
1829
|
await client.pipelines.upsert_pipeline(
|
|
1674
1830
|
request=PipelineCreate(
|
|
1831
|
+
embedding_config=EmbeddingConfig(
|
|
1832
|
+
type=EmbeddingConfigType.OPENAI_EMBEDDING,
|
|
1833
|
+
),
|
|
1834
|
+
transform_config=TransformConfig(
|
|
1835
|
+
mode=TransformConfigMode.AUTO,
|
|
1836
|
+
config=AutoTransformConfig(),
|
|
1837
|
+
),
|
|
1675
1838
|
data_sink=DataSinkCreate(
|
|
1676
1839
|
name="string",
|
|
1677
1840
|
sink_type=ConfigurableDataSinkNames.CHROMA,
|
|
@@ -1746,12 +1909,13 @@ class AsyncPipelinesClient:
|
|
|
1746
1909
|
self,
|
|
1747
1910
|
pipeline_id: str,
|
|
1748
1911
|
*,
|
|
1912
|
+
embedding_config: typing.Optional[EmbeddingConfig] = OMIT,
|
|
1913
|
+
transform_config: typing.Optional[TransformConfig] = OMIT,
|
|
1749
1914
|
configured_transformations: typing.Optional[typing.List[ConfiguredTransformationItem]] = OMIT,
|
|
1750
1915
|
data_sink_id: typing.Optional[str] = OMIT,
|
|
1751
1916
|
data_sink: typing.Optional[DataSinkCreate] = OMIT,
|
|
1752
1917
|
preset_retrieval_parameters: typing.Optional[PresetRetrievalParams] = OMIT,
|
|
1753
1918
|
eval_parameters: typing.Optional[EvalExecutionParams] = OMIT,
|
|
1754
|
-
llama_parse_enabled: typing.Optional[bool] = OMIT,
|
|
1755
1919
|
llama_parse_parameters: typing.Optional[LlamaParseParameters] = OMIT,
|
|
1756
1920
|
name: typing.Optional[str] = OMIT,
|
|
1757
1921
|
managed_pipeline_id: typing.Optional[str] = OMIT,
|
|
@@ -1762,7 +1926,11 @@ class AsyncPipelinesClient:
|
|
|
1762
1926
|
Parameters:
|
|
1763
1927
|
- pipeline_id: str.
|
|
1764
1928
|
|
|
1765
|
-
-
|
|
1929
|
+
- embedding_config: typing.Optional[EmbeddingConfig]. Configuration for the embedding model.
|
|
1930
|
+
|
|
1931
|
+
- transform_config: typing.Optional[TransformConfig]. Configuration for the transformation.
|
|
1932
|
+
|
|
1933
|
+
- configured_transformations: typing.Optional[typing.List[ConfiguredTransformationItem]]. List of configured transformations.
|
|
1766
1934
|
|
|
1767
1935
|
- data_sink_id: typing.Optional[str]. Data sink ID. When provided instead of data_sink, the data sink will be looked up by ID.
|
|
1768
1936
|
|
|
@@ -1772,8 +1940,6 @@ class AsyncPipelinesClient:
|
|
|
1772
1940
|
|
|
1773
1941
|
- eval_parameters: typing.Optional[EvalExecutionParams]. Eval parameters for the pipeline.
|
|
1774
1942
|
|
|
1775
|
-
- llama_parse_enabled: typing.Optional[bool]. Whether to use LlamaParse during pipeline execution.
|
|
1776
|
-
|
|
1777
1943
|
- llama_parse_parameters: typing.Optional[LlamaParseParameters]. Settings that can be configured for how to use LlamaParse to parse files within a LlamaCloud pipeline.
|
|
1778
1944
|
|
|
1779
1945
|
- name: typing.Optional[str].
|
|
@@ -1781,8 +1947,11 @@ class AsyncPipelinesClient:
|
|
|
1781
1947
|
- managed_pipeline_id: typing.Optional[str]. The ID of the ManagedPipeline this playground pipeline is linked to.
|
|
1782
1948
|
---
|
|
1783
1949
|
from llama_cloud import (
|
|
1950
|
+
AutoTransformConfig,
|
|
1784
1951
|
ConfigurableDataSinkNames,
|
|
1785
1952
|
DataSinkCreate,
|
|
1953
|
+
EmbeddingConfig,
|
|
1954
|
+
EmbeddingConfigType,
|
|
1786
1955
|
EvalExecutionParams,
|
|
1787
1956
|
FilterCondition,
|
|
1788
1957
|
LlamaParseParameters,
|
|
@@ -1790,6 +1959,8 @@ class AsyncPipelinesClient:
|
|
|
1790
1959
|
PresetRetrievalParams,
|
|
1791
1960
|
RetrievalMode,
|
|
1792
1961
|
SupportedEvalLlmModelNames,
|
|
1962
|
+
TransformConfig,
|
|
1963
|
+
TransformConfigMode,
|
|
1793
1964
|
)
|
|
1794
1965
|
from llama_cloud.client import AsyncLlamaCloud
|
|
1795
1966
|
|
|
@@ -1798,6 +1969,13 @@ class AsyncPipelinesClient:
|
|
|
1798
1969
|
)
|
|
1799
1970
|
await client.pipelines.update_existing_pipeline(
|
|
1800
1971
|
pipeline_id="string",
|
|
1972
|
+
embedding_config=EmbeddingConfig(
|
|
1973
|
+
type=EmbeddingConfigType.OPENAI_EMBEDDING,
|
|
1974
|
+
),
|
|
1975
|
+
transform_config=TransformConfig(
|
|
1976
|
+
mode=TransformConfigMode.AUTO,
|
|
1977
|
+
config=AutoTransformConfig(),
|
|
1978
|
+
),
|
|
1801
1979
|
data_sink=DataSinkCreate(
|
|
1802
1980
|
name="string",
|
|
1803
1981
|
sink_type=ConfigurableDataSinkNames.CHROMA,
|
|
@@ -1816,6 +1994,10 @@ class AsyncPipelinesClient:
|
|
|
1816
1994
|
)
|
|
1817
1995
|
"""
|
|
1818
1996
|
_request: typing.Dict[str, typing.Any] = {}
|
|
1997
|
+
if embedding_config is not OMIT:
|
|
1998
|
+
_request["embedding_config"] = embedding_config
|
|
1999
|
+
if transform_config is not OMIT:
|
|
2000
|
+
_request["transform_config"] = transform_config
|
|
1819
2001
|
if configured_transformations is not OMIT:
|
|
1820
2002
|
_request["configured_transformations"] = configured_transformations
|
|
1821
2003
|
if data_sink_id is not OMIT:
|
|
@@ -1826,8 +2008,6 @@ class AsyncPipelinesClient:
|
|
|
1826
2008
|
_request["preset_retrieval_parameters"] = preset_retrieval_parameters
|
|
1827
2009
|
if eval_parameters is not OMIT:
|
|
1828
2010
|
_request["eval_parameters"] = eval_parameters
|
|
1829
|
-
if llama_parse_enabled is not OMIT:
|
|
1830
|
-
_request["llama_parse_enabled"] = llama_parse_enabled
|
|
1831
2011
|
if llama_parse_parameters is not OMIT:
|
|
1832
2012
|
_request["llama_parse_parameters"] = llama_parse_parameters
|
|
1833
2013
|
if name is not OMIT:
|
|
@@ -1947,6 +2127,38 @@ class AsyncPipelinesClient:
|
|
|
1947
2127
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1948
2128
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
1949
2129
|
|
|
2130
|
+
async def copy_pipeline(self, pipeline_id: str) -> Pipeline:
|
|
2131
|
+
"""
|
|
2132
|
+
Copy a pipeline by ID.
|
|
2133
|
+
|
|
2134
|
+
Parameters:
|
|
2135
|
+
- pipeline_id: str.
|
|
2136
|
+
---
|
|
2137
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
2138
|
+
|
|
2139
|
+
client = AsyncLlamaCloud(
|
|
2140
|
+
token="YOUR_TOKEN",
|
|
2141
|
+
)
|
|
2142
|
+
await client.pipelines.copy_pipeline(
|
|
2143
|
+
pipeline_id="string",
|
|
2144
|
+
)
|
|
2145
|
+
"""
|
|
2146
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
2147
|
+
"POST",
|
|
2148
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/pipelines/{pipeline_id}/copy"),
|
|
2149
|
+
headers=self._client_wrapper.get_headers(),
|
|
2150
|
+
timeout=60,
|
|
2151
|
+
)
|
|
2152
|
+
if 200 <= _response.status_code < 300:
|
|
2153
|
+
return pydantic.parse_obj_as(Pipeline, _response.json()) # type: ignore
|
|
2154
|
+
if _response.status_code == 422:
|
|
2155
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
2156
|
+
try:
|
|
2157
|
+
_response_json = _response.json()
|
|
2158
|
+
except JSONDecodeError:
|
|
2159
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2160
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2161
|
+
|
|
1950
2162
|
async def get_eval_dataset_executions(
|
|
1951
2163
|
self, pipeline_id: str, eval_dataset_id: str
|
|
1952
2164
|
) -> typing.List[EvalDatasetJobRecord]:
|
|
@@ -2704,18 +2916,25 @@ class AsyncPipelinesClient:
|
|
|
2704
2916
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2705
2917
|
|
|
2706
2918
|
async def chat(
|
|
2707
|
-
self,
|
|
2919
|
+
self,
|
|
2920
|
+
pipeline_id: str,
|
|
2921
|
+
*,
|
|
2922
|
+
messages: typing.List[ChatMessage],
|
|
2923
|
+
data: ChatData,
|
|
2924
|
+
class_name: typing.Optional[str] = OMIT,
|
|
2708
2925
|
) -> typing.Any:
|
|
2709
2926
|
"""
|
|
2710
2927
|
Parameters:
|
|
2711
2928
|
- pipeline_id: str.
|
|
2712
2929
|
|
|
2713
|
-
-
|
|
2930
|
+
- messages: typing.List[ChatMessage].
|
|
2931
|
+
|
|
2932
|
+
- data: ChatData.
|
|
2714
2933
|
|
|
2715
|
-
-
|
|
2934
|
+
- class_name: typing.Optional[str].
|
|
2716
2935
|
---
|
|
2717
2936
|
from llama_cloud import (
|
|
2718
|
-
|
|
2937
|
+
ChatData,
|
|
2719
2938
|
FilterCondition,
|
|
2720
2939
|
MetadataFilters,
|
|
2721
2940
|
PresetRetrievalParams,
|
|
@@ -2728,22 +2947,25 @@ class AsyncPipelinesClient:
|
|
|
2728
2947
|
)
|
|
2729
2948
|
await client.pipelines.chat(
|
|
2730
2949
|
pipeline_id="string",
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2734
|
-
|
|
2950
|
+
messages=[],
|
|
2951
|
+
data=ChatData(
|
|
2952
|
+
retrieval_parameters=PresetRetrievalParams(
|
|
2953
|
+
search_filters=MetadataFilters(
|
|
2954
|
+
filters=[],
|
|
2955
|
+
condition=FilterCondition.AND,
|
|
2956
|
+
),
|
|
2957
|
+
retrieval_mode=RetrievalMode.CHUNKS,
|
|
2735
2958
|
),
|
|
2736
|
-
retrieval_mode=RetrievalMode.CHUNKS,
|
|
2737
|
-
),
|
|
2738
|
-
data=ChatParams(
|
|
2739
|
-
messages=[],
|
|
2740
2959
|
),
|
|
2741
2960
|
)
|
|
2742
2961
|
"""
|
|
2962
|
+
_request: typing.Dict[str, typing.Any] = {"messages": messages, "data": data}
|
|
2963
|
+
if class_name is not OMIT:
|
|
2964
|
+
_request["class_name"] = class_name
|
|
2743
2965
|
_response = await self._client_wrapper.httpx_client.request(
|
|
2744
2966
|
"POST",
|
|
2745
2967
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/pipelines/{pipeline_id}/chat"),
|
|
2746
|
-
json=jsonable_encoder(
|
|
2968
|
+
json=jsonable_encoder(_request),
|
|
2747
2969
|
headers=self._client_wrapper.get_headers(),
|
|
2748
2970
|
timeout=60,
|
|
2749
2971
|
)
|
|
@@ -2758,7 +2980,13 @@ class AsyncPipelinesClient:
|
|
|
2758
2980
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
2759
2981
|
|
|
2760
2982
|
async def list_pipeline_documents(
|
|
2761
|
-
self,
|
|
2983
|
+
self,
|
|
2984
|
+
pipeline_id: str,
|
|
2985
|
+
*,
|
|
2986
|
+
skip: typing.Optional[int] = None,
|
|
2987
|
+
limit: typing.Optional[int] = None,
|
|
2988
|
+
file_id: typing.Optional[str] = None,
|
|
2989
|
+
only_direct_upload: typing.Optional[bool] = None,
|
|
2762
2990
|
) -> typing.List[CloudDocument]:
|
|
2763
2991
|
"""
|
|
2764
2992
|
Return a list of documents for a pipeline.
|
|
@@ -2769,6 +2997,10 @@ class AsyncPipelinesClient:
|
|
|
2769
2997
|
- skip: typing.Optional[int].
|
|
2770
2998
|
|
|
2771
2999
|
- limit: typing.Optional[int].
|
|
3000
|
+
|
|
3001
|
+
- file_id: typing.Optional[str].
|
|
3002
|
+
|
|
3003
|
+
- only_direct_upload: typing.Optional[bool].
|
|
2772
3004
|
---
|
|
2773
3005
|
from llama_cloud.client import AsyncLlamaCloud
|
|
2774
3006
|
|
|
@@ -2784,7 +3016,9 @@ class AsyncPipelinesClient:
|
|
|
2784
3016
|
urllib.parse.urljoin(
|
|
2785
3017
|
f"{self._client_wrapper.get_base_url()}/", f"api/v1/pipelines/{pipeline_id}/documents"
|
|
2786
3018
|
),
|
|
2787
|
-
params=remove_none_from_dict(
|
|
3019
|
+
params=remove_none_from_dict(
|
|
3020
|
+
{"skip": skip, "limit": limit, "file_id": file_id, "only_direct_upload": only_direct_upload}
|
|
3021
|
+
),
|
|
2788
3022
|
headers=self._client_wrapper.get_headers(),
|
|
2789
3023
|
timeout=60,
|
|
2790
3024
|
)
|
|
@@ -2989,3 +3223,41 @@ class AsyncPipelinesClient:
|
|
|
2989
3223
|
except JSONDecodeError:
|
|
2990
3224
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
2991
3225
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
3226
|
+
|
|
3227
|
+
async def list_pipeline_document_chunks(self, pipeline_id: str, document_id: str) -> typing.List[TextNode]:
|
|
3228
|
+
"""
|
|
3229
|
+
Return a list of chunks for a pipeline document.
|
|
3230
|
+
|
|
3231
|
+
Parameters:
|
|
3232
|
+
- pipeline_id: str.
|
|
3233
|
+
|
|
3234
|
+
- document_id: str.
|
|
3235
|
+
---
|
|
3236
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
3237
|
+
|
|
3238
|
+
client = AsyncLlamaCloud(
|
|
3239
|
+
token="YOUR_TOKEN",
|
|
3240
|
+
)
|
|
3241
|
+
await client.pipelines.list_pipeline_document_chunks(
|
|
3242
|
+
pipeline_id="string",
|
|
3243
|
+
document_id="string",
|
|
3244
|
+
)
|
|
3245
|
+
"""
|
|
3246
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
3247
|
+
"GET",
|
|
3248
|
+
urllib.parse.urljoin(
|
|
3249
|
+
f"{self._client_wrapper.get_base_url()}/",
|
|
3250
|
+
f"api/v1/pipelines/{pipeline_id}/documents/{document_id}/chunks",
|
|
3251
|
+
),
|
|
3252
|
+
headers=self._client_wrapper.get_headers(),
|
|
3253
|
+
timeout=60,
|
|
3254
|
+
)
|
|
3255
|
+
if 200 <= _response.status_code < 300:
|
|
3256
|
+
return pydantic.parse_obj_as(typing.List[TextNode], _response.json()) # type: ignore
|
|
3257
|
+
if _response.status_code == 422:
|
|
3258
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
3259
|
+
try:
|
|
3260
|
+
_response_json = _response.json()
|
|
3261
|
+
except JSONDecodeError:
|
|
3262
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
3263
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|