llama-cloud 0.1.39__py3-none-any.whl → 0.1.41__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.
Files changed (61) hide show
  1. llama_cloud/__init__.py +24 -72
  2. llama_cloud/client.py +2 -5
  3. llama_cloud/resources/__init__.py +0 -4
  4. llama_cloud/resources/admin/client.py +5 -5
  5. llama_cloud/resources/beta/client.py +1351 -335
  6. llama_cloud/resources/llama_extract/client.py +56 -0
  7. llama_cloud/resources/parsing/client.py +8 -0
  8. llama_cloud/resources/pipelines/client.py +37 -0
  9. llama_cloud/types/__init__.py +24 -72
  10. llama_cloud/types/{src_app_schema_chat_chat_message.py → chat_message.py} +1 -1
  11. llama_cloud/types/extract_config.py +8 -2
  12. llama_cloud/types/extract_job_create.py +2 -0
  13. llama_cloud/types/extract_job_create_priority.py +29 -0
  14. llama_cloud/types/extract_models.py +28 -28
  15. llama_cloud/types/job_names.py +0 -4
  16. llama_cloud/types/{document_block.py → llama_extract_feature_availability.py} +5 -6
  17. llama_cloud/types/llama_extract_mode_availability.py +4 -3
  18. llama_cloud/types/llama_extract_settings.py +1 -1
  19. llama_cloud/types/llama_parse_parameters.py +1 -0
  20. llama_cloud/types/{progress_event.py → parse_configuration.py} +12 -12
  21. llama_cloud/types/{llama_index_core_base_llms_types_chat_message.py → parse_configuration_create.py} +9 -7
  22. llama_cloud/types/{edit_suggestion.py → parse_configuration_filter.py} +8 -6
  23. llama_cloud/types/{report_update_event.py → parse_configuration_query_response.py} +6 -6
  24. llama_cloud/types/parse_job_config.py +1 -0
  25. llama_cloud/types/pipeline.py +4 -0
  26. llama_cloud/types/pipeline_create.py +2 -0
  27. llama_cloud/types/playground_session.py +2 -2
  28. llama_cloud/types/public_model_name.py +97 -0
  29. llama_cloud/types/{report_create_response.py → schema_generation_availability.py} +4 -2
  30. llama_cloud/types/schema_generation_availability_status.py +17 -0
  31. llama_cloud/types/{report_event_item.py → sparse_model_config.py} +10 -8
  32. llama_cloud/types/sparse_model_type.py +33 -0
  33. llama_cloud/types/webhook_configuration.py +1 -0
  34. llama_cloud-0.1.41.dist-info/METADATA +106 -0
  35. {llama_cloud-0.1.39.dist-info → llama_cloud-0.1.41.dist-info}/RECORD +37 -56
  36. {llama_cloud-0.1.39.dist-info → llama_cloud-0.1.41.dist-info}/WHEEL +1 -1
  37. llama_cloud/resources/reports/__init__.py +0 -5
  38. llama_cloud/resources/reports/client.py +0 -1230
  39. llama_cloud/resources/reports/types/__init__.py +0 -7
  40. llama_cloud/resources/reports/types/update_report_plan_api_v_1_reports_report_id_plan_patch_request_action.py +0 -25
  41. llama_cloud/types/audio_block.py +0 -34
  42. llama_cloud/types/edit_suggestion_blocks_item.py +0 -8
  43. llama_cloud/types/image_block.py +0 -35
  44. llama_cloud/types/llama_index_core_base_llms_types_chat_message_blocks_item.py +0 -56
  45. llama_cloud/types/paginated_report_response.py +0 -35
  46. llama_cloud/types/progress_event_status.py +0 -33
  47. llama_cloud/types/report.py +0 -33
  48. llama_cloud/types/report_block.py +0 -35
  49. llama_cloud/types/report_block_dependency.py +0 -29
  50. llama_cloud/types/report_event_item_event_data.py +0 -45
  51. llama_cloud/types/report_event_type.py +0 -37
  52. llama_cloud/types/report_metadata.py +0 -43
  53. llama_cloud/types/report_plan.py +0 -36
  54. llama_cloud/types/report_plan_block.py +0 -36
  55. llama_cloud/types/report_query.py +0 -33
  56. llama_cloud/types/report_response.py +0 -41
  57. llama_cloud/types/report_state.py +0 -37
  58. llama_cloud/types/report_state_event.py +0 -38
  59. llama_cloud/types/text_block.py +0 -31
  60. llama_cloud-0.1.39.dist-info/METADATA +0 -32
  61. {llama_cloud-0.1.39.dist-info → llama_cloud-0.1.41.dist-info}/LICENSE +0 -0
