llama-cloud 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of llama-cloud might be problematic. Click here for more details.

Files changed (173) hide show
  1. llama_cloud/__init__.py +295 -0
  2. llama_cloud/client.py +72 -0
  3. llama_cloud/core/__init__.py +17 -0
  4. llama_cloud/core/api_error.py +15 -0
  5. llama_cloud/core/client_wrapper.py +51 -0
  6. llama_cloud/core/datetime_utils.py +28 -0
  7. llama_cloud/core/jsonable_encoder.py +103 -0
  8. llama_cloud/core/remove_none_from_dict.py +11 -0
  9. llama_cloud/errors/__init__.py +5 -0
  10. llama_cloud/errors/unprocessable_entity_error.py +9 -0
  11. llama_cloud/resources/__init__.py +40 -0
  12. llama_cloud/resources/api_keys/__init__.py +2 -0
  13. llama_cloud/resources/api_keys/client.py +302 -0
  14. llama_cloud/resources/billing/__init__.py +2 -0
  15. llama_cloud/resources/billing/client.py +234 -0
  16. llama_cloud/resources/component_definitions/__init__.py +2 -0
  17. llama_cloud/resources/component_definitions/client.py +192 -0
  18. llama_cloud/resources/data_sinks/__init__.py +5 -0
  19. llama_cloud/resources/data_sinks/client.py +506 -0
  20. llama_cloud/resources/data_sinks/types/__init__.py +6 -0
  21. llama_cloud/resources/data_sinks/types/data_sink_update_component.py +7 -0
  22. llama_cloud/resources/data_sinks/types/data_sink_update_component_one.py +17 -0
  23. llama_cloud/resources/data_sources/__init__.py +5 -0
  24. llama_cloud/resources/data_sources/client.py +521 -0
  25. llama_cloud/resources/data_sources/types/__init__.py +7 -0
  26. llama_cloud/resources/data_sources/types/data_source_update_component.py +7 -0
  27. llama_cloud/resources/data_sources/types/data_source_update_component_one.py +19 -0
  28. llama_cloud/resources/data_sources/types/data_source_update_custom_metadata_value.py +7 -0
  29. llama_cloud/resources/deprecated/__init__.py +2 -0
  30. llama_cloud/resources/deprecated/client.py +982 -0
  31. llama_cloud/resources/evals/__init__.py +2 -0
  32. llama_cloud/resources/evals/client.py +745 -0
  33. llama_cloud/resources/files/__init__.py +5 -0
  34. llama_cloud/resources/files/client.py +560 -0
  35. llama_cloud/resources/files/types/__init__.py +5 -0
  36. llama_cloud/resources/files/types/file_create_resource_info_value.py +5 -0
  37. llama_cloud/resources/parsing/__init__.py +2 -0
  38. llama_cloud/resources/parsing/client.py +982 -0
  39. llama_cloud/resources/pipelines/__init__.py +5 -0
  40. llama_cloud/resources/pipelines/client.py +2599 -0
  41. llama_cloud/resources/pipelines/types/__init__.py +5 -0
  42. llama_cloud/resources/pipelines/types/pipeline_file_update_custom_metadata_value.py +7 -0
  43. llama_cloud/resources/projects/__init__.py +2 -0
  44. llama_cloud/resources/projects/client.py +1231 -0
  45. llama_cloud/types/__init__.py +253 -0
  46. llama_cloud/types/api_key.py +37 -0
  47. llama_cloud/types/azure_open_ai_embedding.py +75 -0
  48. llama_cloud/types/base.py +26 -0
  49. llama_cloud/types/base_prompt_template.py +44 -0
  50. llama_cloud/types/bedrock_embedding.py +56 -0
  51. llama_cloud/types/chat_message.py +35 -0
  52. llama_cloud/types/cloud_az_storage_blob_data_source.py +40 -0
  53. llama_cloud/types/cloud_chroma_vector_store.py +40 -0
  54. llama_cloud/types/cloud_document.py +36 -0
  55. llama_cloud/types/cloud_document_create.py +36 -0
  56. llama_cloud/types/cloud_gcs_data_source.py +37 -0
  57. llama_cloud/types/cloud_google_drive_data_source.py +36 -0
  58. llama_cloud/types/cloud_one_drive_data_source.py +38 -0
  59. llama_cloud/types/cloud_pinecone_vector_store.py +46 -0
  60. llama_cloud/types/cloud_postgres_vector_store.py +44 -0
  61. llama_cloud/types/cloud_qdrant_vector_store.py +48 -0
  62. llama_cloud/types/cloud_s_3_data_source.py +42 -0
  63. llama_cloud/types/cloud_sharepoint_data_source.py +38 -0
  64. llama_cloud/types/cloud_weaviate_vector_store.py +38 -0
  65. llama_cloud/types/code_splitter.py +46 -0
  66. llama_cloud/types/cohere_embedding.py +46 -0
  67. llama_cloud/types/configurable_data_sink_names.py +37 -0
  68. llama_cloud/types/configurable_data_source_names.py +41 -0
  69. llama_cloud/types/configurable_transformation_definition.py +45 -0
  70. llama_cloud/types/configurable_transformation_names.py +73 -0
  71. llama_cloud/types/configured_transformation_item.py +43 -0
  72. llama_cloud/types/configured_transformation_item_component.py +9 -0
  73. llama_cloud/types/configured_transformation_item_component_one.py +35 -0
  74. llama_cloud/types/data_sink.py +40 -0
  75. llama_cloud/types/data_sink_component.py +7 -0
  76. llama_cloud/types/data_sink_component_one.py +17 -0
  77. llama_cloud/types/data_sink_create.py +36 -0
  78. llama_cloud/types/data_sink_create_component.py +7 -0
  79. llama_cloud/types/data_sink_create_component_one.py +17 -0
  80. llama_cloud/types/data_sink_definition.py +41 -0
  81. llama_cloud/types/data_source.py +44 -0
  82. llama_cloud/types/data_source_component.py +7 -0
  83. llama_cloud/types/data_source_component_one.py +19 -0
  84. llama_cloud/types/data_source_create.py +40 -0
  85. llama_cloud/types/data_source_create_component.py +7 -0
  86. llama_cloud/types/data_source_create_component_one.py +19 -0
  87. llama_cloud/types/data_source_create_custom_metadata_value.py +7 -0
  88. llama_cloud/types/data_source_custom_metadata_value.py +7 -0
  89. llama_cloud/types/data_source_definition.py +41 -0
  90. llama_cloud/types/eval_dataset.py +37 -0
  91. llama_cloud/types/eval_dataset_job_params.py +36 -0
  92. llama_cloud/types/eval_dataset_job_record.py +59 -0
  93. llama_cloud/types/eval_execution_params.py +38 -0
  94. llama_cloud/types/eval_execution_params_override.py +38 -0
  95. llama_cloud/types/eval_llm_model_data.py +33 -0
  96. llama_cloud/types/eval_question.py +39 -0
  97. llama_cloud/types/eval_question_create.py +28 -0
  98. llama_cloud/types/eval_question_result.py +49 -0
  99. llama_cloud/types/file.py +46 -0
  100. llama_cloud/types/file_resource_info_value.py +5 -0
  101. llama_cloud/types/filter_condition.py +21 -0
  102. llama_cloud/types/filter_operator.py +65 -0
  103. llama_cloud/types/gemini_embedding.py +51 -0
  104. llama_cloud/types/html_node_parser.py +44 -0
  105. llama_cloud/types/http_validation_error.py +29 -0
  106. llama_cloud/types/hugging_face_inference_api_embedding.py +68 -0
  107. llama_cloud/types/hugging_face_inference_api_embedding_token.py +5 -0
  108. llama_cloud/types/json_node_parser.py +43 -0
  109. llama_cloud/types/llama_parse_supported_file_extensions.py +161 -0
  110. llama_cloud/types/llm.py +55 -0
  111. llama_cloud/types/local_eval.py +46 -0
  112. llama_cloud/types/local_eval_results.py +37 -0
  113. llama_cloud/types/local_eval_sets.py +30 -0
  114. llama_cloud/types/managed_ingestion_status.py +37 -0
  115. llama_cloud/types/markdown_element_node_parser.py +49 -0
  116. llama_cloud/types/markdown_node_parser.py +43 -0
  117. llama_cloud/types/message_role.py +45 -0
  118. llama_cloud/types/metadata_filter.py +41 -0
  119. llama_cloud/types/metadata_filter_value.py +5 -0
  120. llama_cloud/types/metadata_filters.py +41 -0
  121. llama_cloud/types/metadata_filters_filters_item.py +8 -0
  122. llama_cloud/types/metric_result.py +30 -0
  123. llama_cloud/types/node_parser.py +37 -0
  124. llama_cloud/types/object_type.py +33 -0
  125. llama_cloud/types/open_ai_embedding.py +73 -0
  126. llama_cloud/types/parser_languages.py +361 -0
  127. llama_cloud/types/parsing_history_item.py +36 -0
  128. llama_cloud/types/parsing_job.py +30 -0
  129. llama_cloud/types/parsing_job_json_result.py +29 -0
  130. llama_cloud/types/parsing_job_markdown_result.py +29 -0
  131. llama_cloud/types/parsing_job_text_result.py +29 -0
  132. llama_cloud/types/parsing_usage.py +29 -0
  133. llama_cloud/types/pipeline.py +64 -0
  134. llama_cloud/types/pipeline_create.py +61 -0
  135. llama_cloud/types/pipeline_data_source.py +46 -0
  136. llama_cloud/types/pipeline_data_source_component.py +7 -0
  137. llama_cloud/types/pipeline_data_source_component_one.py +19 -0
  138. llama_cloud/types/pipeline_data_source_create.py +32 -0
  139. llama_cloud/types/pipeline_data_source_custom_metadata_value.py +7 -0
  140. llama_cloud/types/pipeline_deployment.py +38 -0
  141. llama_cloud/types/pipeline_file.py +52 -0
  142. llama_cloud/types/pipeline_file_create.py +36 -0
  143. llama_cloud/types/pipeline_file_create_custom_metadata_value.py +7 -0
  144. llama_cloud/types/pipeline_file_custom_metadata_value.py +7 -0
  145. llama_cloud/types/pipeline_file_resource_info_value.py +7 -0
  146. llama_cloud/types/pipeline_file_status_response.py +35 -0
  147. llama_cloud/types/pipeline_type.py +21 -0
  148. llama_cloud/types/pooling.py +29 -0
  149. llama_cloud/types/preset_retrieval_params.py +40 -0
  150. llama_cloud/types/presigned_url.py +36 -0
  151. llama_cloud/types/project.py +42 -0
  152. llama_cloud/types/project_create.py +32 -0
  153. llama_cloud/types/prompt_mixin_prompts.py +36 -0
  154. llama_cloud/types/prompt_spec.py +35 -0
  155. llama_cloud/types/pydantic_program_mode.py +41 -0
  156. llama_cloud/types/related_node_info.py +37 -0
  157. llama_cloud/types/retrieve_results.py +40 -0
  158. llama_cloud/types/sentence_splitter.py +48 -0
  159. llama_cloud/types/simple_file_node_parser.py +44 -0
  160. llama_cloud/types/status_enum.py +33 -0
  161. llama_cloud/types/supported_eval_llm_model.py +35 -0
  162. llama_cloud/types/supported_eval_llm_model_names.py +29 -0
  163. llama_cloud/types/text_node.py +62 -0
  164. llama_cloud/types/text_node_relationships_value.py +7 -0
  165. llama_cloud/types/text_node_with_score.py +36 -0
  166. llama_cloud/types/token_text_splitter.py +43 -0
  167. llama_cloud/types/transformation_category_names.py +21 -0
  168. llama_cloud/types/validation_error.py +31 -0
  169. llama_cloud/types/validation_error_loc_item.py +5 -0
  170. llama_cloud-0.0.1.dist-info/LICENSE +21 -0
  171. llama_cloud-0.0.1.dist-info/METADATA +25 -0
  172. llama_cloud-0.0.1.dist-info/RECORD +173 -0
  173. llama_cloud-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,982 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ import urllib.parse
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ...core.api_error import ApiError
8
+ from ...core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ...core.jsonable_encoder import jsonable_encoder
10
+ from ...errors.unprocessable_entity_error import UnprocessableEntityError
11
+ from ...types.http_validation_error import HttpValidationError
12
+ from ...types.llama_parse_supported_file_extensions import LlamaParseSupportedFileExtensions
13
+ from ...types.parser_languages import ParserLanguages
14
+ from ...types.parsing_history_item import ParsingHistoryItem
15
+ from ...types.parsing_job import ParsingJob
16
+ from ...types.parsing_job_json_result import ParsingJobJsonResult
17
+ from ...types.parsing_job_markdown_result import ParsingJobMarkdownResult
18
+ from ...types.parsing_job_text_result import ParsingJobTextResult
19
+ from ...types.parsing_usage import ParsingUsage
20
+ from ...types.presigned_url import PresignedUrl
21
+
22
+ try:
23
+ import pydantic.v1 as pydantic # type: ignore
24
+ except ImportError:
25
+ import pydantic # type: ignore
26
+
27
+ # this is used as the default value for optional parameters
28
+ OMIT = typing.cast(typing.Any, ...)
29
+
30
+
31
+ class DeprecatedClient:
32
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
33
+ self._client_wrapper = client_wrapper
34
+
35
+ def get_job_image_result(self, job_id: str, name: str) -> None:
36
+ """
37
+ Get a job by id
38
+
39
+ Parameters:
40
+ - job_id: str.
41
+
42
+ - name: str.
43
+ ---
44
+ from platform.client import PlatformApi
45
+
46
+ client = PlatformApi(
47
+ token="YOUR_TOKEN",
48
+ base_url="https://yourhost.com/path/to/api",
49
+ )
50
+ client.deprecated.get_job_image_result(
51
+ job_id="string",
52
+ name="string",
53
+ )
54
+ """
55
+ _response = self._client_wrapper.httpx_client.request(
56
+ "GET",
57
+ urllib.parse.urljoin(
58
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/image/{name}"
59
+ ),
60
+ headers=self._client_wrapper.get_headers(),
61
+ timeout=60,
62
+ )
63
+ if 200 <= _response.status_code < 300:
64
+ return
65
+ if _response.status_code == 422:
66
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
67
+ try:
68
+ _response_json = _response.json()
69
+ except JSONDecodeError:
70
+ raise ApiError(status_code=_response.status_code, body=_response.text)
71
+ raise ApiError(status_code=_response.status_code, body=_response_json)
72
+
73
+ def get_supported_file_extensions(self) -> typing.List[LlamaParseSupportedFileExtensions]:
74
+ """
75
+ Get a list of supported file extensions
76
+
77
+ ---
78
+ from platform.client import PlatformApi
79
+
80
+ client = PlatformApi(
81
+ token="YOUR_TOKEN",
82
+ base_url="https://yourhost.com/path/to/api",
83
+ )
84
+ client.deprecated.get_supported_file_extensions()
85
+ """
86
+ _response = self._client_wrapper.httpx_client.request(
87
+ "GET",
88
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/supported_file_extensions"),
89
+ headers=self._client_wrapper.get_headers(),
90
+ timeout=60,
91
+ )
92
+ if 200 <= _response.status_code < 300:
93
+ return pydantic.parse_obj_as(typing.List[LlamaParseSupportedFileExtensions], _response.json()) # type: ignore
94
+ try:
95
+ _response_json = _response.json()
96
+ except JSONDecodeError:
97
+ raise ApiError(status_code=_response.status_code, body=_response.text)
98
+ raise ApiError(status_code=_response.status_code, body=_response_json)
99
+
100
+ def upload_file(
101
+ self,
102
+ *,
103
+ language: typing.List[ParserLanguages],
104
+ parsing_instruction: str,
105
+ skip_diagonal_text: bool,
106
+ invalidate_cache: bool,
107
+ do_not_cache: bool,
108
+ gpt_4_o_mode: bool,
109
+ fast_mode: bool,
110
+ gpt_4_o_api_key: str,
111
+ do_not_unroll_columns: bool,
112
+ page_separator: str,
113
+ file: typing.IO,
114
+ ) -> ParsingJob:
115
+ """
116
+ Upload a file to s3 and create a job. return a job id
117
+
118
+ Parameters:
119
+ - language: typing.List[ParserLanguages].
120
+
121
+ - parsing_instruction: str.
122
+
123
+ - skip_diagonal_text: bool.
124
+
125
+ - invalidate_cache: bool.
126
+
127
+ - do_not_cache: bool.
128
+
129
+ - gpt_4_o_mode: bool.
130
+
131
+ - fast_mode: bool.
132
+
133
+ - gpt_4_o_api_key: str.
134
+
135
+ - do_not_unroll_columns: bool.
136
+
137
+ - page_separator: str.
138
+
139
+ - file: typing.IO.
140
+ """
141
+ _response = self._client_wrapper.httpx_client.request(
142
+ "POST",
143
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/upload"),
144
+ data=jsonable_encoder(
145
+ {
146
+ "language": language,
147
+ "parsing_instruction": parsing_instruction,
148
+ "skip_diagonal_text": skip_diagonal_text,
149
+ "invalidate_cache": invalidate_cache,
150
+ "do_not_cache": do_not_cache,
151
+ "gpt4o_mode": gpt_4_o_mode,
152
+ "fast_mode": fast_mode,
153
+ "gpt4o_api_key": gpt_4_o_api_key,
154
+ "do_not_unroll_columns": do_not_unroll_columns,
155
+ "page_separator": page_separator,
156
+ }
157
+ ),
158
+ files={"file": file},
159
+ headers=self._client_wrapper.get_headers(),
160
+ timeout=60,
161
+ )
162
+ if 200 <= _response.status_code < 300:
163
+ return pydantic.parse_obj_as(ParsingJob, _response.json()) # type: ignore
164
+ if _response.status_code == 422:
165
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
166
+ try:
167
+ _response_json = _response.json()
168
+ except JSONDecodeError:
169
+ raise ApiError(status_code=_response.status_code, body=_response.text)
170
+ raise ApiError(status_code=_response.status_code, body=_response_json)
171
+
172
+ def usage(self) -> ParsingUsage:
173
+ """
174
+ Get parsing usage for user
175
+
176
+ ---
177
+ from platform.client import PlatformApi
178
+
179
+ client = PlatformApi(
180
+ token="YOUR_TOKEN",
181
+ base_url="https://yourhost.com/path/to/api",
182
+ )
183
+ client.deprecated.usage()
184
+ """
185
+ _response = self._client_wrapper.httpx_client.request(
186
+ "GET",
187
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/usage"),
188
+ headers=self._client_wrapper.get_headers(),
189
+ timeout=60,
190
+ )
191
+ if 200 <= _response.status_code < 300:
192
+ return pydantic.parse_obj_as(ParsingUsage, _response.json()) # type: ignore
193
+ if _response.status_code == 422:
194
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
195
+ try:
196
+ _response_json = _response.json()
197
+ except JSONDecodeError:
198
+ raise ApiError(status_code=_response.status_code, body=_response.text)
199
+ raise ApiError(status_code=_response.status_code, body=_response_json)
200
+
201
+ def get_job(self, job_id: str) -> ParsingJob:
202
+ """
203
+ Get a job by id
204
+
205
+ Parameters:
206
+ - job_id: str.
207
+ ---
208
+ from platform.client import PlatformApi
209
+
210
+ client = PlatformApi(
211
+ token="YOUR_TOKEN",
212
+ base_url="https://yourhost.com/path/to/api",
213
+ )
214
+ client.deprecated.get_job(
215
+ job_id="string",
216
+ )
217
+ """
218
+ _response = self._client_wrapper.httpx_client.request(
219
+ "GET",
220
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}"),
221
+ headers=self._client_wrapper.get_headers(),
222
+ timeout=60,
223
+ )
224
+ if 200 <= _response.status_code < 300:
225
+ return pydantic.parse_obj_as(ParsingJob, _response.json()) # type: ignore
226
+ if _response.status_code == 422:
227
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
228
+ try:
229
+ _response_json = _response.json()
230
+ except JSONDecodeError:
231
+ raise ApiError(status_code=_response.status_code, body=_response.text)
232
+ raise ApiError(status_code=_response.status_code, body=_response_json)
233
+
234
+ def get_job_text_result(self, job_id: str) -> ParsingJobTextResult:
235
+ """
236
+ Get a job by id
237
+
238
+ Parameters:
239
+ - job_id: str.
240
+ ---
241
+ from platform.client import PlatformApi
242
+
243
+ client = PlatformApi(
244
+ token="YOUR_TOKEN",
245
+ base_url="https://yourhost.com/path/to/api",
246
+ )
247
+ client.deprecated.get_job_text_result(
248
+ job_id="string",
249
+ )
250
+ """
251
+ _response = self._client_wrapper.httpx_client.request(
252
+ "GET",
253
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/text"),
254
+ headers=self._client_wrapper.get_headers(),
255
+ timeout=60,
256
+ )
257
+ if 200 <= _response.status_code < 300:
258
+ return pydantic.parse_obj_as(ParsingJobTextResult, _response.json()) # type: ignore
259
+ if _response.status_code == 422:
260
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
261
+ try:
262
+ _response_json = _response.json()
263
+ except JSONDecodeError:
264
+ raise ApiError(status_code=_response.status_code, body=_response.text)
265
+ raise ApiError(status_code=_response.status_code, body=_response_json)
266
+
267
+ def get_job_raw_text_result(self, job_id: str) -> typing.Any:
268
+ """
269
+ Get a job by id
270
+
271
+ Parameters:
272
+ - job_id: str.
273
+ ---
274
+ from platform.client import PlatformApi
275
+
276
+ client = PlatformApi(
277
+ token="YOUR_TOKEN",
278
+ base_url="https://yourhost.com/path/to/api",
279
+ )
280
+ client.deprecated.get_job_raw_text_result(
281
+ job_id="string",
282
+ )
283
+ """
284
+ _response = self._client_wrapper.httpx_client.request(
285
+ "GET",
286
+ urllib.parse.urljoin(
287
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/raw/text"
288
+ ),
289
+ headers=self._client_wrapper.get_headers(),
290
+ timeout=60,
291
+ )
292
+ if 200 <= _response.status_code < 300:
293
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
294
+ if _response.status_code == 422:
295
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
296
+ try:
297
+ _response_json = _response.json()
298
+ except JSONDecodeError:
299
+ raise ApiError(status_code=_response.status_code, body=_response.text)
300
+ raise ApiError(status_code=_response.status_code, body=_response_json)
301
+
302
+ def get_job_result(self, job_id: str) -> ParsingJobMarkdownResult:
303
+ """
304
+ Get a job by id
305
+
306
+ Parameters:
307
+ - job_id: str.
308
+ ---
309
+ from platform.client import PlatformApi
310
+
311
+ client = PlatformApi(
312
+ token="YOUR_TOKEN",
313
+ base_url="https://yourhost.com/path/to/api",
314
+ )
315
+ client.deprecated.get_job_result(
316
+ job_id="string",
317
+ )
318
+ """
319
+ _response = self._client_wrapper.httpx_client.request(
320
+ "GET",
321
+ urllib.parse.urljoin(
322
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/markdown"
323
+ ),
324
+ headers=self._client_wrapper.get_headers(),
325
+ timeout=60,
326
+ )
327
+ if 200 <= _response.status_code < 300:
328
+ return pydantic.parse_obj_as(ParsingJobMarkdownResult, _response.json()) # type: ignore
329
+ if _response.status_code == 422:
330
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
331
+ try:
332
+ _response_json = _response.json()
333
+ except JSONDecodeError:
334
+ raise ApiError(status_code=_response.status_code, body=_response.text)
335
+ raise ApiError(status_code=_response.status_code, body=_response_json)
336
+
337
+ def get_job_raw_md_result(self, job_id: str) -> typing.Any:
338
+ """
339
+ Get a job by id
340
+
341
+ Parameters:
342
+ - job_id: str.
343
+ ---
344
+ from platform.client import PlatformApi
345
+
346
+ client = PlatformApi(
347
+ token="YOUR_TOKEN",
348
+ base_url="https://yourhost.com/path/to/api",
349
+ )
350
+ client.deprecated.get_job_raw_md_result(
351
+ job_id="string",
352
+ )
353
+ """
354
+ _response = self._client_wrapper.httpx_client.request(
355
+ "GET",
356
+ urllib.parse.urljoin(
357
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/raw/markdown"
358
+ ),
359
+ headers=self._client_wrapper.get_headers(),
360
+ timeout=60,
361
+ )
362
+ if 200 <= _response.status_code < 300:
363
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
364
+ if _response.status_code == 422:
365
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
366
+ try:
367
+ _response_json = _response.json()
368
+ except JSONDecodeError:
369
+ raise ApiError(status_code=_response.status_code, body=_response.text)
370
+ raise ApiError(status_code=_response.status_code, body=_response_json)
371
+
372
+ def get_job_json_result(self, job_id: str) -> ParsingJobJsonResult:
373
+ """
374
+ Get a job by id
375
+
376
+ Parameters:
377
+ - job_id: str.
378
+ ---
379
+ from platform.client import PlatformApi
380
+
381
+ client = PlatformApi(
382
+ token="YOUR_TOKEN",
383
+ base_url="https://yourhost.com/path/to/api",
384
+ )
385
+ client.deprecated.get_job_json_result(
386
+ job_id="string",
387
+ )
388
+ """
389
+ _response = self._client_wrapper.httpx_client.request(
390
+ "GET",
391
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/json"),
392
+ headers=self._client_wrapper.get_headers(),
393
+ timeout=60,
394
+ )
395
+ if 200 <= _response.status_code < 300:
396
+ return pydantic.parse_obj_as(ParsingJobJsonResult, _response.json()) # type: ignore
397
+ if _response.status_code == 422:
398
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
399
+ try:
400
+ _response_json = _response.json()
401
+ except JSONDecodeError:
402
+ raise ApiError(status_code=_response.status_code, body=_response.text)
403
+ raise ApiError(status_code=_response.status_code, body=_response_json)
404
+
405
+ def get_job_json_raw_result(self, job_id: str) -> typing.Any:
406
+ """
407
+ Get a job by id
408
+
409
+ Parameters:
410
+ - job_id: str.
411
+ ---
412
+ from platform.client import PlatformApi
413
+
414
+ client = PlatformApi(
415
+ token="YOUR_TOKEN",
416
+ base_url="https://yourhost.com/path/to/api",
417
+ )
418
+ client.deprecated.get_job_json_raw_result(
419
+ job_id="string",
420
+ )
421
+ """
422
+ _response = self._client_wrapper.httpx_client.request(
423
+ "GET",
424
+ urllib.parse.urljoin(
425
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/raw/json"
426
+ ),
427
+ headers=self._client_wrapper.get_headers(),
428
+ timeout=60,
429
+ )
430
+ if 200 <= _response.status_code < 300:
431
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
432
+ if _response.status_code == 422:
433
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
434
+ try:
435
+ _response_json = _response.json()
436
+ except JSONDecodeError:
437
+ raise ApiError(status_code=_response.status_code, body=_response.text)
438
+ raise ApiError(status_code=_response.status_code, body=_response_json)
439
+
440
+ def get_parsing_history_result(self) -> typing.List[ParsingHistoryItem]:
441
+ """
442
+ Get parsing history for user
443
+
444
+ ---
445
+ from platform.client import PlatformApi
446
+
447
+ client = PlatformApi(
448
+ token="YOUR_TOKEN",
449
+ base_url="https://yourhost.com/path/to/api",
450
+ )
451
+ client.deprecated.get_parsing_history_result()
452
+ """
453
+ _response = self._client_wrapper.httpx_client.request(
454
+ "GET",
455
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/history"),
456
+ headers=self._client_wrapper.get_headers(),
457
+ timeout=60,
458
+ )
459
+ if 200 <= _response.status_code < 300:
460
+ return pydantic.parse_obj_as(typing.List[ParsingHistoryItem], _response.json()) # type: ignore
461
+ if _response.status_code == 422:
462
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
463
+ try:
464
+ _response_json = _response.json()
465
+ except JSONDecodeError:
466
+ raise ApiError(status_code=_response.status_code, body=_response.text)
467
+ raise ApiError(status_code=_response.status_code, body=_response_json)
468
+
469
+ def generate_presigned_url(self, job_id: str, filename: str) -> PresignedUrl:
470
+ """
471
+ Generate a presigned URL for a job
472
+
473
+ Parameters:
474
+ - job_id: str.
475
+
476
+ - filename: str.
477
+ ---
478
+ from platform.client import PlatformApi
479
+
480
+ client = PlatformApi(
481
+ token="YOUR_TOKEN",
482
+ base_url="https://yourhost.com/path/to/api",
483
+ )
484
+ client.deprecated.generate_presigned_url(
485
+ job_id="string",
486
+ filename="string",
487
+ )
488
+ """
489
+ _response = self._client_wrapper.httpx_client.request(
490
+ "GET",
491
+ urllib.parse.urljoin(
492
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/read/{filename}"
493
+ ),
494
+ headers=self._client_wrapper.get_headers(),
495
+ timeout=60,
496
+ )
497
+ if 200 <= _response.status_code < 300:
498
+ return pydantic.parse_obj_as(PresignedUrl, _response.json()) # type: ignore
499
+ if _response.status_code == 422:
500
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
501
+ try:
502
+ _response_json = _response.json()
503
+ except JSONDecodeError:
504
+ raise ApiError(status_code=_response.status_code, body=_response.text)
505
+ raise ApiError(status_code=_response.status_code, body=_response_json)
506
+
507
+
508
+ class AsyncDeprecatedClient:
509
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
510
+ self._client_wrapper = client_wrapper
511
+
512
+ async def get_job_image_result(self, job_id: str, name: str) -> None:
513
+ """
514
+ Get a job by id
515
+
516
+ Parameters:
517
+ - job_id: str.
518
+
519
+ - name: str.
520
+ ---
521
+ from platform.client import AsyncPlatformApi
522
+
523
+ client = AsyncPlatformApi(
524
+ token="YOUR_TOKEN",
525
+ base_url="https://yourhost.com/path/to/api",
526
+ )
527
+ await client.deprecated.get_job_image_result(
528
+ job_id="string",
529
+ name="string",
530
+ )
531
+ """
532
+ _response = await self._client_wrapper.httpx_client.request(
533
+ "GET",
534
+ urllib.parse.urljoin(
535
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/image/{name}"
536
+ ),
537
+ headers=self._client_wrapper.get_headers(),
538
+ timeout=60,
539
+ )
540
+ if 200 <= _response.status_code < 300:
541
+ return
542
+ if _response.status_code == 422:
543
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
544
+ try:
545
+ _response_json = _response.json()
546
+ except JSONDecodeError:
547
+ raise ApiError(status_code=_response.status_code, body=_response.text)
548
+ raise ApiError(status_code=_response.status_code, body=_response_json)
549
+
550
+ async def get_supported_file_extensions(self) -> typing.List[LlamaParseSupportedFileExtensions]:
551
+ """
552
+ Get a list of supported file extensions
553
+
554
+ ---
555
+ from platform.client import AsyncPlatformApi
556
+
557
+ client = AsyncPlatformApi(
558
+ token="YOUR_TOKEN",
559
+ base_url="https://yourhost.com/path/to/api",
560
+ )
561
+ await client.deprecated.get_supported_file_extensions()
562
+ """
563
+ _response = await self._client_wrapper.httpx_client.request(
564
+ "GET",
565
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/supported_file_extensions"),
566
+ headers=self._client_wrapper.get_headers(),
567
+ timeout=60,
568
+ )
569
+ if 200 <= _response.status_code < 300:
570
+ return pydantic.parse_obj_as(typing.List[LlamaParseSupportedFileExtensions], _response.json()) # type: ignore
571
+ try:
572
+ _response_json = _response.json()
573
+ except JSONDecodeError:
574
+ raise ApiError(status_code=_response.status_code, body=_response.text)
575
+ raise ApiError(status_code=_response.status_code, body=_response_json)
576
+
577
+ async def upload_file(
578
+ self,
579
+ *,
580
+ language: typing.List[ParserLanguages],
581
+ parsing_instruction: str,
582
+ skip_diagonal_text: bool,
583
+ invalidate_cache: bool,
584
+ do_not_cache: bool,
585
+ gpt_4_o_mode: bool,
586
+ fast_mode: bool,
587
+ gpt_4_o_api_key: str,
588
+ do_not_unroll_columns: bool,
589
+ page_separator: str,
590
+ file: typing.IO,
591
+ ) -> ParsingJob:
592
+ """
593
+ Upload a file to s3 and create a job. return a job id
594
+
595
+ Parameters:
596
+ - language: typing.List[ParserLanguages].
597
+
598
+ - parsing_instruction: str.
599
+
600
+ - skip_diagonal_text: bool.
601
+
602
+ - invalidate_cache: bool.
603
+
604
+ - do_not_cache: bool.
605
+
606
+ - gpt_4_o_mode: bool.
607
+
608
+ - fast_mode: bool.
609
+
610
+ - gpt_4_o_api_key: str.
611
+
612
+ - do_not_unroll_columns: bool.
613
+
614
+ - page_separator: str.
615
+
616
+ - file: typing.IO.
617
+ """
618
+ _response = await self._client_wrapper.httpx_client.request(
619
+ "POST",
620
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/upload"),
621
+ data=jsonable_encoder(
622
+ {
623
+ "language": language,
624
+ "parsing_instruction": parsing_instruction,
625
+ "skip_diagonal_text": skip_diagonal_text,
626
+ "invalidate_cache": invalidate_cache,
627
+ "do_not_cache": do_not_cache,
628
+ "gpt4o_mode": gpt_4_o_mode,
629
+ "fast_mode": fast_mode,
630
+ "gpt4o_api_key": gpt_4_o_api_key,
631
+ "do_not_unroll_columns": do_not_unroll_columns,
632
+ "page_separator": page_separator,
633
+ }
634
+ ),
635
+ files={"file": file},
636
+ headers=self._client_wrapper.get_headers(),
637
+ timeout=60,
638
+ )
639
+ if 200 <= _response.status_code < 300:
640
+ return pydantic.parse_obj_as(ParsingJob, _response.json()) # type: ignore
641
+ if _response.status_code == 422:
642
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
643
+ try:
644
+ _response_json = _response.json()
645
+ except JSONDecodeError:
646
+ raise ApiError(status_code=_response.status_code, body=_response.text)
647
+ raise ApiError(status_code=_response.status_code, body=_response_json)
648
+
649
+ async def usage(self) -> ParsingUsage:
650
+ """
651
+ Get parsing usage for user
652
+
653
+ ---
654
+ from platform.client import AsyncPlatformApi
655
+
656
+ client = AsyncPlatformApi(
657
+ token="YOUR_TOKEN",
658
+ base_url="https://yourhost.com/path/to/api",
659
+ )
660
+ await client.deprecated.usage()
661
+ """
662
+ _response = await self._client_wrapper.httpx_client.request(
663
+ "GET",
664
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/usage"),
665
+ headers=self._client_wrapper.get_headers(),
666
+ timeout=60,
667
+ )
668
+ if 200 <= _response.status_code < 300:
669
+ return pydantic.parse_obj_as(ParsingUsage, _response.json()) # type: ignore
670
+ if _response.status_code == 422:
671
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
672
+ try:
673
+ _response_json = _response.json()
674
+ except JSONDecodeError:
675
+ raise ApiError(status_code=_response.status_code, body=_response.text)
676
+ raise ApiError(status_code=_response.status_code, body=_response_json)
677
+
678
+ async def get_job(self, job_id: str) -> ParsingJob:
679
+ """
680
+ Get a job by id
681
+
682
+ Parameters:
683
+ - job_id: str.
684
+ ---
685
+ from platform.client import AsyncPlatformApi
686
+
687
+ client = AsyncPlatformApi(
688
+ token="YOUR_TOKEN",
689
+ base_url="https://yourhost.com/path/to/api",
690
+ )
691
+ await client.deprecated.get_job(
692
+ job_id="string",
693
+ )
694
+ """
695
+ _response = await self._client_wrapper.httpx_client.request(
696
+ "GET",
697
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}"),
698
+ headers=self._client_wrapper.get_headers(),
699
+ timeout=60,
700
+ )
701
+ if 200 <= _response.status_code < 300:
702
+ return pydantic.parse_obj_as(ParsingJob, _response.json()) # type: ignore
703
+ if _response.status_code == 422:
704
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
705
+ try:
706
+ _response_json = _response.json()
707
+ except JSONDecodeError:
708
+ raise ApiError(status_code=_response.status_code, body=_response.text)
709
+ raise ApiError(status_code=_response.status_code, body=_response_json)
710
+
711
+ async def get_job_text_result(self, job_id: str) -> ParsingJobTextResult:
712
+ """
713
+ Get a job by id
714
+
715
+ Parameters:
716
+ - job_id: str.
717
+ ---
718
+ from platform.client import AsyncPlatformApi
719
+
720
+ client = AsyncPlatformApi(
721
+ token="YOUR_TOKEN",
722
+ base_url="https://yourhost.com/path/to/api",
723
+ )
724
+ await client.deprecated.get_job_text_result(
725
+ job_id="string",
726
+ )
727
+ """
728
+ _response = await self._client_wrapper.httpx_client.request(
729
+ "GET",
730
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/text"),
731
+ headers=self._client_wrapper.get_headers(),
732
+ timeout=60,
733
+ )
734
+ if 200 <= _response.status_code < 300:
735
+ return pydantic.parse_obj_as(ParsingJobTextResult, _response.json()) # type: ignore
736
+ if _response.status_code == 422:
737
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
738
+ try:
739
+ _response_json = _response.json()
740
+ except JSONDecodeError:
741
+ raise ApiError(status_code=_response.status_code, body=_response.text)
742
+ raise ApiError(status_code=_response.status_code, body=_response_json)
743
+
744
+ async def get_job_raw_text_result(self, job_id: str) -> typing.Any:
745
+ """
746
+ Get a job by id
747
+
748
+ Parameters:
749
+ - job_id: str.
750
+ ---
751
+ from platform.client import AsyncPlatformApi
752
+
753
+ client = AsyncPlatformApi(
754
+ token="YOUR_TOKEN",
755
+ base_url="https://yourhost.com/path/to/api",
756
+ )
757
+ await client.deprecated.get_job_raw_text_result(
758
+ job_id="string",
759
+ )
760
+ """
761
+ _response = await self._client_wrapper.httpx_client.request(
762
+ "GET",
763
+ urllib.parse.urljoin(
764
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/raw/text"
765
+ ),
766
+ headers=self._client_wrapper.get_headers(),
767
+ timeout=60,
768
+ )
769
+ if 200 <= _response.status_code < 300:
770
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
771
+ if _response.status_code == 422:
772
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
773
+ try:
774
+ _response_json = _response.json()
775
+ except JSONDecodeError:
776
+ raise ApiError(status_code=_response.status_code, body=_response.text)
777
+ raise ApiError(status_code=_response.status_code, body=_response_json)
778
+
779
+ async def get_job_result(self, job_id: str) -> ParsingJobMarkdownResult:
780
+ """
781
+ Get a job by id
782
+
783
+ Parameters:
784
+ - job_id: str.
785
+ ---
786
+ from platform.client import AsyncPlatformApi
787
+
788
+ client = AsyncPlatformApi(
789
+ token="YOUR_TOKEN",
790
+ base_url="https://yourhost.com/path/to/api",
791
+ )
792
+ await client.deprecated.get_job_result(
793
+ job_id="string",
794
+ )
795
+ """
796
+ _response = await self._client_wrapper.httpx_client.request(
797
+ "GET",
798
+ urllib.parse.urljoin(
799
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/markdown"
800
+ ),
801
+ headers=self._client_wrapper.get_headers(),
802
+ timeout=60,
803
+ )
804
+ if 200 <= _response.status_code < 300:
805
+ return pydantic.parse_obj_as(ParsingJobMarkdownResult, _response.json()) # type: ignore
806
+ if _response.status_code == 422:
807
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
808
+ try:
809
+ _response_json = _response.json()
810
+ except JSONDecodeError:
811
+ raise ApiError(status_code=_response.status_code, body=_response.text)
812
+ raise ApiError(status_code=_response.status_code, body=_response_json)
813
+
814
+ async def get_job_raw_md_result(self, job_id: str) -> typing.Any:
815
+ """
816
+ Get a job by id
817
+
818
+ Parameters:
819
+ - job_id: str.
820
+ ---
821
+ from platform.client import AsyncPlatformApi
822
+
823
+ client = AsyncPlatformApi(
824
+ token="YOUR_TOKEN",
825
+ base_url="https://yourhost.com/path/to/api",
826
+ )
827
+ await client.deprecated.get_job_raw_md_result(
828
+ job_id="string",
829
+ )
830
+ """
831
+ _response = await self._client_wrapper.httpx_client.request(
832
+ "GET",
833
+ urllib.parse.urljoin(
834
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/raw/markdown"
835
+ ),
836
+ headers=self._client_wrapper.get_headers(),
837
+ timeout=60,
838
+ )
839
+ if 200 <= _response.status_code < 300:
840
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
841
+ if _response.status_code == 422:
842
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
843
+ try:
844
+ _response_json = _response.json()
845
+ except JSONDecodeError:
846
+ raise ApiError(status_code=_response.status_code, body=_response.text)
847
+ raise ApiError(status_code=_response.status_code, body=_response_json)
848
+
849
+ async def get_job_json_result(self, job_id: str) -> ParsingJobJsonResult:
850
+ """
851
+ Get a job by id
852
+
853
+ Parameters:
854
+ - job_id: str.
855
+ ---
856
+ from platform.client import AsyncPlatformApi
857
+
858
+ client = AsyncPlatformApi(
859
+ token="YOUR_TOKEN",
860
+ base_url="https://yourhost.com/path/to/api",
861
+ )
862
+ await client.deprecated.get_job_json_result(
863
+ job_id="string",
864
+ )
865
+ """
866
+ _response = await self._client_wrapper.httpx_client.request(
867
+ "GET",
868
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/json"),
869
+ headers=self._client_wrapper.get_headers(),
870
+ timeout=60,
871
+ )
872
+ if 200 <= _response.status_code < 300:
873
+ return pydantic.parse_obj_as(ParsingJobJsonResult, _response.json()) # type: ignore
874
+ if _response.status_code == 422:
875
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
876
+ try:
877
+ _response_json = _response.json()
878
+ except JSONDecodeError:
879
+ raise ApiError(status_code=_response.status_code, body=_response.text)
880
+ raise ApiError(status_code=_response.status_code, body=_response_json)
881
+
882
+ async def get_job_json_raw_result(self, job_id: str) -> typing.Any:
883
+ """
884
+ Get a job by id
885
+
886
+ Parameters:
887
+ - job_id: str.
888
+ ---
889
+ from platform.client import AsyncPlatformApi
890
+
891
+ client = AsyncPlatformApi(
892
+ token="YOUR_TOKEN",
893
+ base_url="https://yourhost.com/path/to/api",
894
+ )
895
+ await client.deprecated.get_job_json_raw_result(
896
+ job_id="string",
897
+ )
898
+ """
899
+ _response = await self._client_wrapper.httpx_client.request(
900
+ "GET",
901
+ urllib.parse.urljoin(
902
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/result/raw/json"
903
+ ),
904
+ headers=self._client_wrapper.get_headers(),
905
+ timeout=60,
906
+ )
907
+ if 200 <= _response.status_code < 300:
908
+ return pydantic.parse_obj_as(typing.Any, _response.json()) # type: ignore
909
+ if _response.status_code == 422:
910
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
911
+ try:
912
+ _response_json = _response.json()
913
+ except JSONDecodeError:
914
+ raise ApiError(status_code=_response.status_code, body=_response.text)
915
+ raise ApiError(status_code=_response.status_code, body=_response_json)
916
+
917
+ async def get_parsing_history_result(self) -> typing.List[ParsingHistoryItem]:
918
+ """
919
+ Get parsing history for user
920
+
921
+ ---
922
+ from platform.client import AsyncPlatformApi
923
+
924
+ client = AsyncPlatformApi(
925
+ token="YOUR_TOKEN",
926
+ base_url="https://yourhost.com/path/to/api",
927
+ )
928
+ await client.deprecated.get_parsing_history_result()
929
+ """
930
+ _response = await self._client_wrapper.httpx_client.request(
931
+ "GET",
932
+ urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", "api/parsing/history"),
933
+ headers=self._client_wrapper.get_headers(),
934
+ timeout=60,
935
+ )
936
+ if 200 <= _response.status_code < 300:
937
+ return pydantic.parse_obj_as(typing.List[ParsingHistoryItem], _response.json()) # type: ignore
938
+ if _response.status_code == 422:
939
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
940
+ try:
941
+ _response_json = _response.json()
942
+ except JSONDecodeError:
943
+ raise ApiError(status_code=_response.status_code, body=_response.text)
944
+ raise ApiError(status_code=_response.status_code, body=_response_json)
945
+
946
+ async def generate_presigned_url(self, job_id: str, filename: str) -> PresignedUrl:
947
+ """
948
+ Generate a presigned URL for a job
949
+
950
+ Parameters:
951
+ - job_id: str.
952
+
953
+ - filename: str.
954
+ ---
955
+ from platform.client import AsyncPlatformApi
956
+
957
+ client = AsyncPlatformApi(
958
+ token="YOUR_TOKEN",
959
+ base_url="https://yourhost.com/path/to/api",
960
+ )
961
+ await client.deprecated.generate_presigned_url(
962
+ job_id="string",
963
+ filename="string",
964
+ )
965
+ """
966
+ _response = await self._client_wrapper.httpx_client.request(
967
+ "GET",
968
+ urllib.parse.urljoin(
969
+ f"{self._client_wrapper.get_base_url()}/", f"api/parsing/job/{job_id}/read/{filename}"
970
+ ),
971
+ headers=self._client_wrapper.get_headers(),
972
+ timeout=60,
973
+ )
974
+ if 200 <= _response.status_code < 300:
975
+ return pydantic.parse_obj_as(PresignedUrl, _response.json()) # type: ignore
976
+ if _response.status_code == 422:
977
+ raise UnprocessableEntityError(pydantic.parse_obj_as(HttpValidationError, _response.json())) # type: ignore
978
+ try:
979
+ _response_json = _response.json()
980
+ except JSONDecodeError:
981
+ raise ApiError(status_code=_response.status_code, body=_response.text)
982
+ raise ApiError(status_code=_response.status_code, body=_response_json)