llama-cloud 0.1.9__py3-none-any.whl → 0.1.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 +34 -8
- llama_cloud/resources/__init__.py +14 -3
- llama_cloud/resources/chat_apps/client.py +99 -133
- llama_cloud/resources/llama_extract/__init__.py +16 -2
- llama_cloud/resources/llama_extract/client.py +328 -122
- llama_cloud/resources/llama_extract/types/__init__.py +14 -3
- llama_cloud/resources/llama_extract/types/extract_agent_create_data_schema.py +9 -0
- llama_cloud/resources/llama_extract/types/{extract_agent_create_data_schema_value.py → extract_agent_create_data_schema_zero_value.py} +1 -1
- llama_cloud/resources/llama_extract/types/extract_agent_update_data_schema.py +9 -0
- llama_cloud/resources/llama_extract/types/{extract_agent_update_data_schema_value.py → extract_agent_update_data_schema_zero_value.py} +1 -1
- llama_cloud/resources/llama_extract/types/extract_schema_validate_request_data_schema.py +9 -0
- llama_cloud/resources/llama_extract/types/extract_schema_validate_request_data_schema_zero_value.py +7 -0
- llama_cloud/resources/organizations/client.py +8 -12
- llama_cloud/resources/parsing/client.py +244 -0
- llama_cloud/resources/reports/client.py +30 -26
- llama_cloud/resources/retrievers/client.py +16 -4
- llama_cloud/types/__init__.py +22 -4
- llama_cloud/types/chat_app.py +11 -9
- llama_cloud/types/chat_app_response.py +12 -10
- llama_cloud/types/cloud_mongo_db_atlas_vector_search.py +1 -0
- llama_cloud/types/edit_suggestion.py +3 -4
- llama_cloud/types/edit_suggestion_blocks_item.py +8 -0
- llama_cloud/types/extract_config.py +2 -0
- llama_cloud/types/extract_job_create.py +4 -2
- llama_cloud/types/extract_job_create_data_schema_override.py +9 -0
- llama_cloud/types/{extract_job_create_data_schema_override_value.py → extract_job_create_data_schema_override_zero_value.py} +1 -1
- llama_cloud/types/extract_mode.py +7 -7
- llama_cloud/types/extract_run.py +2 -2
- llama_cloud/types/extract_run_data.py +11 -0
- llama_cloud/types/extract_run_data_item_value.py +5 -0
- llama_cloud/types/extract_run_data_zero_value.py +5 -0
- llama_cloud/types/extract_schema_validate_response.py +32 -0
- llama_cloud/types/extract_schema_validate_response_data_schema_value.py +7 -0
- llama_cloud/types/extract_target.py +17 -0
- llama_cloud/types/llama_extract_settings.py +8 -1
- llama_cloud/types/llama_parse_parameters.py +9 -0
- llama_cloud/types/plan.py +4 -0
- llama_cloud/types/preset_composite_retrieval_params.py +35 -0
- llama_cloud/types/report_file_info.py +37 -0
- llama_cloud/types/report_metadata.py +2 -1
- llama_cloud/types/supported_llm_model_names.py +28 -4
- {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.11.dist-info}/METADATA +1 -1
- {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.11.dist-info}/RECORD +45 -32
- llama_cloud/types/extract_run_data_value.py +0 -5
- {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.11.dist-info}/LICENSE +0 -0
- {llama_cloud-0.1.9.dist-info → llama_cloud-0.1.11.dist-info}/WHEEL +0 -0
llama_cloud/__init__.py
CHANGED
|
@@ -70,6 +70,7 @@ from .types import (
|
|
|
70
70
|
DataSourceCustomMetadataValue,
|
|
71
71
|
DataSourceDefinition,
|
|
72
72
|
EditSuggestion,
|
|
73
|
+
EditSuggestionBlocksItem,
|
|
73
74
|
ElementSegmentationConfig,
|
|
74
75
|
EmbeddingModelConfig,
|
|
75
76
|
EmbeddingModelConfigEmbeddingConfig,
|
|
@@ -103,7 +104,8 @@ from .types import (
|
|
|
103
104
|
ExtractConfig,
|
|
104
105
|
ExtractJob,
|
|
105
106
|
ExtractJobCreate,
|
|
106
|
-
|
|
107
|
+
ExtractJobCreateDataSchemaOverride,
|
|
108
|
+
ExtractJobCreateDataSchemaOverrideZeroValue,
|
|
107
109
|
ExtractMode,
|
|
108
110
|
ExtractResultset,
|
|
109
111
|
ExtractResultsetData,
|
|
@@ -111,10 +113,15 @@ from .types import (
|
|
|
111
113
|
ExtractResultsetDataZeroValue,
|
|
112
114
|
ExtractResultsetExtractionMetadataValue,
|
|
113
115
|
ExtractRun,
|
|
116
|
+
ExtractRunData,
|
|
117
|
+
ExtractRunDataItemValue,
|
|
114
118
|
ExtractRunDataSchemaValue,
|
|
115
|
-
|
|
119
|
+
ExtractRunDataZeroValue,
|
|
116
120
|
ExtractRunExtractionMetadataValue,
|
|
121
|
+
ExtractSchemaValidateResponse,
|
|
122
|
+
ExtractSchemaValidateResponseDataSchemaValue,
|
|
117
123
|
ExtractState,
|
|
124
|
+
ExtractTarget,
|
|
118
125
|
File,
|
|
119
126
|
FilePermissionInfoValue,
|
|
120
127
|
FileResourceInfoValue,
|
|
@@ -225,6 +232,7 @@ from .types import (
|
|
|
225
232
|
Plan,
|
|
226
233
|
PlaygroundSession,
|
|
227
234
|
Pooling,
|
|
235
|
+
PresetCompositeRetrievalParams,
|
|
228
236
|
PresetRetrievalParams,
|
|
229
237
|
PresignedUrl,
|
|
230
238
|
ProgressEvent,
|
|
@@ -246,6 +254,7 @@ from .types import (
|
|
|
246
254
|
ReportEventItemEventData_ReportBlockUpdate,
|
|
247
255
|
ReportEventItemEventData_ReportStateUpdate,
|
|
248
256
|
ReportEventType,
|
|
257
|
+
ReportFileInfo,
|
|
249
258
|
ReportMetadata,
|
|
250
259
|
ReportPlan,
|
|
251
260
|
ReportPlanBlock,
|
|
@@ -299,8 +308,12 @@ from .resources import (
|
|
|
299
308
|
EmbeddingModelConfigCreateEmbeddingConfig_HuggingfaceApiEmbedding,
|
|
300
309
|
EmbeddingModelConfigCreateEmbeddingConfig_OpenaiEmbedding,
|
|
301
310
|
EmbeddingModelConfigCreateEmbeddingConfig_VertexaiEmbedding,
|
|
302
|
-
|
|
303
|
-
|
|
311
|
+
ExtractAgentCreateDataSchema,
|
|
312
|
+
ExtractAgentCreateDataSchemaZeroValue,
|
|
313
|
+
ExtractAgentUpdateDataSchema,
|
|
314
|
+
ExtractAgentUpdateDataSchemaZeroValue,
|
|
315
|
+
ExtractSchemaValidateRequestDataSchema,
|
|
316
|
+
ExtractSchemaValidateRequestDataSchemaZeroValue,
|
|
304
317
|
FileCreateFromUrlResourceInfoValue,
|
|
305
318
|
FileCreatePermissionInfoValue,
|
|
306
319
|
FileCreateResourceInfoValue,
|
|
@@ -406,6 +419,7 @@ __all__ = [
|
|
|
406
419
|
"DataSourceUpdateComponent",
|
|
407
420
|
"DataSourceUpdateCustomMetadataValue",
|
|
408
421
|
"EditSuggestion",
|
|
422
|
+
"EditSuggestionBlocksItem",
|
|
409
423
|
"ElementSegmentationConfig",
|
|
410
424
|
"EmbeddingModelConfig",
|
|
411
425
|
"EmbeddingModelConfigCreateEmbeddingConfig",
|
|
@@ -443,13 +457,16 @@ __all__ = [
|
|
|
443
457
|
"EvalQuestionCreate",
|
|
444
458
|
"EvalQuestionResult",
|
|
445
459
|
"ExtractAgent",
|
|
446
|
-
"
|
|
460
|
+
"ExtractAgentCreateDataSchema",
|
|
461
|
+
"ExtractAgentCreateDataSchemaZeroValue",
|
|
447
462
|
"ExtractAgentDataSchemaValue",
|
|
448
|
-
"
|
|
463
|
+
"ExtractAgentUpdateDataSchema",
|
|
464
|
+
"ExtractAgentUpdateDataSchemaZeroValue",
|
|
449
465
|
"ExtractConfig",
|
|
450
466
|
"ExtractJob",
|
|
451
467
|
"ExtractJobCreate",
|
|
452
|
-
"
|
|
468
|
+
"ExtractJobCreateDataSchemaOverride",
|
|
469
|
+
"ExtractJobCreateDataSchemaOverrideZeroValue",
|
|
453
470
|
"ExtractMode",
|
|
454
471
|
"ExtractResultset",
|
|
455
472
|
"ExtractResultsetData",
|
|
@@ -457,10 +474,17 @@ __all__ = [
|
|
|
457
474
|
"ExtractResultsetDataZeroValue",
|
|
458
475
|
"ExtractResultsetExtractionMetadataValue",
|
|
459
476
|
"ExtractRun",
|
|
477
|
+
"ExtractRunData",
|
|
478
|
+
"ExtractRunDataItemValue",
|
|
460
479
|
"ExtractRunDataSchemaValue",
|
|
461
|
-
"
|
|
480
|
+
"ExtractRunDataZeroValue",
|
|
462
481
|
"ExtractRunExtractionMetadataValue",
|
|
482
|
+
"ExtractSchemaValidateRequestDataSchema",
|
|
483
|
+
"ExtractSchemaValidateRequestDataSchemaZeroValue",
|
|
484
|
+
"ExtractSchemaValidateResponse",
|
|
485
|
+
"ExtractSchemaValidateResponseDataSchemaValue",
|
|
463
486
|
"ExtractState",
|
|
487
|
+
"ExtractTarget",
|
|
464
488
|
"File",
|
|
465
489
|
"FileCreateFromUrlResourceInfoValue",
|
|
466
490
|
"FileCreatePermissionInfoValue",
|
|
@@ -585,6 +609,7 @@ __all__ = [
|
|
|
585
609
|
"Plan",
|
|
586
610
|
"PlaygroundSession",
|
|
587
611
|
"Pooling",
|
|
612
|
+
"PresetCompositeRetrievalParams",
|
|
588
613
|
"PresetRetrievalParams",
|
|
589
614
|
"PresignedUrl",
|
|
590
615
|
"ProgressEvent",
|
|
@@ -606,6 +631,7 @@ __all__ = [
|
|
|
606
631
|
"ReportEventItemEventData_ReportBlockUpdate",
|
|
607
632
|
"ReportEventItemEventData_ReportStateUpdate",
|
|
608
633
|
"ReportEventType",
|
|
634
|
+
"ReportFileInfo",
|
|
609
635
|
"ReportMetadata",
|
|
610
636
|
"ReportPlan",
|
|
611
637
|
"ReportPlanBlock",
|
|
@@ -30,7 +30,14 @@ from .embedding_model_configs import (
|
|
|
30
30
|
EmbeddingModelConfigCreateEmbeddingConfig_VertexaiEmbedding,
|
|
31
31
|
)
|
|
32
32
|
from .files import FileCreateFromUrlResourceInfoValue, FileCreatePermissionInfoValue, FileCreateResourceInfoValue
|
|
33
|
-
from .llama_extract import
|
|
33
|
+
from .llama_extract import (
|
|
34
|
+
ExtractAgentCreateDataSchema,
|
|
35
|
+
ExtractAgentCreateDataSchemaZeroValue,
|
|
36
|
+
ExtractAgentUpdateDataSchema,
|
|
37
|
+
ExtractAgentUpdateDataSchemaZeroValue,
|
|
38
|
+
ExtractSchemaValidateRequestDataSchema,
|
|
39
|
+
ExtractSchemaValidateRequestDataSchemaZeroValue,
|
|
40
|
+
)
|
|
34
41
|
from .pipelines import (
|
|
35
42
|
PipelineFileUpdateCustomMetadataValue,
|
|
36
43
|
PipelineUpdateEmbeddingConfig,
|
|
@@ -57,8 +64,12 @@ __all__ = [
|
|
|
57
64
|
"EmbeddingModelConfigCreateEmbeddingConfig_HuggingfaceApiEmbedding",
|
|
58
65
|
"EmbeddingModelConfigCreateEmbeddingConfig_OpenaiEmbedding",
|
|
59
66
|
"EmbeddingModelConfigCreateEmbeddingConfig_VertexaiEmbedding",
|
|
60
|
-
"
|
|
61
|
-
"
|
|
67
|
+
"ExtractAgentCreateDataSchema",
|
|
68
|
+
"ExtractAgentCreateDataSchemaZeroValue",
|
|
69
|
+
"ExtractAgentUpdateDataSchema",
|
|
70
|
+
"ExtractAgentUpdateDataSchemaZeroValue",
|
|
71
|
+
"ExtractSchemaValidateRequestDataSchema",
|
|
72
|
+
"ExtractSchemaValidateRequestDataSchemaZeroValue",
|
|
62
73
|
"FileCreateFromUrlResourceInfoValue",
|
|
63
74
|
"FileCreatePermissionInfoValue",
|
|
64
75
|
"FileCreateResourceInfoValue",
|
|
@@ -14,7 +14,7 @@ from ...types.chat_app_response import ChatAppResponse
|
|
|
14
14
|
from ...types.http_validation_error import HttpValidationError
|
|
15
15
|
from ...types.input_message import InputMessage
|
|
16
16
|
from ...types.llm_parameters import LlmParameters
|
|
17
|
-
from ...types.
|
|
17
|
+
from ...types.preset_composite_retrieval_params import PresetCompositeRetrievalParams
|
|
18
18
|
|
|
19
19
|
try:
|
|
20
20
|
import pydantic
|
|
@@ -71,10 +71,9 @@ class ChatAppsClient:
|
|
|
71
71
|
project_id: typing.Optional[str] = None,
|
|
72
72
|
organization_id: typing.Optional[str] = None,
|
|
73
73
|
name: str,
|
|
74
|
-
|
|
74
|
+
retriever_id: str,
|
|
75
75
|
llm_config: LlmParameters,
|
|
76
|
-
retrieval_config:
|
|
77
|
-
chat_app_create_project_id: str,
|
|
76
|
+
retrieval_config: PresetCompositeRetrievalParams,
|
|
78
77
|
) -> ChatApp:
|
|
79
78
|
"""
|
|
80
79
|
Create a new chat app.
|
|
@@ -84,22 +83,18 @@ class ChatAppsClient:
|
|
|
84
83
|
|
|
85
84
|
- organization_id: typing.Optional[str].
|
|
86
85
|
|
|
87
|
-
- name: str.
|
|
86
|
+
- name: str. Name of the chat app
|
|
88
87
|
|
|
89
|
-
-
|
|
88
|
+
- retriever_id: str. ID of the retriever to use for the chat app
|
|
90
89
|
|
|
91
|
-
- llm_config: LlmParameters.
|
|
90
|
+
- llm_config: LlmParameters. Configuration for the LLM model to use for the chat app
|
|
92
91
|
|
|
93
|
-
- retrieval_config:
|
|
94
|
-
|
|
95
|
-
- chat_app_create_project_id: str.
|
|
92
|
+
- retrieval_config: PresetCompositeRetrievalParams. Configuration for the retrieval model to use for the chat app
|
|
96
93
|
---
|
|
97
94
|
from llama_cloud import (
|
|
98
|
-
|
|
95
|
+
CompositeRetrievalMode,
|
|
99
96
|
LlmParameters,
|
|
100
|
-
|
|
101
|
-
PresetRetrievalParams,
|
|
102
|
-
RetrievalMode,
|
|
97
|
+
PresetCompositeRetrievalParams,
|
|
103
98
|
SupportedLlmModelNames,
|
|
104
99
|
)
|
|
105
100
|
from llama_cloud.client import LlamaCloud
|
|
@@ -109,18 +104,13 @@ class ChatAppsClient:
|
|
|
109
104
|
)
|
|
110
105
|
client.chat_apps.create_chat_app_api_v_1_apps_post(
|
|
111
106
|
name="string",
|
|
112
|
-
|
|
107
|
+
retriever_id="string",
|
|
113
108
|
llm_config=LlmParameters(
|
|
114
109
|
model_name=SupportedLlmModelNames.GPT_3_5_TURBO,
|
|
115
110
|
),
|
|
116
|
-
retrieval_config=
|
|
117
|
-
|
|
118
|
-
filters=[],
|
|
119
|
-
condition=FilterCondition.AND,
|
|
120
|
-
),
|
|
121
|
-
retrieval_mode=RetrievalMode.CHUNKS,
|
|
111
|
+
retrieval_config=PresetCompositeRetrievalParams(
|
|
112
|
+
mode=CompositeRetrievalMode.ROUTING,
|
|
122
113
|
),
|
|
123
|
-
chat_app_create_project_id="string",
|
|
124
114
|
)
|
|
125
115
|
"""
|
|
126
116
|
_response = self._client_wrapper.httpx_client.request(
|
|
@@ -130,10 +120,9 @@ class ChatAppsClient:
|
|
|
130
120
|
json=jsonable_encoder(
|
|
131
121
|
{
|
|
132
122
|
"name": name,
|
|
133
|
-
"
|
|
123
|
+
"retriever_id": retriever_id,
|
|
134
124
|
"llm_config": llm_config,
|
|
135
125
|
"retrieval_config": retrieval_config,
|
|
136
|
-
"project_id": chat_app_create_project_id,
|
|
137
126
|
}
|
|
138
127
|
),
|
|
139
128
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -181,36 +170,6 @@ class ChatAppsClient:
|
|
|
181
170
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
182
171
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
183
172
|
|
|
184
|
-
def delete_chat_app(self, id: str) -> typing.Any:
|
|
185
|
-
"""
|
|
186
|
-
Parameters:
|
|
187
|
-
- id: str.
|
|
188
|
-
---
|
|
189
|
-
from llama_cloud.client import LlamaCloud
|
|
190
|
-
|
|
191
|
-
client = LlamaCloud(
|
|
192
|
-
token="YOUR_TOKEN",
|
|
193
|
-
)
|
|
194
|
-
client.chat_apps.delete_chat_app(
|
|
195
|
-
id="string",
|
|
196
|
-
)
|
|
197
|
-
"""
|
|
198
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
199
|
-
"DELETE",
|
|
200
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/apps/{id}"),
|
|
201
|
-
headers=self._client_wrapper.get_headers(),
|
|
202
|
-
timeout=60,
|
|
203
|
-
)
|
|
204
|
-
if 200 <= _response.status_code < 300:
|
|
205
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
206
|
-
if _response.status_code == 422:
|
|
207
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
208
|
-
try:
|
|
209
|
-
_response_json = _response.json()
|
|
210
|
-
except JSONDecodeError:
|
|
211
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
212
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
213
|
-
|
|
214
173
|
def update_chat_app(
|
|
215
174
|
self,
|
|
216
175
|
id: str,
|
|
@@ -219,7 +178,7 @@ class ChatAppsClient:
|
|
|
219
178
|
organization_id: typing.Optional[str] = None,
|
|
220
179
|
name: typing.Optional[str] = OMIT,
|
|
221
180
|
llm_config: typing.Optional[LlmParameters] = OMIT,
|
|
222
|
-
retrieval_config: typing.Optional[
|
|
181
|
+
retrieval_config: typing.Optional[PresetCompositeRetrievalParams] = OMIT,
|
|
223
182
|
) -> ChatApp:
|
|
224
183
|
"""
|
|
225
184
|
Update a chat app.
|
|
@@ -235,14 +194,12 @@ class ChatAppsClient:
|
|
|
235
194
|
|
|
236
195
|
- llm_config: typing.Optional[LlmParameters].
|
|
237
196
|
|
|
238
|
-
- retrieval_config: typing.Optional[
|
|
197
|
+
- retrieval_config: typing.Optional[PresetCompositeRetrievalParams].
|
|
239
198
|
---
|
|
240
199
|
from llama_cloud import (
|
|
241
|
-
|
|
200
|
+
CompositeRetrievalMode,
|
|
242
201
|
LlmParameters,
|
|
243
|
-
|
|
244
|
-
PresetRetrievalParams,
|
|
245
|
-
RetrievalMode,
|
|
202
|
+
PresetCompositeRetrievalParams,
|
|
246
203
|
SupportedLlmModelNames,
|
|
247
204
|
)
|
|
248
205
|
from llama_cloud.client import LlamaCloud
|
|
@@ -255,12 +212,8 @@ class ChatAppsClient:
|
|
|
255
212
|
llm_config=LlmParameters(
|
|
256
213
|
model_name=SupportedLlmModelNames.GPT_3_5_TURBO,
|
|
257
214
|
),
|
|
258
|
-
retrieval_config=
|
|
259
|
-
|
|
260
|
-
filters=[],
|
|
261
|
-
condition=FilterCondition.AND,
|
|
262
|
-
),
|
|
263
|
-
retrieval_mode=RetrievalMode.CHUNKS,
|
|
215
|
+
retrieval_config=PresetCompositeRetrievalParams(
|
|
216
|
+
mode=CompositeRetrievalMode.ROUTING,
|
|
264
217
|
),
|
|
265
218
|
)
|
|
266
219
|
"""
|
|
@@ -272,7 +225,7 @@ class ChatAppsClient:
|
|
|
272
225
|
if retrieval_config is not OMIT:
|
|
273
226
|
_request["retrieval_config"] = retrieval_config
|
|
274
227
|
_response = self._client_wrapper.httpx_client.request(
|
|
275
|
-
"
|
|
228
|
+
"PUT",
|
|
276
229
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/apps/{id}"),
|
|
277
230
|
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
278
231
|
json=jsonable_encoder(_request),
|
|
@@ -289,6 +242,36 @@ class ChatAppsClient:
|
|
|
289
242
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
290
243
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
291
244
|
|
|
245
|
+
def delete_chat_app(self, id: str) -> typing.Any:
|
|
246
|
+
"""
|
|
247
|
+
Parameters:
|
|
248
|
+
- id: str.
|
|
249
|
+
---
|
|
250
|
+
from llama_cloud.client import LlamaCloud
|
|
251
|
+
|
|
252
|
+
client = LlamaCloud(
|
|
253
|
+
token="YOUR_TOKEN",
|
|
254
|
+
)
|
|
255
|
+
client.chat_apps.delete_chat_app(
|
|
256
|
+
id="string",
|
|
257
|
+
)
|
|
258
|
+
"""
|
|
259
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
260
|
+
"DELETE",
|
|
261
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/apps/{id}"),
|
|
262
|
+
headers=self._client_wrapper.get_headers(),
|
|
263
|
+
timeout=60,
|
|
264
|
+
)
|
|
265
|
+
if 200 <= _response.status_code < 300:
|
|
266
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
267
|
+
if _response.status_code == 422:
|
|
268
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
269
|
+
try:
|
|
270
|
+
_response_json = _response.json()
|
|
271
|
+
except JSONDecodeError:
|
|
272
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
273
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
274
|
+
|
|
292
275
|
def chat_with_chat_app(self, id: str, *, messages: typing.Optional[typing.List[InputMessage]] = OMIT) -> typing.Any:
|
|
293
276
|
"""
|
|
294
277
|
Chat with a chat app.
|
|
@@ -371,10 +354,9 @@ class AsyncChatAppsClient:
|
|
|
371
354
|
project_id: typing.Optional[str] = None,
|
|
372
355
|
organization_id: typing.Optional[str] = None,
|
|
373
356
|
name: str,
|
|
374
|
-
|
|
357
|
+
retriever_id: str,
|
|
375
358
|
llm_config: LlmParameters,
|
|
376
|
-
retrieval_config:
|
|
377
|
-
chat_app_create_project_id: str,
|
|
359
|
+
retrieval_config: PresetCompositeRetrievalParams,
|
|
378
360
|
) -> ChatApp:
|
|
379
361
|
"""
|
|
380
362
|
Create a new chat app.
|
|
@@ -384,22 +366,18 @@ class AsyncChatAppsClient:
|
|
|
384
366
|
|
|
385
367
|
- organization_id: typing.Optional[str].
|
|
386
368
|
|
|
387
|
-
- name: str.
|
|
369
|
+
- name: str. Name of the chat app
|
|
388
370
|
|
|
389
|
-
-
|
|
371
|
+
- retriever_id: str. ID of the retriever to use for the chat app
|
|
390
372
|
|
|
391
|
-
- llm_config: LlmParameters.
|
|
373
|
+
- llm_config: LlmParameters. Configuration for the LLM model to use for the chat app
|
|
392
374
|
|
|
393
|
-
- retrieval_config:
|
|
394
|
-
|
|
395
|
-
- chat_app_create_project_id: str.
|
|
375
|
+
- retrieval_config: PresetCompositeRetrievalParams. Configuration for the retrieval model to use for the chat app
|
|
396
376
|
---
|
|
397
377
|
from llama_cloud import (
|
|
398
|
-
|
|
378
|
+
CompositeRetrievalMode,
|
|
399
379
|
LlmParameters,
|
|
400
|
-
|
|
401
|
-
PresetRetrievalParams,
|
|
402
|
-
RetrievalMode,
|
|
380
|
+
PresetCompositeRetrievalParams,
|
|
403
381
|
SupportedLlmModelNames,
|
|
404
382
|
)
|
|
405
383
|
from llama_cloud.client import AsyncLlamaCloud
|
|
@@ -409,18 +387,13 @@ class AsyncChatAppsClient:
|
|
|
409
387
|
)
|
|
410
388
|
await client.chat_apps.create_chat_app_api_v_1_apps_post(
|
|
411
389
|
name="string",
|
|
412
|
-
|
|
390
|
+
retriever_id="string",
|
|
413
391
|
llm_config=LlmParameters(
|
|
414
392
|
model_name=SupportedLlmModelNames.GPT_3_5_TURBO,
|
|
415
393
|
),
|
|
416
|
-
retrieval_config=
|
|
417
|
-
|
|
418
|
-
filters=[],
|
|
419
|
-
condition=FilterCondition.AND,
|
|
420
|
-
),
|
|
421
|
-
retrieval_mode=RetrievalMode.CHUNKS,
|
|
394
|
+
retrieval_config=PresetCompositeRetrievalParams(
|
|
395
|
+
mode=CompositeRetrievalMode.ROUTING,
|
|
422
396
|
),
|
|
423
|
-
chat_app_create_project_id="string",
|
|
424
397
|
)
|
|
425
398
|
"""
|
|
426
399
|
_response = await self._client_wrapper.httpx_client.request(
|
|
@@ -430,10 +403,9 @@ class AsyncChatAppsClient:
|
|
|
430
403
|
json=jsonable_encoder(
|
|
431
404
|
{
|
|
432
405
|
"name": name,
|
|
433
|
-
"
|
|
406
|
+
"retriever_id": retriever_id,
|
|
434
407
|
"llm_config": llm_config,
|
|
435
408
|
"retrieval_config": retrieval_config,
|
|
436
|
-
"project_id": chat_app_create_project_id,
|
|
437
409
|
}
|
|
438
410
|
),
|
|
439
411
|
headers=self._client_wrapper.get_headers(),
|
|
@@ -481,36 +453,6 @@ class AsyncChatAppsClient:
|
|
|
481
453
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
482
454
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
483
455
|
|
|
484
|
-
async def delete_chat_app(self, id: str) -> typing.Any:
|
|
485
|
-
"""
|
|
486
|
-
Parameters:
|
|
487
|
-
- id: str.
|
|
488
|
-
---
|
|
489
|
-
from llama_cloud.client import AsyncLlamaCloud
|
|
490
|
-
|
|
491
|
-
client = AsyncLlamaCloud(
|
|
492
|
-
token="YOUR_TOKEN",
|
|
493
|
-
)
|
|
494
|
-
await client.chat_apps.delete_chat_app(
|
|
495
|
-
id="string",
|
|
496
|
-
)
|
|
497
|
-
"""
|
|
498
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
499
|
-
"DELETE",
|
|
500
|
-
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/apps/{id}"),
|
|
501
|
-
headers=self._client_wrapper.get_headers(),
|
|
502
|
-
timeout=60,
|
|
503
|
-
)
|
|
504
|
-
if 200 <= _response.status_code < 300:
|
|
505
|
-
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
506
|
-
if _response.status_code == 422:
|
|
507
|
-
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
508
|
-
try:
|
|
509
|
-
_response_json = _response.json()
|
|
510
|
-
except JSONDecodeError:
|
|
511
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
512
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
513
|
-
|
|
514
456
|
async def update_chat_app(
|
|
515
457
|
self,
|
|
516
458
|
id: str,
|
|
@@ -519,7 +461,7 @@ class AsyncChatAppsClient:
|
|
|
519
461
|
organization_id: typing.Optional[str] = None,
|
|
520
462
|
name: typing.Optional[str] = OMIT,
|
|
521
463
|
llm_config: typing.Optional[LlmParameters] = OMIT,
|
|
522
|
-
retrieval_config: typing.Optional[
|
|
464
|
+
retrieval_config: typing.Optional[PresetCompositeRetrievalParams] = OMIT,
|
|
523
465
|
) -> ChatApp:
|
|
524
466
|
"""
|
|
525
467
|
Update a chat app.
|
|
@@ -535,14 +477,12 @@ class AsyncChatAppsClient:
|
|
|
535
477
|
|
|
536
478
|
- llm_config: typing.Optional[LlmParameters].
|
|
537
479
|
|
|
538
|
-
- retrieval_config: typing.Optional[
|
|
480
|
+
- retrieval_config: typing.Optional[PresetCompositeRetrievalParams].
|
|
539
481
|
---
|
|
540
482
|
from llama_cloud import (
|
|
541
|
-
|
|
483
|
+
CompositeRetrievalMode,
|
|
542
484
|
LlmParameters,
|
|
543
|
-
|
|
544
|
-
PresetRetrievalParams,
|
|
545
|
-
RetrievalMode,
|
|
485
|
+
PresetCompositeRetrievalParams,
|
|
546
486
|
SupportedLlmModelNames,
|
|
547
487
|
)
|
|
548
488
|
from llama_cloud.client import AsyncLlamaCloud
|
|
@@ -555,12 +495,8 @@ class AsyncChatAppsClient:
|
|
|
555
495
|
llm_config=LlmParameters(
|
|
556
496
|
model_name=SupportedLlmModelNames.GPT_3_5_TURBO,
|
|
557
497
|
),
|
|
558
|
-
retrieval_config=
|
|
559
|
-
|
|
560
|
-
filters=[],
|
|
561
|
-
condition=FilterCondition.AND,
|
|
562
|
-
),
|
|
563
|
-
retrieval_mode=RetrievalMode.CHUNKS,
|
|
498
|
+
retrieval_config=PresetCompositeRetrievalParams(
|
|
499
|
+
mode=CompositeRetrievalMode.ROUTING,
|
|
564
500
|
),
|
|
565
501
|
)
|
|
566
502
|
"""
|
|
@@ -572,7 +508,7 @@ class AsyncChatAppsClient:
|
|
|
572
508
|
if retrieval_config is not OMIT:
|
|
573
509
|
_request["retrieval_config"] = retrieval_config
|
|
574
510
|
_response = await self._client_wrapper.httpx_client.request(
|
|
575
|
-
"
|
|
511
|
+
"PUT",
|
|
576
512
|
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/apps/{id}"),
|
|
577
513
|
params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
|
|
578
514
|
json=jsonable_encoder(_request),
|
|
@@ -589,6 +525,36 @@ class AsyncChatAppsClient:
|
|
|
589
525
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
590
526
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
591
527
|
|
|
528
|
+
async def delete_chat_app(self, id: str) -> typing.Any:
|
|
529
|
+
"""
|
|
530
|
+
Parameters:
|
|
531
|
+
- id: str.
|
|
532
|
+
---
|
|
533
|
+
from llama_cloud.client import AsyncLlamaCloud
|
|
534
|
+
|
|
535
|
+
client = AsyncLlamaCloud(
|
|
536
|
+
token="YOUR_TOKEN",
|
|
537
|
+
)
|
|
538
|
+
await client.chat_apps.delete_chat_app(
|
|
539
|
+
id="string",
|
|
540
|
+
)
|
|
541
|
+
"""
|
|
542
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
543
|
+
"DELETE",
|
|
544
|
+
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/apps/{id}"),
|
|
545
|
+
headers=self._client_wrapper.get_headers(),
|
|
546
|
+
timeout=60,
|
|
547
|
+
)
|
|
548
|
+
if 200 <= _response.status_code < 300:
|
|
549
|
+
return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
|
|
550
|
+
if _response.status_code == 422:
|
|
551
|
+
raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
|
|
552
|
+
try:
|
|
553
|
+
_response_json = _response.json()
|
|
554
|
+
except JSONDecodeError:
|
|
555
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
556
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
557
|
+
|
|
592
558
|
async def chat_with_chat_app(
|
|
593
559
|
self, id: str, *, messages: typing.Optional[typing.List[InputMessage]] = OMIT
|
|
594
560
|
) -> typing.Any:
|
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
|
-
from .types import
|
|
3
|
+
from .types import (
|
|
4
|
+
ExtractAgentCreateDataSchema,
|
|
5
|
+
ExtractAgentCreateDataSchemaZeroValue,
|
|
6
|
+
ExtractAgentUpdateDataSchema,
|
|
7
|
+
ExtractAgentUpdateDataSchemaZeroValue,
|
|
8
|
+
ExtractSchemaValidateRequestDataSchema,
|
|
9
|
+
ExtractSchemaValidateRequestDataSchemaZeroValue,
|
|
10
|
+
)
|
|
4
11
|
|
|
5
|
-
__all__ = [
|
|
12
|
+
__all__ = [
|
|
13
|
+
"ExtractAgentCreateDataSchema",
|
|
14
|
+
"ExtractAgentCreateDataSchemaZeroValue",
|
|
15
|
+
"ExtractAgentUpdateDataSchema",
|
|
16
|
+
"ExtractAgentUpdateDataSchemaZeroValue",
|
|
17
|
+
"ExtractSchemaValidateRequestDataSchema",
|
|
18
|
+
"ExtractSchemaValidateRequestDataSchemaZeroValue",
|
|
19
|
+
]
|