@@ -1,1230 +0,0 @@
1
- # This file was auto-generated by Fern from our API Definition.
2
-
3
- import datetime as dt
4
- import typing
5
- import urllib.parse
6
- from json.decoder import JSONDecodeError
7
-
8
- from ...core.api_error import ApiError
9
- from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
10
- from ...core.datetime_utils import serialize_datetime
11
- from ...core.jsonable_encoder import jsonable_encoder
12
- from ...core.remove_none_from_dict import remove_none_from_dict
13
- from ...errors.unprocessable_entity_error import UnprocessableEntityError
14
- from ...types.edit_suggestion import EditSuggestion
15
- from ...types.http_validation_error import HttpValidationError
16
- from ...types.llama_index_core_base_llms_types_chat_message import LlamaIndexCoreBaseLlmsTypesChatMessage
17
- from ...types.paginated_report_response import PaginatedReportResponse
18
- from ...types.report import Report
19
- from ...types.report_create_response import ReportCreateResponse
20
- from ...types.report_event_item import ReportEventItem
21
- from ...types.report_metadata import ReportMetadata
22
- from ...types.report_plan import ReportPlan
23
- from ...types.report_response import ReportResponse
24
- from ...types.report_state import ReportState
25
- from .types.update_report_plan_api_v_1_reports_report_id_plan_patch_request_action import (
26
- UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction,
27
- )
28
-
29
- try:
30
- import pydantic
31
- if pydantic.__version__.startswith("1."):
32
- raise ImportError
33
- import pydantic.v1 as pydantic # type: ignore
34
- except ImportError:
35
- import pydantic # type: ignore
36
-
37
- # this is used as the default value for optional parameters
38
- OMIT = typing.cast(typing.Any, ...)
39
-
40
-
41
- class ReportsClient:
42
- def __init__(self, *, client_wrapper: SyncClientWrapper):
43
- self._client_wrapper = client_wrapper
44
-
45
- def create_report_api_v_1_reports_post(
46
- self,
47
- *,
48
- project_id: typing.Optional[str] = None,
49
- organization_id: typing.Optional[str] = None,
50
- name: str,
51
- template_text: str,
52
- template_instructions: typing.Optional[str] = OMIT,
53
- existing_retriever_id: typing.Optional[str] = OMIT,
54
- files: typing.List[str],
55
- template_file: typing.Optional[str] = OMIT,
56
- ) -> ReportCreateResponse:
57
- """
58
- Create a new report.
59
-
60
- Parameters:
61
- - project_id: typing.Optional[str].
62
-
63
- - organization_id: typing.Optional[str].
64
-
65
- - name: str.
66
-
67
- - template_text: str.
68
-
69
- - template_instructions: typing.Optional[str].
70
-
71
- - existing_retriever_id: typing.Optional[str].
72
-
73
- - files: typing.List[str].
74
-
75
- - template_file: typing.Optional[str].
76
- """
77
- _request: typing.Dict[str, typing.Any] = {"name": name, "template_text": template_text, "files": files}
78
- if template_instructions is not OMIT:
79
- _request["template_instructions"] = template_instructions
80
- if existing_retriever_id is not OMIT:
81
- _request["existing_retriever_id"] = existing_retriever_id
82
- if template_file is not OMIT:
83
- _request["template_file"] = template_file
84
- _response = self._client_wrapper.httpx_client.request(
85
- "POST",
86
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/reports"),
87
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
88
- json=jsonable_encoder(_request),
89
- headers=self._client_wrapper.get_headers(),
90
- timeout=60,
91
- )
92
- if 200 <= _response.status_code < 300:
93
- return pydantic.parse_obj_as(ReportCreateResponse, _response.json()) # type: ignore
94
- if _response.status_code == 422:
95
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
96
- try:
97
- _response_json = _response.json()
98
- except JSONDecodeError:
99
- raise ApiError(status_code=_response.status_code, body=_response.text)
100
- raise ApiError(status_code=_response.status_code, body=_response_json)
101
-
102
- def list_reports(
103
- self,
104
- *,
105
- state: typing.Optional[ReportState] = None,
106
- limit: typing.Optional[int] = None,
107
- offset: typing.Optional[int] = None,
108
- project_id: typing.Optional[str] = None,
109
- organization_id: typing.Optional[str] = None,
110
- ) -> PaginatedReportResponse:
111
- """
112
- List all reports for a project.
113
-
114
- Parameters:
115
- - state: typing.Optional[ReportState].
116
-
117
- - limit: typing.Optional[int].
118
-
119
- - offset: typing.Optional[int].
120
-
121
- - project_id: typing.Optional[str].
122
-
123
- - organization_id: typing.Optional[str].
124
- ---
125
- from llama_cloud import ReportState
126
- from llama_cloud.client import LlamaCloud
127
-
128
- client = LlamaCloud(
129
- token="YOUR_TOKEN",
130
- )
131
- client.reports.list_reports(
132
- state=ReportState.PENDING,
133
- )
134
- """
135
- _response = self._client_wrapper.httpx_client.request(
136
- "GET",
137
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/reports/list"),
138
- params=remove_none_from_dict(
139
- {
140
- "state": state,
141
- "limit": limit,
142
- "offset": offset,
143
- "project_id": project_id,
144
- "organization_id": organization_id,
145
- }
146
- ),
147
- headers=self._client_wrapper.get_headers(),
148
- timeout=60,
149
- )
150
- if 200 <= _response.status_code < 300:
151
- return pydantic.parse_obj_as(PaginatedReportResponse, _response.json()) # type: ignore
152
- if _response.status_code == 422:
153
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
154
- try:
155
- _response_json = _response.json()
156
- except JSONDecodeError:
157
- raise ApiError(status_code=_response.status_code, body=_response.text)
158
- raise ApiError(status_code=_response.status_code, body=_response_json)
159
-
160
- def get_report(
161
- self,
162
- report_id: str,
163
- *,
164
- version: typing.Optional[int] = None,
165
- project_id: typing.Optional[str] = None,
166
- organization_id: typing.Optional[str] = None,
167
- ) -> ReportResponse:
168
- """
169
- Get a specific report.
170
-
171
- Parameters:
172
- - report_id: str.
173
-
174
- - version: typing.Optional[int].
175
-
176
- - project_id: typing.Optional[str].
177
-
178
- - organization_id: typing.Optional[str].
179
- ---
180
- from llama_cloud.client import LlamaCloud
181
-
182
- client = LlamaCloud(
183
- token="YOUR_TOKEN",
184
- )
185
- client.reports.get_report(
186
- report_id="string",
187
- )
188
- """
189
- _response = self._client_wrapper.httpx_client.request(
190
- "GET",
191
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
192
- params=remove_none_from_dict(
193
- {"version": version, "project_id": project_id, "organization_id": organization_id}
194
- ),
195
- headers=self._client_wrapper.get_headers(),
196
- timeout=60,
197
- )
198
- if 200 <= _response.status_code < 300:
199
- return pydantic.parse_obj_as(ReportResponse, _response.json()) # type: ignore
200
- if _response.status_code == 422:
201
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
202
- try:
203
- _response_json = _response.json()
204
- except JSONDecodeError:
205
- raise ApiError(status_code=_response.status_code, body=_response.text)
206
- raise ApiError(status_code=_response.status_code, body=_response_json)
207
-
208
- def update_report_metadata(
209
- self,
210
- report_id: str,
211
- *,
212
- project_id: typing.Optional[str] = None,
213
- organization_id: typing.Optional[str] = None,
214
- name: str,
215
- ) -> ReportMetadata:
216
- """
217
- Update metadata for a report.
218
-
219
- Parameters:
220
- - report_id: str.
221
-
222
- - project_id: typing.Optional[str].
223
-
224
- - organization_id: typing.Optional[str].
225
-
226
- - name: str. The name of the report
227
- ---
228
- from llama_cloud.client import LlamaCloud
229
-
230
- client = LlamaCloud(
231
- token="YOUR_TOKEN",
232
- )
233
- client.reports.update_report_metadata(
234
- report_id="string",
235
- name="string",
236
- )
237
- """
238
- _response = self._client_wrapper.httpx_client.request(
239
- "POST",
240
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
241
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
242
- json=jsonable_encoder({"name": name}),
243
- headers=self._client_wrapper.get_headers(),
244
- timeout=60,
245
- )
246
- if 200 <= _response.status_code < 300:
247
- return pydantic.parse_obj_as(ReportMetadata, _response.json()) # type: ignore
248
- if _response.status_code == 422:
249
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
250
- try:
251
- _response_json = _response.json()
252
- except JSONDecodeError:
253
- raise ApiError(status_code=_response.status_code, body=_response.text)
254
- raise ApiError(status_code=_response.status_code, body=_response_json)
255
-
256
- def delete_report(
257
- self,
258
- report_id: str,
259
- *,
260
- cascade_delete: typing.Optional[bool] = None,
261
- project_id: typing.Optional[str] = None,
262
- organization_id: typing.Optional[str] = None,
263
- ) -> typing.Any:
264
- """
265
- Delete a report.
266
-
267
- Parameters:
268
- - report_id: str.
269
-
270
- - cascade_delete: typing.Optional[bool]. Whether to delete associated retriever and pipeline data
271
-
272
- - project_id: typing.Optional[str].
273
-
274
- - organization_id: typing.Optional[str].
275
- ---
276
- from llama_cloud.client import LlamaCloud
277
-
278
- client = LlamaCloud(
279
- token="YOUR_TOKEN",
280
- )
281
- client.reports.delete_report(
282
- report_id="string",
283
- )
284
- """
285
- _response = self._client_wrapper.httpx_client.request(
286
- "DELETE",
287
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
288
- params=remove_none_from_dict(
289
- {"cascade_delete": cascade_delete, "project_id": project_id, "organization_id": organization_id}
290
- ),
291
- headers=self._client_wrapper.get_headers(),
292
- timeout=60,
293
- )
294
- if 200 <= _response.status_code < 300:
295
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
296
- if _response.status_code == 422:
297
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
298
- try:
299
- _response_json = _response.json()
300
- except JSONDecodeError:
301
- raise ApiError(status_code=_response.status_code, body=_response.text)
302
- raise ApiError(status_code=_response.status_code, body=_response_json)
303
-
304
- def update_report(
305
- self,
306
- report_id: str,
307
- *,
308
- project_id: typing.Optional[str] = None,
309
- organization_id: typing.Optional[str] = None,
310
- content: Report,
311
- ) -> ReportResponse:
312
- """
313
- Update a report's content.
314
-
315
- Parameters:
316
- - report_id: str.
317
-
318
- - project_id: typing.Optional[str].
319
-
320
- - organization_id: typing.Optional[str].
321
-
322
- - content: Report. The content of the report version
323
- ---
324
- from llama_cloud import Report
325
- from llama_cloud.client import LlamaCloud
326
-
327
- client = LlamaCloud(
328
- token="YOUR_TOKEN",
329
- )
330
- client.reports.update_report(
331
- report_id="string",
332
- content=Report(
333
- id="string",
334
- ),
335
- )
336
- """
337
- _response = self._client_wrapper.httpx_client.request(
338
- "PATCH",
339
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
340
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
341
- json=jsonable_encoder({"content": content}),
342
- headers=self._client_wrapper.get_headers(),
343
- timeout=60,
344
- )
345
- if 200 <= _response.status_code < 300:
346
- return pydantic.parse_obj_as(ReportResponse, _response.json()) # type: ignore
347
- if _response.status_code == 422:
348
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
349
- try:
350
- _response_json = _response.json()
351
- except JSONDecodeError:
352
- raise ApiError(status_code=_response.status_code, body=_response.text)
353
- raise ApiError(status_code=_response.status_code, body=_response_json)
354
-
355
- def get_report_plan(
356
- self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
357
- ) -> ReportPlan:
358
- """
359
- Get the plan for a report.
360
-
361
- Parameters:
362
- - report_id: str.
363
-
364
- - project_id: typing.Optional[str].
365
-
366
- - organization_id: typing.Optional[str].
367
- ---
368
- from llama_cloud.client import LlamaCloud
369
-
370
- client = LlamaCloud(
371
- token="YOUR_TOKEN",
372
- )
373
- client.reports.get_report_plan(
374
- report_id="string",
375
- )
376
- """
377
- _response = self._client_wrapper.httpx_client.request(
378
- "GET",
379
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/plan"),
380
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
381
- headers=self._client_wrapper.get_headers(),
382
- timeout=60,
383
- )
384
- if 200 <= _response.status_code < 300:
385
- return pydantic.parse_obj_as(ReportPlan, _response.json()) # type: ignore
386
- if _response.status_code == 422:
387
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
388
- try:
389
- _response_json = _response.json()
390
- except JSONDecodeError:
391
- raise ApiError(status_code=_response.status_code, body=_response.text)
392
- raise ApiError(status_code=_response.status_code, body=_response_json)
393
-
394
- def update_report_plan(
395
- self,
396
- report_id: str,
397
- *,
398
- action: UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction,
399
- project_id: typing.Optional[str] = None,
400
- organization_id: typing.Optional[str] = None,
401
- request: typing.Optional[ReportPlan] = None,
402
- ) -> ReportResponse:
403
- """
404
- Update the plan of a report, including approval, rejection, and editing.
405
-
406
- Parameters:
407
- - report_id: str.
408
-
409
- - action: UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction.
410
-
411
- - project_id: typing.Optional[str].
412
-
413
- - organization_id: typing.Optional[str].
414
-
415
- - request: typing.Optional[ReportPlan].
416
- ---
417
- from llama_cloud import (
418
- ReportPlan,
419
- UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction,
420
- )
421
- from llama_cloud.client import LlamaCloud
422
-
423
- client = LlamaCloud(
424
- token="YOUR_TOKEN",
425
- )
426
- client.reports.update_report_plan(
427
- report_id="string",
428
- action=UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction.APPROVE,
429
- request=ReportPlan(),
430
- )
431
- """
432
- _response = self._client_wrapper.httpx_client.request(
433
- "PATCH",
434
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/plan"),
435
- params=remove_none_from_dict(
436
- {"action": action, "project_id": project_id, "organization_id": organization_id}
437
- ),
438
- json=jsonable_encoder(request),
439
- headers=self._client_wrapper.get_headers(),
440
- timeout=60,
441
- )
442
- if 200 <= _response.status_code < 300:
443
- return pydantic.parse_obj_as(ReportResponse, _response.json()) # type: ignore
444
- if _response.status_code == 422:
445
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
446
- try:
447
- _response_json = _response.json()
448
- except JSONDecodeError:
449
- raise ApiError(status_code=_response.status_code, body=_response.text)
450
- raise ApiError(status_code=_response.status_code, body=_response_json)
451
-
452
- def get_report_events(
453
- self,
454
- report_id: str,
455
- *,
456
- after: typing.Optional[dt.datetime] = None,
457
- project_id: typing.Optional[str] = None,
458
- organization_id: typing.Optional[str] = None,
459
- ) -> typing.List[ReportEventItem]:
460
- """
461
- Get all historical events for a report.
462
-
463
- Parameters:
464
- - report_id: str.
465
-
466
- - after: typing.Optional[dt.datetime].
467
-
468
- - project_id: typing.Optional[str].
469
-
470
- - organization_id: typing.Optional[str].
471
- ---
472
- from llama_cloud.client import LlamaCloud
473
-
474
- client = LlamaCloud(
475
- token="YOUR_TOKEN",
476
- )
477
- client.reports.get_report_events(
478
- report_id="string",
479
- )
480
- """
481
- _response = self._client_wrapper.httpx_client.request(
482
- "GET",
483
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/events"),
484
- params=remove_none_from_dict(
485
- {
486
- "after": serialize_datetime(after) if after is not None else None,
487
- "project_id": project_id,
488
- "organization_id": organization_id,
489
- }
490
- ),
491
- headers=self._client_wrapper.get_headers(),
492
- timeout=60,
493
- )
494
- if 200 <= _response.status_code < 300:
495
- return pydantic.parse_obj_as(typing.List[ReportEventItem], _response.json()) # type: ignore
496
- if _response.status_code == 422:
497
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
498
- try:
499
- _response_json = _response.json()
500
- except JSONDecodeError:
501
- raise ApiError(status_code=_response.status_code, body=_response.text)
502
- raise ApiError(status_code=_response.status_code, body=_response_json)
503
-
504
- def get_report_metadata(
505
- self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
506
- ) -> ReportMetadata:
507
- """
508
- Get metadata for a report.
509
-
510
- Parameters:
511
- - report_id: str.
512
-
513
- - project_id: typing.Optional[str].
514
-
515
- - organization_id: typing.Optional[str].
516
- ---
517
- from llama_cloud.client import LlamaCloud
518
-
519
- client = LlamaCloud(
520
- token="YOUR_TOKEN",
521
- )
522
- client.reports.get_report_metadata(
523
- report_id="string",
524
- )
525
- """
526
- _response = self._client_wrapper.httpx_client.request(
527
- "GET",
528
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/metadata"),
529
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
530
- headers=self._client_wrapper.get_headers(),
531
- timeout=60,
532
- )
533
- if 200 <= _response.status_code < 300:
534
- return pydantic.parse_obj_as(ReportMetadata, _response.json()) # type: ignore
535
- if _response.status_code == 422:
536
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
537
- try:
538
- _response_json = _response.json()
539
- except JSONDecodeError:
540
- raise ApiError(status_code=_response.status_code, body=_response.text)
541
- raise ApiError(status_code=_response.status_code, body=_response_json)
542
-
543
- def suggest_edits_endpoint(
544
- self,
545
- report_id: str,
546
- *,
547
- project_id: typing.Optional[str] = None,
548
- organization_id: typing.Optional[str] = None,
549
- user_query: str,
550
- chat_history: typing.List[LlamaIndexCoreBaseLlmsTypesChatMessage],
551
- ) -> typing.List[EditSuggestion]:
552
- """
553
- Suggest edits to a report based on user query and chat history.
554
-
555
- Parameters:
556
- - report_id: str.
557
-
558
- - project_id: typing.Optional[str].
559
-
560
- - organization_id: typing.Optional[str].
561
-
562
- - user_query: str.
563
-
564
- - chat_history: typing.List[LlamaIndexCoreBaseLlmsTypesChatMessage].
565
- ---
566
- from llama_cloud.client import LlamaCloud
567
-
568
- client = LlamaCloud(
569
- token="YOUR_TOKEN",
570
- )
571
- client.reports.suggest_edits_endpoint(
572
- report_id="string",
573
- user_query="string",
574
- chat_history=[],
575
- )
576
- """
577
- _response = self._client_wrapper.httpx_client.request(
578
- "POST",
579
- urllib.parse.urljoin(
580
- f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/suggest_edits"
581
- ),
582
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
583
- json=jsonable_encoder({"user_query": user_query, "chat_history": chat_history}),
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[EditSuggestion], _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 restart_report(
598
- self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
599
- ) -> typing.Any:
600
- """
601
- Restart a report from scratch.
602
-
603
- Parameters:
604
- - report_id: str.
605
-
606
- - project_id: typing.Optional[str].
607
-
608
- - organization_id: typing.Optional[str].
609
- ---
610
- from llama_cloud.client import LlamaCloud
611
-
612
- client = LlamaCloud(
613
- token="YOUR_TOKEN",
614
- )
615
- client.reports.restart_report(
616
- report_id="string",
617
- )
618
- """
619
- _response = self._client_wrapper.httpx_client.request(
620
- "POST",
621
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/restart"),
622
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
623
- headers=self._client_wrapper.get_headers(),
624
- timeout=60,
625
- )
626
- if 200 <= _response.status_code < 300:
627
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
628
- if _response.status_code == 422:
629
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
630
- try:
631
- _response_json = _response.json()
632
- except JSONDecodeError:
633
- raise ApiError(status_code=_response.status_code, body=_response.text)
634
- raise ApiError(status_code=_response.status_code, body=_response_json)
635
-
636
-
637
- class AsyncReportsClient:
638
- def __init__(self, *, client_wrapper: AsyncClientWrapper):
639
- self._client_wrapper = client_wrapper
640
-
641
- async def create_report_api_v_1_reports_post(
642
- self,
643
- *,
644
- project_id: typing.Optional[str] = None,
645
- organization_id: typing.Optional[str] = None,
646
- name: str,
647
- template_text: str,
648
- template_instructions: typing.Optional[str] = OMIT,
649
- existing_retriever_id: typing.Optional[str] = OMIT,
650
- files: typing.List[str],
651
- template_file: typing.Optional[str] = OMIT,
652
- ) -> ReportCreateResponse:
653
- """
654
- Create a new report.
655
-
656
- Parameters:
657
- - project_id: typing.Optional[str].
658
-
659
- - organization_id: typing.Optional[str].
660
-
661
- - name: str.
662
-
663
- - template_text: str.
664
-
665
- - template_instructions: typing.Optional[str].
666
-
667
- - existing_retriever_id: typing.Optional[str].
668
-
669
- - files: typing.List[str].
670
-
671
- - template_file: typing.Optional[str].
672
- """
673
- _request: typing.Dict[str, typing.Any] = {"name": name, "template_text": template_text, "files": files}
674
- if template_instructions is not OMIT:
675
- _request["template_instructions"] = template_instructions
676
- if existing_retriever_id is not OMIT:
677
- _request["existing_retriever_id"] = existing_retriever_id
678
- if template_file is not OMIT:
679
- _request["template_file"] = template_file
680
- _response = await self._client_wrapper.httpx_client.request(
681
- "POST",
682
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/reports"),
683
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
684
- json=jsonable_encoder(_request),
685
- headers=self._client_wrapper.get_headers(),
686
- timeout=60,
687
- )
688
- if 200 <= _response.status_code < 300:
689
- return pydantic.parse_obj_as(ReportCreateResponse, _response.json()) # type: ignore
690
- if _response.status_code == 422:
691
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
692
- try:
693
- _response_json = _response.json()
694
- except JSONDecodeError:
695
- raise ApiError(status_code=_response.status_code, body=_response.text)
696
- raise ApiError(status_code=_response.status_code, body=_response_json)
697
-
698
- async def list_reports(
699
- self,
700
- *,
701
- state: typing.Optional[ReportState] = None,
702
- limit: typing.Optional[int] = None,
703
- offset: typing.Optional[int] = None,
704
- project_id: typing.Optional[str] = None,
705
- organization_id: typing.Optional[str] = None,
706
- ) -> PaginatedReportResponse:
707
- """
708
- List all reports for a project.
709
-
710
- Parameters:
711
- - state: typing.Optional[ReportState].
712
-
713
- - limit: typing.Optional[int].
714
-
715
- - offset: typing.Optional[int].
716
-
717
- - project_id: typing.Optional[str].
718
-
719
- - organization_id: typing.Optional[str].
720
- ---
721
- from llama_cloud import ReportState
722
- from llama_cloud.client import AsyncLlamaCloud
723
-
724
- client = AsyncLlamaCloud(
725
- token="YOUR_TOKEN",
726
- )
727
- await client.reports.list_reports(
728
- state=ReportState.PENDING,
729
- )
730
- """
731
- _response = await self._client_wrapper.httpx_client.request(
732
- "GET",
733
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/v1/reports/list"),
734
- params=remove_none_from_dict(
735
- {
736
- "state": state,
737
- "limit": limit,
738
- "offset": offset,
739
- "project_id": project_id,
740
- "organization_id": organization_id,
741
- }
742
- ),
743
- headers=self._client_wrapper.get_headers(),
744
- timeout=60,
745
- )
746
- if 200 <= _response.status_code < 300:
747
- return pydantic.parse_obj_as(PaginatedReportResponse, _response.json()) # type: ignore
748
- if _response.status_code == 422:
749
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
750
- try:
751
- _response_json = _response.json()
752
- except JSONDecodeError:
753
- raise ApiError(status_code=_response.status_code, body=_response.text)
754
- raise ApiError(status_code=_response.status_code, body=_response_json)
755
-
756
- async def get_report(
757
- self,
758
- report_id: str,
759
- *,
760
- version: typing.Optional[int] = None,
761
- project_id: typing.Optional[str] = None,
762
- organization_id: typing.Optional[str] = None,
763
- ) -> ReportResponse:
764
- """
765
- Get a specific report.
766
-
767
- Parameters:
768
- - report_id: str.
769
-
770
- - version: typing.Optional[int].
771
-
772
- - project_id: typing.Optional[str].
773
-
774
- - organization_id: typing.Optional[str].
775
- ---
776
- from llama_cloud.client import AsyncLlamaCloud
777
-
778
- client = AsyncLlamaCloud(
779
- token="YOUR_TOKEN",
780
- )
781
- await client.reports.get_report(
782
- report_id="string",
783
- )
784
- """
785
- _response = await self._client_wrapper.httpx_client.request(
786
- "GET",
787
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
788
- params=remove_none_from_dict(
789
- {"version": version, "project_id": project_id, "organization_id": organization_id}
790
- ),
791
- headers=self._client_wrapper.get_headers(),
792
- timeout=60,
793
- )
794
- if 200 <= _response.status_code < 300:
795
- return pydantic.parse_obj_as(ReportResponse, _response.json()) # type: ignore
796
- if _response.status_code == 422:
797
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
798
- try:
799
- _response_json = _response.json()
800
- except JSONDecodeError:
801
- raise ApiError(status_code=_response.status_code, body=_response.text)
802
- raise ApiError(status_code=_response.status_code, body=_response_json)
803
-
804
- async def update_report_metadata(
805
- self,
806
- report_id: str,
807
- *,
808
- project_id: typing.Optional[str] = None,
809
- organization_id: typing.Optional[str] = None,
810
- name: str,
811
- ) -> ReportMetadata:
812
- """
813
- Update metadata for a report.
814
-
815
- Parameters:
816
- - report_id: str.
817
-
818
- - project_id: typing.Optional[str].
819
-
820
- - organization_id: typing.Optional[str].
821
-
822
- - name: str. The name of the report
823
- ---
824
- from llama_cloud.client import AsyncLlamaCloud
825
-
826
- client = AsyncLlamaCloud(
827
- token="YOUR_TOKEN",
828
- )
829
- await client.reports.update_report_metadata(
830
- report_id="string",
831
- name="string",
832
- )
833
- """
834
- _response = await self._client_wrapper.httpx_client.request(
835
- "POST",
836
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
837
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
838
- json=jsonable_encoder({"name": name}),
839
- headers=self._client_wrapper.get_headers(),
840
- timeout=60,
841
- )
842
- if 200 <= _response.status_code < 300:
843
- return pydantic.parse_obj_as(ReportMetadata, _response.json()) # type: ignore
844
- if _response.status_code == 422:
845
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
846
- try:
847
- _response_json = _response.json()
848
- except JSONDecodeError:
849
- raise ApiError(status_code=_response.status_code, body=_response.text)
850
- raise ApiError(status_code=_response.status_code, body=_response_json)
851
-
852
- async def delete_report(
853
- self,
854
- report_id: str,
855
- *,
856
- cascade_delete: typing.Optional[bool] = None,
857
- project_id: typing.Optional[str] = None,
858
- organization_id: typing.Optional[str] = None,
859
- ) -> typing.Any:
860
- """
861
- Delete a report.
862
-
863
- Parameters:
864
- - report_id: str.
865
-
866
- - cascade_delete: typing.Optional[bool]. Whether to delete associated retriever and pipeline data
867
-
868
- - project_id: typing.Optional[str].
869
-
870
- - organization_id: typing.Optional[str].
871
- ---
872
- from llama_cloud.client import AsyncLlamaCloud
873
-
874
- client = AsyncLlamaCloud(
875
- token="YOUR_TOKEN",
876
- )
877
- await client.reports.delete_report(
878
- report_id="string",
879
- )
880
- """
881
- _response = await self._client_wrapper.httpx_client.request(
882
- "DELETE",
883
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
884
- params=remove_none_from_dict(
885
- {"cascade_delete": cascade_delete, "project_id": project_id, "organization_id": organization_id}
886
- ),
887
- headers=self._client_wrapper.get_headers(),
888
- timeout=60,
889
- )
890
- if 200 <= _response.status_code < 300:
891
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
892
- if _response.status_code == 422:
893
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
894
- try:
895
- _response_json = _response.json()
896
- except JSONDecodeError:
897
- raise ApiError(status_code=_response.status_code, body=_response.text)
898
- raise ApiError(status_code=_response.status_code, body=_response_json)
899
-
900
- async def update_report(
901
- self,
902
- report_id: str,
903
- *,
904
- project_id: typing.Optional[str] = None,
905
- organization_id: typing.Optional[str] = None,
906
- content: Report,
907
- ) -> ReportResponse:
908
- """
909
- Update a report's content.
910
-
911
- Parameters:
912
- - report_id: str.
913
-
914
- - project_id: typing.Optional[str].
915
-
916
- - organization_id: typing.Optional[str].
917
-
918
- - content: Report. The content of the report version
919
- ---
920
- from llama_cloud import Report
921
- from llama_cloud.client import AsyncLlamaCloud
922
-
923
- client = AsyncLlamaCloud(
924
- token="YOUR_TOKEN",
925
- )
926
- await client.reports.update_report(
927
- report_id="string",
928
- content=Report(
929
- id="string",
930
- ),
931
- )
932
- """
933
- _response = await self._client_wrapper.httpx_client.request(
934
- "PATCH",
935
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}"),
936
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
937
- json=jsonable_encoder({"content": content}),
938
- headers=self._client_wrapper.get_headers(),
939
- timeout=60,
940
- )
941
- if 200 <= _response.status_code < 300:
942
- return pydantic.parse_obj_as(ReportResponse, _response.json()) # type: ignore
943
- if _response.status_code == 422:
944
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
945
- try:
946
- _response_json = _response.json()
947
- except JSONDecodeError:
948
- raise ApiError(status_code=_response.status_code, body=_response.text)
949
- raise ApiError(status_code=_response.status_code, body=_response_json)
950
-
951
- async def get_report_plan(
952
- self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
953
- ) -> ReportPlan:
954
- """
955
- Get the plan for a report.
956
-
957
- Parameters:
958
- - report_id: str.
959
-
960
- - project_id: typing.Optional[str].
961
-
962
- - organization_id: typing.Optional[str].
963
- ---
964
- from llama_cloud.client import AsyncLlamaCloud
965
-
966
- client = AsyncLlamaCloud(
967
- token="YOUR_TOKEN",
968
- )
969
- await client.reports.get_report_plan(
970
- report_id="string",
971
- )
972
- """
973
- _response = await self._client_wrapper.httpx_client.request(
974
- "GET",
975
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/plan"),
976
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
977
- headers=self._client_wrapper.get_headers(),
978
- timeout=60,
979
- )
980
- if 200 <= _response.status_code < 300:
981
- return pydantic.parse_obj_as(ReportPlan, _response.json()) # type: ignore
982
- if _response.status_code == 422:
983
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
984
- try:
985
- _response_json = _response.json()
986
- except JSONDecodeError:
987
- raise ApiError(status_code=_response.status_code, body=_response.text)
988
- raise ApiError(status_code=_response.status_code, body=_response_json)
989
-
990
- async def update_report_plan(
991
- self,
992
- report_id: str,
993
- *,
994
- action: UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction,
995
- project_id: typing.Optional[str] = None,
996
- organization_id: typing.Optional[str] = None,
997
- request: typing.Optional[ReportPlan] = None,
998
- ) -> ReportResponse:
999
- """
1000
- Update the plan of a report, including approval, rejection, and editing.
1001
-
1002
- Parameters:
1003
- - report_id: str.
1004
-
1005
- - action: UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction.
1006
-
1007
- - project_id: typing.Optional[str].
1008
-
1009
- - organization_id: typing.Optional[str].
1010
-
1011
- - request: typing.Optional[ReportPlan].
1012
- ---
1013
- from llama_cloud import (
1014
- ReportPlan,
1015
- UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction,
1016
- )
1017
- from llama_cloud.client import AsyncLlamaCloud
1018
-
1019
- client = AsyncLlamaCloud(
1020
- token="YOUR_TOKEN",
1021
- )
1022
- await client.reports.update_report_plan(
1023
- report_id="string",
1024
- action=UpdateReportPlanApiV1ReportsReportIdPlanPatchRequestAction.APPROVE,
1025
- request=ReportPlan(),
1026
- )
1027
- """
1028
- _response = await self._client_wrapper.httpx_client.request(
1029
- "PATCH",
1030
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/plan"),
1031
- params=remove_none_from_dict(
1032
- {"action": action, "project_id": project_id, "organization_id": organization_id}
1033
- ),
1034
- json=jsonable_encoder(request),
1035
- headers=self._client_wrapper.get_headers(),
1036
- timeout=60,
1037
- )
1038
- if 200 <= _response.status_code < 300:
1039
- return pydantic.parse_obj_as(ReportResponse, _response.json()) # type: ignore
1040
- if _response.status_code == 422:
1041
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1042
- try:
1043
- _response_json = _response.json()
1044
- except JSONDecodeError:
1045
- raise ApiError(status_code=_response.status_code, body=_response.text)
1046
- raise ApiError(status_code=_response.status_code, body=_response_json)
1047
-
1048
- async def get_report_events(
1049
- self,
1050
- report_id: str,
1051
- *,
1052
- after: typing.Optional[dt.datetime] = None,
1053
- project_id: typing.Optional[str] = None,
1054
- organization_id: typing.Optional[str] = None,
1055
- ) -> typing.List[ReportEventItem]:
1056
- """
1057
- Get all historical events for a report.
1058
-
1059
- Parameters:
1060
- - report_id: str.
1061
-
1062
- - after: typing.Optional[dt.datetime].
1063
-
1064
- - project_id: typing.Optional[str].
1065
-
1066
- - organization_id: typing.Optional[str].
1067
- ---
1068
- from llama_cloud.client import AsyncLlamaCloud
1069
-
1070
- client = AsyncLlamaCloud(
1071
- token="YOUR_TOKEN",
1072
- )
1073
- await client.reports.get_report_events(
1074
- report_id="string",
1075
- )
1076
- """
1077
- _response = await self._client_wrapper.httpx_client.request(
1078
- "GET",
1079
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/events"),
1080
- params=remove_none_from_dict(
1081
- {
1082
- "after": serialize_datetime(after) if after is not None else None,
1083
- "project_id": project_id,
1084
- "organization_id": organization_id,
1085
- }
1086
- ),
1087
- headers=self._client_wrapper.get_headers(),
1088
- timeout=60,
1089
- )
1090
- if 200 <= _response.status_code < 300:
1091
- return pydantic.parse_obj_as(typing.List[ReportEventItem], _response.json()) # type: ignore
1092
- if _response.status_code == 422:
1093
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1094
- try:
1095
- _response_json = _response.json()
1096
- except JSONDecodeError:
1097
- raise ApiError(status_code=_response.status_code, body=_response.text)
1098
- raise ApiError(status_code=_response.status_code, body=_response_json)
1099
-
1100
- async def get_report_metadata(
1101
- self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
1102
- ) -> ReportMetadata:
1103
- """
1104
- Get metadata for a report.
1105
-
1106
- Parameters:
1107
- - report_id: str.
1108
-
1109
- - project_id: typing.Optional[str].
1110
-
1111
- - organization_id: typing.Optional[str].
1112
- ---
1113
- from llama_cloud.client import AsyncLlamaCloud
1114
-
1115
- client = AsyncLlamaCloud(
1116
- token="YOUR_TOKEN",
1117
- )
1118
- await client.reports.get_report_metadata(
1119
- report_id="string",
1120
- )
1121
- """
1122
- _response = await self._client_wrapper.httpx_client.request(
1123
- "GET",
1124
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/metadata"),
1125
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
1126
- headers=self._client_wrapper.get_headers(),
1127
- timeout=60,
1128
- )
1129
- if 200 <= _response.status_code < 300:
1130
- return pydantic.parse_obj_as(ReportMetadata, _response.json()) # type: ignore
1131
- if _response.status_code == 422:
1132
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1133
- try:
1134
- _response_json = _response.json()
1135
- except JSONDecodeError:
1136
- raise ApiError(status_code=_response.status_code, body=_response.text)
1137
- raise ApiError(status_code=_response.status_code, body=_response_json)
1138
-
1139
- async def suggest_edits_endpoint(
1140
- self,
1141
- report_id: str,
1142
- *,
1143
- project_id: typing.Optional[str] = None,
1144
- organization_id: typing.Optional[str] = None,
1145
- user_query: str,
1146
- chat_history: typing.List[LlamaIndexCoreBaseLlmsTypesChatMessage],
1147
- ) -> typing.List[EditSuggestion]:
1148
- """
1149
- Suggest edits to a report based on user query and chat history.
1150
-
1151
- Parameters:
1152
- - report_id: str.
1153
-
1154
- - project_id: typing.Optional[str].
1155
-
1156
- - organization_id: typing.Optional[str].
1157
-
1158
- - user_query: str.
1159
-
1160
- - chat_history: typing.List[LlamaIndexCoreBaseLlmsTypesChatMessage].
1161
- ---
1162
- from llama_cloud.client import AsyncLlamaCloud
1163
-
1164
- client = AsyncLlamaCloud(
1165
- token="YOUR_TOKEN",
1166
- )
1167
- await client.reports.suggest_edits_endpoint(
1168
- report_id="string",
1169
- user_query="string",
1170
- chat_history=[],
1171
- )
1172
- """
1173
- _response = await self._client_wrapper.httpx_client.request(
1174
- "POST",
1175
- urllib.parse.urljoin(
1176
- f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/suggest_edits"
1177
- ),
1178
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
1179
- json=jsonable_encoder({"user_query": user_query, "chat_history": chat_history}),
1180
- headers=self._client_wrapper.get_headers(),
1181
- timeout=60,
1182
- )
1183
- if 200 <= _response.status_code < 300:
1184
- return pydantic.parse_obj_as(typing.List[EditSuggestion], _response.json()) # type: ignore
1185
- if _response.status_code == 422:
1186
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1187
- try:
1188
- _response_json = _response.json()
1189
- except JSONDecodeError:
1190
- raise ApiError(status_code=_response.status_code, body=_response.text)
1191
- raise ApiError(status_code=_response.status_code, body=_response_json)
1192
-
1193
- async def restart_report(
1194
- self, report_id: str, *, project_id: typing.Optional[str] = None, organization_id: typing.Optional[str] = None
1195
- ) -> typing.Any:
1196
- """
1197
- Restart a report from scratch.
1198
-
1199
- Parameters:
1200
- - report_id: str.
1201
-
1202
- - project_id: typing.Optional[str].
1203
-
1204
- - organization_id: typing.Optional[str].
1205
- ---
1206
- from llama_cloud.client import AsyncLlamaCloud
1207
-
1208
- client = AsyncLlamaCloud(
1209
- token="YOUR_TOKEN",
1210
- )
1211
- await client.reports.restart_report(
1212
- report_id="string",
1213
- )
1214
- """
1215
- _response = await self._client_wrapper.httpx_client.request(
1216
- "POST",
1217
- urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/v1/reports/{report_id}/restart"),
1218
- params=remove_none_from_dict({"project_id": project_id, "organization_id": organization_id}),
1219
- headers=self._client_wrapper.get_headers(),
1220
- timeout=60,
1221
- )
1222
- if 200 <= _response.status_code < 300:
1223
- return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
1224
- if _response.status_code == 422:
1225
- raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
1226
- try:
1227
- _response_json = _response.json()
1228
- except JSONDecodeError:
1229
- raise ApiError(status_code=_response.status_code, body=_response.text)
1230
- raise ApiError(status_code=_response.status_code, body=_response_json)