landingai-ade 0.17.1__py3-none-any.whl → 0.18.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 landingai-ade might be problematic. Click here for more details.

landingai_ade/_client.py CHANGED
@@ -41,6 +41,7 @@ from ._response import (
41
41
  async_to_raw_response_wrapper,
42
42
  async_to_streamed_response_wrapper,
43
43
  )
44
+ from .resources import parse_jobs
44
45
  from ._streaming import Stream as Stream, AsyncStream as AsyncStream
45
46
  from ._exceptions import APIStatusError, LandingAiadeError
46
47
  from ._base_client import (
@@ -74,6 +75,7 @@ ENVIRONMENTS: Dict[str, str] = {
74
75
 
75
76
 
76
77
  class LandingAIADE(SyncAPIClient):
78
+ parse_jobs: parse_jobs.ParseJobsResource
77
79
  with_raw_response: LandingAIADEWithRawResponse
78
80
  with_streaming_response: LandingAIADEWithStreamedResponse
79
81
 
@@ -155,6 +157,7 @@ class LandingAIADE(SyncAPIClient):
155
157
  _strict_response_validation=_strict_response_validation,
156
158
  )
157
159
 
160
+ self.parse_jobs = parse_jobs.ParseJobsResource(self)
158
161
  self.with_raw_response = LandingAIADEWithRawResponse(self)
159
162
  self.with_streaming_response = LandingAIADEWithStreamedResponse(self)
160
163
 
@@ -422,6 +425,7 @@ class LandingAIADE(SyncAPIClient):
422
425
 
423
426
 
424
427
  class AsyncLandingAIADE(AsyncAPIClient):
428
+ parse_jobs: parse_jobs.AsyncParseJobsResource
425
429
  with_raw_response: AsyncLandingAIADEWithRawResponse
426
430
  with_streaming_response: AsyncLandingAIADEWithStreamedResponse
427
431
 
@@ -503,6 +507,7 @@ class AsyncLandingAIADE(AsyncAPIClient):
503
507
  _strict_response_validation=_strict_response_validation,
504
508
  )
505
509
 
510
+ self.parse_jobs = parse_jobs.AsyncParseJobsResource(self)
506
511
  self.with_raw_response = AsyncLandingAIADEWithRawResponse(self)
507
512
  self.with_streaming_response = AsyncLandingAIADEWithStreamedResponse(self)
508
513
 
@@ -771,6 +776,8 @@ class AsyncLandingAIADE(AsyncAPIClient):
771
776
 
772
777
  class LandingAIADEWithRawResponse:
773
778
  def __init__(self, client: LandingAIADE) -> None:
779
+ self.parse_jobs = parse_jobs.ParseJobsResourceWithRawResponse(client.parse_jobs)
780
+
774
781
  self.extract = to_raw_response_wrapper(
775
782
  client.extract,
776
783
  )
@@ -781,6 +788,8 @@ class LandingAIADEWithRawResponse:
781
788
 
782
789
  class AsyncLandingAIADEWithRawResponse:
783
790
  def __init__(self, client: AsyncLandingAIADE) -> None:
791
+ self.parse_jobs = parse_jobs.AsyncParseJobsResourceWithRawResponse(client.parse_jobs)
792
+
784
793
  self.extract = async_to_raw_response_wrapper(
785
794
  client.extract,
786
795
  )
@@ -791,6 +800,8 @@ class AsyncLandingAIADEWithRawResponse:
791
800
 
792
801
  class LandingAIADEWithStreamedResponse:
793
802
  def __init__(self, client: LandingAIADE) -> None:
803
+ self.parse_jobs = parse_jobs.ParseJobsResourceWithStreamingResponse(client.parse_jobs)
804
+
794
805
  self.extract = to_streamed_response_wrapper(
795
806
  client.extract,
796
807
  )
@@ -801,6 +812,8 @@ class LandingAIADEWithStreamedResponse:
801
812
 
802
813
  class AsyncLandingAIADEWithStreamedResponse:
803
814
  def __init__(self, client: AsyncLandingAIADE) -> None:
815
+ self.parse_jobs = parse_jobs.AsyncParseJobsResourceWithStreamingResponse(client.parse_jobs)
816
+
804
817
  self.extract = async_to_streamed_response_wrapper(
805
818
  client.extract,
806
819
  )
landingai_ade/_version.py CHANGED
@@ -1,4 +1,4 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  __title__ = "landingai_ade"
4
- __version__ = "0.17.1" # x-release-please-version
4
+ __version__ = "0.18.1" # x-release-please-version
@@ -1 +1,19 @@
1
1
  # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .parse_jobs import (
4
+ ParseJobsResource,
5
+ AsyncParseJobsResource,
6
+ ParseJobsResourceWithRawResponse,
7
+ AsyncParseJobsResourceWithRawResponse,
8
+ ParseJobsResourceWithStreamingResponse,
9
+ AsyncParseJobsResourceWithStreamingResponse,
10
+ )
11
+
12
+ __all__ = [
13
+ "ParseJobsResource",
14
+ "AsyncParseJobsResource",
15
+ "ParseJobsResourceWithRawResponse",
16
+ "AsyncParseJobsResourceWithRawResponse",
17
+ "ParseJobsResourceWithStreamingResponse",
18
+ "AsyncParseJobsResourceWithStreamingResponse",
19
+ ]
@@ -0,0 +1,462 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Mapping, Optional, cast
6
+ from typing_extensions import Literal
7
+
8
+ import httpx
9
+
10
+ from ..types import parse_job_list_params, parse_job_create_params
11
+ from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given
12
+ from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
13
+ from .._compat import cached_property
14
+ from .._resource import SyncAPIResource, AsyncAPIResource
15
+ from .._response import (
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ async_to_streamed_response_wrapper,
20
+ )
21
+ from .._base_client import make_request_options
22
+ from ..types.parse_job_get_response import ParseJobGetResponse
23
+ from ..types.parse_job_list_response import ParseJobListResponse
24
+ from ..types.parse_job_create_response import ParseJobCreateResponse
25
+
26
+ __all__ = ["ParseJobsResource", "AsyncParseJobsResource"]
27
+
28
+
29
+ class ParseJobsResource(SyncAPIResource):
30
+ @cached_property
31
+ def with_raw_response(self) -> ParseJobsResourceWithRawResponse:
32
+ """
33
+ This property can be used as a prefix for any HTTP method call to return
34
+ the raw response object instead of the parsed content.
35
+
36
+ For more information, see https://www.github.com/landing-ai/ade-python#accessing-raw-response-data-eg-headers
37
+ """
38
+ return ParseJobsResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> ParseJobsResourceWithStreamingResponse:
42
+ """
43
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
44
+
45
+ For more information, see https://www.github.com/landing-ai/ade-python#with_streaming_response
46
+ """
47
+ return ParseJobsResourceWithStreamingResponse(self)
48
+
49
+ def create(
50
+ self,
51
+ *,
52
+ document: Optional[FileTypes] | Omit = omit,
53
+ document_url: Optional[str] | Omit = omit,
54
+ model: Optional[str] | Omit = omit,
55
+ output_save_url: Optional[str] | Omit = omit,
56
+ split: Optional[Literal["page"]] | Omit = omit,
57
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
58
+ # The extra values given here take precedence over values defined on the client or passed to this method.
59
+ extra_headers: Headers | None = None,
60
+ extra_query: Query | None = None,
61
+ extra_body: Body | None = None,
62
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
63
+ ) -> ParseJobCreateResponse:
64
+ """
65
+ Parse documents asynchronously.
66
+
67
+ This endpoint creates a job that handles the processing for both large documents
68
+ and large batches of documents.
69
+
70
+ For EU users, use this endpoint:
71
+
72
+ `https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs`.
73
+
74
+ Args:
75
+ document: A file to be parsed. The file can be a PDF or an image. See the list of
76
+ supported file types here: https://docs.landing.ai/ade/ade-file-types. Either
77
+ this parameter or the `document_url` parameter must be provided.
78
+
79
+ document_url: The URL to the file to be parsed. The file can be a PDF or an image. See the
80
+ list of supported file types here: https://docs.landing.ai/ade/ade-file-types.
81
+ Either this parameter or the `document` parameter must be provided.
82
+
83
+ model: The version of the model to use for parsing.
84
+
85
+ output_save_url: If zero data retention (ZDR) is enabled, you must enter a URL for the parsed
86
+ output to be saved to. When ZDR is enabled, the parsed content will not be in
87
+ the API response.
88
+
89
+ split: If you want to split documents into smaller sections, include the split
90
+ parameter. Set the parameter to page to split documents at the page level. The
91
+ splits object in the API output will contain a set of data for each page.
92
+
93
+ extra_headers: Send extra headers
94
+
95
+ extra_query: Add additional query parameters to the request
96
+
97
+ extra_body: Add additional JSON properties to the request
98
+
99
+ timeout: Override the client-level default timeout for this request, in seconds
100
+ """
101
+ body = deepcopy_minimal(
102
+ {
103
+ "document": document,
104
+ "document_url": document_url,
105
+ "model": model,
106
+ "output_save_url": output_save_url,
107
+ "split": split,
108
+ }
109
+ )
110
+ files = extract_files(cast(Mapping[str, object], body), paths=[["document"]])
111
+ # It should be noted that the actual Content-Type header that will be
112
+ # sent to the server will contain a `boundary` parameter, e.g.
113
+ # multipart/form-data; boundary=---abc--
114
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
115
+ return self._post(
116
+ "/v1/ade/parse/jobs",
117
+ body=maybe_transform(body, parse_job_create_params.ParseJobCreateParams),
118
+ files=files,
119
+ options=make_request_options(
120
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
121
+ ),
122
+ cast_to=ParseJobCreateResponse,
123
+ )
124
+
125
+ def list(
126
+ self,
127
+ *,
128
+ page: int | Omit = omit,
129
+ page_size: int | Omit = omit,
130
+ status: Optional[Literal["cancelled", "completed", "failed", "pending", "processing"]] | Omit = omit,
131
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
132
+ # The extra values given here take precedence over values defined on the client or passed to this method.
133
+ extra_headers: Headers | None = None,
134
+ extra_query: Query | None = None,
135
+ extra_body: Body | None = None,
136
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
137
+ ) -> ParseJobListResponse:
138
+ """List all async parse jobs associated with your API key.
139
+
140
+ Returns the list of jobs
141
+ or an error response. For EU users, use this endpoint:
142
+
143
+ `https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs`.
144
+
145
+ Args:
146
+ page: Page number (0-indexed)
147
+
148
+ page_size: Number of items per page
149
+
150
+ status: Filter by job status.
151
+
152
+ extra_headers: Send extra headers
153
+
154
+ extra_query: Add additional query parameters to the request
155
+
156
+ extra_body: Add additional JSON properties to the request
157
+
158
+ timeout: Override the client-level default timeout for this request, in seconds
159
+ """
160
+ return self._get(
161
+ "/v1/ade/parse/jobs",
162
+ options=make_request_options(
163
+ extra_headers=extra_headers,
164
+ extra_query=extra_query,
165
+ extra_body=extra_body,
166
+ timeout=timeout,
167
+ query=maybe_transform(
168
+ {
169
+ "page": page,
170
+ "page_size": page_size,
171
+ "status": status,
172
+ },
173
+ parse_job_list_params.ParseJobListParams,
174
+ ),
175
+ ),
176
+ cast_to=ParseJobListResponse,
177
+ )
178
+
179
+ def get(
180
+ self,
181
+ job_id: str,
182
+ *,
183
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
184
+ # The extra values given here take precedence over values defined on the client or passed to this method.
185
+ extra_headers: Headers | None = None,
186
+ extra_query: Query | None = None,
187
+ extra_body: Body | None = None,
188
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
189
+ ) -> ParseJobGetResponse:
190
+ """
191
+ Get the status for an async parse job.
192
+
193
+ Returns the job status or an error response. For EU users, use this endpoint:
194
+
195
+ `https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs/{job_id}`.
196
+
197
+ Args:
198
+ extra_headers: Send extra headers
199
+
200
+ extra_query: Add additional query parameters to the request
201
+
202
+ extra_body: Add additional JSON properties to the request
203
+
204
+ timeout: Override the client-level default timeout for this request, in seconds
205
+ """
206
+ if not job_id:
207
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
208
+ return self._get(
209
+ f"/v1/ade/parse/jobs/{job_id}",
210
+ options=make_request_options(
211
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
212
+ ),
213
+ cast_to=ParseJobGetResponse,
214
+ )
215
+
216
+
217
+ class AsyncParseJobsResource(AsyncAPIResource):
218
+ @cached_property
219
+ def with_raw_response(self) -> AsyncParseJobsResourceWithRawResponse:
220
+ """
221
+ This property can be used as a prefix for any HTTP method call to return
222
+ the raw response object instead of the parsed content.
223
+
224
+ For more information, see https://www.github.com/landing-ai/ade-python#accessing-raw-response-data-eg-headers
225
+ """
226
+ return AsyncParseJobsResourceWithRawResponse(self)
227
+
228
+ @cached_property
229
+ def with_streaming_response(self) -> AsyncParseJobsResourceWithStreamingResponse:
230
+ """
231
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
232
+
233
+ For more information, see https://www.github.com/landing-ai/ade-python#with_streaming_response
234
+ """
235
+ return AsyncParseJobsResourceWithStreamingResponse(self)
236
+
237
+ async def create(
238
+ self,
239
+ *,
240
+ document: Optional[FileTypes] | Omit = omit,
241
+ document_url: Optional[str] | Omit = omit,
242
+ model: Optional[str] | Omit = omit,
243
+ output_save_url: Optional[str] | Omit = omit,
244
+ split: Optional[Literal["page"]] | Omit = omit,
245
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
246
+ # The extra values given here take precedence over values defined on the client or passed to this method.
247
+ extra_headers: Headers | None = None,
248
+ extra_query: Query | None = None,
249
+ extra_body: Body | None = None,
250
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
251
+ ) -> ParseJobCreateResponse:
252
+ """
253
+ Parse documents asynchronously.
254
+
255
+ This endpoint creates a job that handles the processing for both large documents
256
+ and large batches of documents.
257
+
258
+ For EU users, use this endpoint:
259
+
260
+ `https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs`.
261
+
262
+ Args:
263
+ document: A file to be parsed. The file can be a PDF or an image. See the list of
264
+ supported file types here: https://docs.landing.ai/ade/ade-file-types. Either
265
+ this parameter or the `document_url` parameter must be provided.
266
+
267
+ document_url: The URL to the file to be parsed. The file can be a PDF or an image. See the
268
+ list of supported file types here: https://docs.landing.ai/ade/ade-file-types.
269
+ Either this parameter or the `document` parameter must be provided.
270
+
271
+ model: The version of the model to use for parsing.
272
+
273
+ output_save_url: If zero data retention (ZDR) is enabled, you must enter a URL for the parsed
274
+ output to be saved to. When ZDR is enabled, the parsed content will not be in
275
+ the API response.
276
+
277
+ split: If you want to split documents into smaller sections, include the split
278
+ parameter. Set the parameter to page to split documents at the page level. The
279
+ splits object in the API output will contain a set of data for each page.
280
+
281
+ extra_headers: Send extra headers
282
+
283
+ extra_query: Add additional query parameters to the request
284
+
285
+ extra_body: Add additional JSON properties to the request
286
+
287
+ timeout: Override the client-level default timeout for this request, in seconds
288
+ """
289
+ body = deepcopy_minimal(
290
+ {
291
+ "document": document,
292
+ "document_url": document_url,
293
+ "model": model,
294
+ "output_save_url": output_save_url,
295
+ "split": split,
296
+ }
297
+ )
298
+ files = extract_files(cast(Mapping[str, object], body), paths=[["document"]])
299
+ # It should be noted that the actual Content-Type header that will be
300
+ # sent to the server will contain a `boundary` parameter, e.g.
301
+ # multipart/form-data; boundary=---abc--
302
+ extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
303
+ return await self._post(
304
+ "/v1/ade/parse/jobs",
305
+ body=await async_maybe_transform(body, parse_job_create_params.ParseJobCreateParams),
306
+ files=files,
307
+ options=make_request_options(
308
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
309
+ ),
310
+ cast_to=ParseJobCreateResponse,
311
+ )
312
+
313
+ async def list(
314
+ self,
315
+ *,
316
+ page: int | Omit = omit,
317
+ page_size: int | Omit = omit,
318
+ status: Optional[Literal["cancelled", "completed", "failed", "pending", "processing"]] | Omit = omit,
319
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
320
+ # The extra values given here take precedence over values defined on the client or passed to this method.
321
+ extra_headers: Headers | None = None,
322
+ extra_query: Query | None = None,
323
+ extra_body: Body | None = None,
324
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
325
+ ) -> ParseJobListResponse:
326
+ """List all async parse jobs associated with your API key.
327
+
328
+ Returns the list of jobs
329
+ or an error response. For EU users, use this endpoint:
330
+
331
+ `https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs`.
332
+
333
+ Args:
334
+ page: Page number (0-indexed)
335
+
336
+ page_size: Number of items per page
337
+
338
+ status: Filter by job status.
339
+
340
+ extra_headers: Send extra headers
341
+
342
+ extra_query: Add additional query parameters to the request
343
+
344
+ extra_body: Add additional JSON properties to the request
345
+
346
+ timeout: Override the client-level default timeout for this request, in seconds
347
+ """
348
+ return await self._get(
349
+ "/v1/ade/parse/jobs",
350
+ options=make_request_options(
351
+ extra_headers=extra_headers,
352
+ extra_query=extra_query,
353
+ extra_body=extra_body,
354
+ timeout=timeout,
355
+ query=await async_maybe_transform(
356
+ {
357
+ "page": page,
358
+ "page_size": page_size,
359
+ "status": status,
360
+ },
361
+ parse_job_list_params.ParseJobListParams,
362
+ ),
363
+ ),
364
+ cast_to=ParseJobListResponse,
365
+ )
366
+
367
+ async def get(
368
+ self,
369
+ job_id: str,
370
+ *,
371
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
372
+ # The extra values given here take precedence over values defined on the client or passed to this method.
373
+ extra_headers: Headers | None = None,
374
+ extra_query: Query | None = None,
375
+ extra_body: Body | None = None,
376
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
377
+ ) -> ParseJobGetResponse:
378
+ """
379
+ Get the status for an async parse job.
380
+
381
+ Returns the job status or an error response. For EU users, use this endpoint:
382
+
383
+ `https://api.va.eu-west-1.landing.ai/v1/ade/parse/jobs/{job_id}`.
384
+
385
+ Args:
386
+ extra_headers: Send extra headers
387
+
388
+ extra_query: Add additional query parameters to the request
389
+
390
+ extra_body: Add additional JSON properties to the request
391
+
392
+ timeout: Override the client-level default timeout for this request, in seconds
393
+ """
394
+ if not job_id:
395
+ raise ValueError(f"Expected a non-empty value for `job_id` but received {job_id!r}")
396
+ return await self._get(
397
+ f"/v1/ade/parse/jobs/{job_id}",
398
+ options=make_request_options(
399
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
400
+ ),
401
+ cast_to=ParseJobGetResponse,
402
+ )
403
+
404
+
405
+ class ParseJobsResourceWithRawResponse:
406
+ def __init__(self, parse_jobs: ParseJobsResource) -> None:
407
+ self._parse_jobs = parse_jobs
408
+
409
+ self.create = to_raw_response_wrapper(
410
+ parse_jobs.create,
411
+ )
412
+ self.list = to_raw_response_wrapper(
413
+ parse_jobs.list,
414
+ )
415
+ self.get = to_raw_response_wrapper(
416
+ parse_jobs.get,
417
+ )
418
+
419
+
420
+ class AsyncParseJobsResourceWithRawResponse:
421
+ def __init__(self, parse_jobs: AsyncParseJobsResource) -> None:
422
+ self._parse_jobs = parse_jobs
423
+
424
+ self.create = async_to_raw_response_wrapper(
425
+ parse_jobs.create,
426
+ )
427
+ self.list = async_to_raw_response_wrapper(
428
+ parse_jobs.list,
429
+ )
430
+ self.get = async_to_raw_response_wrapper(
431
+ parse_jobs.get,
432
+ )
433
+
434
+
435
+ class ParseJobsResourceWithStreamingResponse:
436
+ def __init__(self, parse_jobs: ParseJobsResource) -> None:
437
+ self._parse_jobs = parse_jobs
438
+
439
+ self.create = to_streamed_response_wrapper(
440
+ parse_jobs.create,
441
+ )
442
+ self.list = to_streamed_response_wrapper(
443
+ parse_jobs.list,
444
+ )
445
+ self.get = to_streamed_response_wrapper(
446
+ parse_jobs.get,
447
+ )
448
+
449
+
450
+ class AsyncParseJobsResourceWithStreamingResponse:
451
+ def __init__(self, parse_jobs: AsyncParseJobsResource) -> None:
452
+ self._parse_jobs = parse_jobs
453
+
454
+ self.create = async_to_streamed_response_wrapper(
455
+ parse_jobs.create,
456
+ )
457
+ self.list = async_to_streamed_response_wrapper(
458
+ parse_jobs.list,
459
+ )
460
+ self.get = async_to_streamed_response_wrapper(
461
+ parse_jobs.get,
462
+ )
@@ -2,7 +2,13 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ from .shared import ParseMetadata as ParseMetadata, ParseGroundingBox as ParseGroundingBox
5
6
  from .parse_response import ParseResponse as ParseResponse
6
7
  from .extract_response import ExtractResponse as ExtractResponse
7
8
  from .client_parse_params import ClientParseParams as ClientParseParams
8
9
  from .client_extract_params import ClientExtractParams as ClientExtractParams
10
+ from .parse_job_list_params import ParseJobListParams as ParseJobListParams
11
+ from .parse_job_get_response import ParseJobGetResponse as ParseJobGetResponse
12
+ from .parse_job_create_params import ParseJobCreateParams as ParseJobCreateParams
13
+ from .parse_job_list_response import ParseJobListResponse as ParseJobListResponse
14
+ from .parse_job_create_response import ParseJobCreateResponse as ParseJobCreateResponse
@@ -0,0 +1,45 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, TypedDict
7
+
8
+ from .._types import FileTypes
9
+
10
+ __all__ = ["ParseJobCreateParams"]
11
+
12
+
13
+ class ParseJobCreateParams(TypedDict, total=False):
14
+ document: Optional[FileTypes]
15
+ """A file to be parsed.
16
+
17
+ The file can be a PDF or an image. See the list of supported file types here:
18
+ https://docs.landing.ai/ade/ade-file-types. Either this parameter or the
19
+ `document_url` parameter must be provided.
20
+ """
21
+
22
+ document_url: Optional[str]
23
+ """The URL to the file to be parsed.
24
+
25
+ The file can be a PDF or an image. See the list of supported file types here:
26
+ https://docs.landing.ai/ade/ade-file-types. Either this parameter or the
27
+ `document` parameter must be provided.
28
+ """
29
+
30
+ model: Optional[str]
31
+ """The version of the model to use for parsing."""
32
+
33
+ output_save_url: Optional[str]
34
+ """
35
+ If zero data retention (ZDR) is enabled, you must enter a URL for the parsed
36
+ output to be saved to. When ZDR is enabled, the parsed content will not be in
37
+ the API response.
38
+ """
39
+
40
+ split: Optional[Literal["page"]]
41
+ """
42
+ If you want to split documents into smaller sections, include the split
43
+ parameter. Set the parameter to page to split documents at the page level. The
44
+ splits object in the API output will contain a set of data for each page.
45
+ """
@@ -0,0 +1,9 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .._models import BaseModel
4
+
5
+ __all__ = ["ParseJobCreateResponse"]
6
+
7
+
8
+ class ParseJobCreateResponse(BaseModel):
9
+ job_id: str
@@ -0,0 +1,111 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Dict, List, Optional
4
+ from typing_extensions import Literal
5
+
6
+ from pydantic import Field as FieldInfo
7
+
8
+ from .._models import BaseModel
9
+ from .shared.parse_metadata import ParseMetadata
10
+ from .shared.parse_grounding_box import ParseGroundingBox
11
+
12
+ __all__ = ["ParseJobGetResponse", "Data", "DataChunk", "DataChunkGrounding", "DataSplit", "DataGrounding"]
13
+
14
+
15
+ class DataChunkGrounding(BaseModel):
16
+ box: ParseGroundingBox
17
+
18
+ page: int
19
+
20
+
21
+ class DataChunk(BaseModel):
22
+ id: str
23
+
24
+ grounding: DataChunkGrounding
25
+
26
+ markdown: str
27
+
28
+ type: str
29
+
30
+
31
+ class DataSplit(BaseModel):
32
+ chunks: List[str]
33
+
34
+ class_: str = FieldInfo(alias="class")
35
+
36
+ identifier: str
37
+
38
+ markdown: str
39
+
40
+ pages: List[int]
41
+
42
+
43
+ class DataGrounding(BaseModel):
44
+ box: ParseGroundingBox
45
+
46
+ page: int
47
+
48
+ type: Literal[
49
+ "chunkLogo",
50
+ "chunkCard",
51
+ "chunkAttestation",
52
+ "chunkScanCode",
53
+ "chunkForm",
54
+ "chunkTable",
55
+ "chunkFigure",
56
+ "chunkText",
57
+ "chunkMarginalia",
58
+ "chunkTitle",
59
+ "chunkPageHeader",
60
+ "chunkPageFooter",
61
+ "chunkPageNumber",
62
+ "chunkKeyValue",
63
+ "table",
64
+ "tableCell",
65
+ ]
66
+
67
+
68
+ class Data(BaseModel):
69
+ chunks: List[DataChunk]
70
+
71
+ markdown: str
72
+
73
+ metadata: ParseMetadata
74
+
75
+ splits: List[DataSplit]
76
+
77
+ grounding: Optional[Dict[str, DataGrounding]] = None
78
+
79
+
80
+ class ParseJobGetResponse(BaseModel):
81
+ job_id: str
82
+
83
+ progress: float
84
+ """
85
+ Job completion progress as a decimal from 0 to 1, where 0 is not started, 1 is
86
+ finished, and values between 0 and 1 indicate work in progress.
87
+ """
88
+
89
+ received_at: int
90
+
91
+ status: str
92
+
93
+ data: Optional[Data] = None
94
+ """
95
+ The parsed output, if the job is complete and the `output_save_url` parameter
96
+ was not used.
97
+ """
98
+
99
+ failure_reason: Optional[str] = None
100
+
101
+ metadata: Optional[ParseMetadata] = None
102
+
103
+ org_id: Optional[str] = None
104
+
105
+ output_url: Optional[str] = None
106
+ """
107
+ The URL to the parsed content, if the job is complete and the result is larger
108
+ than 1MB or the `output_save_url` parameter was used.
109
+ """
110
+
111
+ version: Optional[str] = None
@@ -0,0 +1,21 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Optional
6
+ from typing_extensions import Literal, Annotated, TypedDict
7
+
8
+ from .._utils import PropertyInfo
9
+
10
+ __all__ = ["ParseJobListParams"]
11
+
12
+
13
+ class ParseJobListParams(TypedDict, total=False):
14
+ page: int
15
+ """Page number (0-indexed)"""
16
+
17
+ page_size: Annotated[int, PropertyInfo(alias="pageSize")]
18
+ """Number of items per page"""
19
+
20
+ status: Optional[Literal["cancelled", "completed", "failed", "pending", "processing"]]
21
+ """Filter by job status."""
@@ -0,0 +1,31 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import List, Optional
4
+
5
+ from .._models import BaseModel
6
+
7
+ __all__ = ["ParseJobListResponse", "Job"]
8
+
9
+
10
+ class Job(BaseModel):
11
+ job_id: str
12
+
13
+ progress: float
14
+ """
15
+ Job completion progress as a decimal from 0 to 1, where 0 is not started, 1 is
16
+ finished, and values between 0 and 1 indicate work in progress.
17
+ """
18
+
19
+ received_at: int
20
+
21
+ status: str
22
+
23
+ failure_reason: Optional[str] = None
24
+
25
+
26
+ class ParseJobListResponse(BaseModel):
27
+ jobs: List[Job]
28
+
29
+ has_more: Optional[bool] = None
30
+
31
+ org_id: Optional[str] = None
@@ -6,31 +6,14 @@ from typing_extensions import Literal
6
6
  from pydantic import Field as FieldInfo
7
7
 
8
8
  from .._models import BaseModel
9
+ from .shared.parse_metadata import ParseMetadata
10
+ from .shared.parse_grounding_box import ParseGroundingBox
9
11
 
10
- __all__ = [
11
- "ParseResponse",
12
- "Chunk",
13
- "ChunkGrounding",
14
- "ChunkGroundingBox",
15
- "Metadata",
16
- "Split",
17
- "Grounding",
18
- "GroundingBox",
19
- ]
20
-
21
-
22
- class ChunkGroundingBox(BaseModel):
23
- bottom: float
24
-
25
- left: float
26
-
27
- right: float
28
-
29
- top: float
12
+ __all__ = ["ParseResponse", "Chunk", "ChunkGrounding", "Split", "Grounding"]
30
13
 
31
14
 
32
15
  class ChunkGrounding(BaseModel):
33
- box: ChunkGroundingBox
16
+ box: ParseGroundingBox
34
17
 
35
18
  page: int
36
19
 
@@ -45,22 +28,6 @@ class Chunk(BaseModel):
45
28
  type: str
46
29
 
47
30
 
48
- class Metadata(BaseModel):
49
- credit_usage: float
50
-
51
- duration_ms: int
52
-
53
- filename: str
54
-
55
- job_id: str
56
-
57
- org_id: Optional[str] = None
58
-
59
- page_count: int
60
-
61
- version: Optional[str] = None
62
-
63
-
64
31
  class Split(BaseModel):
65
32
  chunks: List[str]
66
33
 
@@ -73,18 +40,8 @@ class Split(BaseModel):
73
40
  pages: List[int]
74
41
 
75
42
 
76
- class GroundingBox(BaseModel):
77
- bottom: float
78
-
79
- left: float
80
-
81
- right: float
82
-
83
- top: float
84
-
85
-
86
43
  class Grounding(BaseModel):
87
- box: GroundingBox
44
+ box: ParseGroundingBox
88
45
 
89
46
  page: int
90
47
 
@@ -113,7 +70,7 @@ class ParseResponse(BaseModel):
113
70
 
114
71
  markdown: str
115
72
 
116
- metadata: Metadata
73
+ metadata: ParseMetadata
117
74
 
118
75
  splits: List[Split]
119
76
 
@@ -0,0 +1,4 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .parse_metadata import ParseMetadata as ParseMetadata
4
+ from .parse_grounding_box import ParseGroundingBox as ParseGroundingBox
@@ -0,0 +1,15 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from ..._models import BaseModel
4
+
5
+ __all__ = ["ParseGroundingBox"]
6
+
7
+
8
+ class ParseGroundingBox(BaseModel):
9
+ bottom: float
10
+
11
+ left: float
12
+
13
+ right: float
14
+
15
+ top: float
@@ -0,0 +1,23 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from typing import Optional
4
+
5
+ from ..._models import BaseModel
6
+
7
+ __all__ = ["ParseMetadata"]
8
+
9
+
10
+ class ParseMetadata(BaseModel):
11
+ credit_usage: float
12
+
13
+ duration_ms: int
14
+
15
+ filename: str
16
+
17
+ job_id: str
18
+
19
+ org_id: Optional[str] = None
20
+
21
+ page_count: int
22
+
23
+ version: Optional[str] = None
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: landingai-ade
3
- Version: 0.17.1
3
+ Version: 0.18.1
4
4
  Summary: The official Python library for the landingai-ade API
5
5
  Project-URL: Homepage, https://github.com/landing-ai/ade-python
6
6
  Project-URL: Repository, https://github.com/landing-ai/ade-python
@@ -110,6 +110,39 @@ response = client.extract(
110
110
  )
111
111
  ```
112
112
 
113
+ ### Parse Jobs
114
+
115
+ For processing large documents or batches of documents asynchronously:
116
+
117
+ ```python
118
+ import os
119
+ from landingai_ade import LandingAIADE
120
+
121
+ client = LandingAIADE(
122
+ apikey=os.environ.get("VISION_AGENT_API_KEY"),
123
+ )
124
+
125
+ # Create an async parse job
126
+ job = client.parse_jobs.create(
127
+ document_url="path/to/large_file.pdf",
128
+ model="dpt-2-latest",
129
+ )
130
+ print(f"Job created with ID: {job.job_id}")
131
+
132
+ # Get job status
133
+ job_status = client.parse_jobs.get(job.job_id)
134
+ print(f"Status: {job_status.status}")
135
+
136
+ # List all jobs (with optional filtering)
137
+ response = client.parse_jobs.list(
138
+ status="completed",
139
+ page=0,
140
+ page_size=10,
141
+ )
142
+ for job in response.jobs:
143
+ print(f"Job {job.job_id}: {job.status}")
144
+ ```
145
+
113
146
  ## Async usage
114
147
 
115
148
  Simply import `AsyncLandingAIADE` instead of `LandingAIADE` and use `await` with each API call:
@@ -1,6 +1,6 @@
1
1
  landingai_ade/__init__.py,sha256=tyK5QngTNcumeBQ-uhvyRts2TtXr0eAR5rofvktz7JA,2760
2
2
  landingai_ade/_base_client.py,sha256=vIP54_-Z2Yetpi2x_3RCVmlu7G48VMSe8j18zhXzunQ,67054
3
- landingai_ade/_client.py,sha256=vdEFrGlNYiZP9A5O_f66VGuHKN_xOhXlAWyALHbLN4k,31628
3
+ landingai_ade/_client.py,sha256=gycUxuygm0f3-PHdir_SXe1kSRrAEA66csjModozggE,32266
4
4
  landingai_ade/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
5
5
  landingai_ade/_constants.py,sha256=GTZei0iejG5c3XydQEK4LDinwvGVxPC4N-6h-xuhSHU,464
6
6
  landingai_ade/_exceptions.py,sha256=bunb9U_h8wb2_IA8tRYVuTx-clbqqDgX8pjmdgX10d8,3232
@@ -11,7 +11,7 @@ landingai_ade/_resource.py,sha256=fZFMI9zYnf0F6ACBB8teJVzhBelkymH2SMQripxfTvI,11
11
11
  landingai_ade/_response.py,sha256=qUH6kfV7CszYHyJKTrJXtJY5b2zPizEM6HyGgsisLtI,28858
12
12
  landingai_ade/_streaming.py,sha256=V4RaEBKfcNOdOfTAwMzlx_klsTLILvpnS7PvBWC5Exw,10124
13
13
  landingai_ade/_types.py,sha256=8of7ETx2GzlS0kq-JMky4iQt-ZtOQeppgwjQMFF85nw,7253
14
- landingai_ade/_version.py,sha256=ZVdIAXL52rfwaxCCW0ymN4W-ZIHvacOWmjq5N06Tzt4,166
14
+ landingai_ade/_version.py,sha256=J0nnSdAhAwIhIfQCi8w7YdO3y9QHkqbcM9bCD03XT6g,166
15
15
  landingai_ade/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  landingai_ade/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
17
17
  landingai_ade/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
@@ -29,13 +29,22 @@ landingai_ade/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
29
29
  landingai_ade/lib/__init__.py,sha256=3a77mMSE61vT4VRcNc5b73fFsbw3vJrrYyAbvQaxUHA,237
30
30
  landingai_ade/lib/schema_utils.py,sha256=TdfJbeyRaKuaaNpookuFwqasjxcYBXp0nvp3h9kXPDw,2517
31
31
  landingai_ade/lib/url_utils.py,sha256=ydhsvrpcdM4DBoZOIbp83dME9FeKotUDtpzFVU9FZUE,1797
32
- landingai_ade/resources/__init__.py,sha256=ikKh5ucm9qFI-Z42nOKxhBhEI-YHaaxvsSddO_Nx0-Y,86
33
- landingai_ade/types/__init__.py,sha256=afoInmNk4PL0G9bmARTsVXzAhFCGNtx5LFSKwm9VYq8,397
32
+ landingai_ade/resources/__init__.py,sha256=uP_UKFsmplo1qU_TnDP8rwXTxU79sg8GN1hlS_Q5nB4,592
33
+ landingai_ade/resources/parse_jobs.py,sha256=tznIAGBItox2dzX7cpCm_3pQCOEjb91vk7IPgin7aZY,18389
34
+ landingai_ade/types/__init__.py,sha256=s_wWgLvdXN0Hzs8vLc5U632eNNXha3I5B2IrOnGePQ8,895
34
35
  landingai_ade/types/client_extract_params.py,sha256=efQQ2wiFompakO6LC0fxL6TzuqFsw5FdXInxhTTIUXU,921
35
36
  landingai_ade/types/client_parse_params.py,sha256=sTqMewspihj9q4BcgBYGoSJJlDjapsvPYBeoYlUAXp0,1250
36
37
  landingai_ade/types/extract_response.py,sha256=mAxHf_kqtu5y46GRTaq4KxhZ97oI-t7LD4qvEUduxf4,657
37
- landingai_ade/types/parse_response.py,sha256=K-Ig1Ak2S7pMyBNbnR5yM5ZXkOAtH3PAnu4NtFNusrc,1793
38
- landingai_ade-0.17.1.dist-info/METADATA,sha256=qT9UMtr1wDM_kIeSbFPoButmcNhF11wJw4dKYxAQYmE,15290
39
- landingai_ade-0.17.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
40
- landingai_ade-0.17.1.dist-info/licenses/LICENSE,sha256=xQsP4c8KA_Ov7OhSD-tj_2U8RQ8z9MQUy-WEjgbJdZU,11343
41
- landingai_ade-0.17.1.dist-info/RECORD,,
38
+ landingai_ade/types/parse_job_create_params.py,sha256=9SnmYVO8drEli7s6vAAPTTjn_0Q0q8iqYOKrz1Pm0lI,1493
39
+ landingai_ade/types/parse_job_create_response.py,sha256=zUwhgmLwinXwOUMSY9uNNxJitcKAZ7TRjd9Y8kprG1o,216
40
+ landingai_ade/types/parse_job_get_response.py,sha256=DFqbKV_brsPxQYI1r5z3TEp4_SMU8IEaZLHVrGCNmxk,2253
41
+ landingai_ade/types/parse_job_list_params.py,sha256=iAbSMFwDYnL7mmFWHy0h4xzsCzZgGkAp5rzuDwRPSXs,602
42
+ landingai_ade/types/parse_job_list_response.py,sha256=hLqYNT7qzqaC0Ri7FYswWxuoGGUzAnhqNYLQu1b6znQ,638
43
+ landingai_ade/types/parse_response.py,sha256=yr_IvBPWJBwK22FJ3spqcdvaD19enADGBZxn8fdQVjo,1416
44
+ landingai_ade/types/shared/__init__.py,sha256=n7dKpO8IQEstmlDczxcje4R_Kkg9EKn3UMejh8Q7_ns,218
45
+ landingai_ade/types/shared/parse_grounding_box.py,sha256=tZ85sGAtkcTs-_jiVjD-hK8tHTn6vh6VHEW_ndmBB3w,260
46
+ landingai_ade/types/shared/parse_metadata.py,sha256=r509Ig1rWW96pplh3PR25wNH40mGJBFENgsLvSFmHgY,384
47
+ landingai_ade-0.18.1.dist-info/METADATA,sha256=bL72j-YFnz8_lHPdeluZ_hqIni-cd0KPgOJ6naF3xJ4,16003
48
+ landingai_ade-0.18.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
49
+ landingai_ade-0.18.1.dist-info/licenses/LICENSE,sha256=xQsP4c8KA_Ov7OhSD-tj_2U8RQ8z9MQUy-WEjgbJdZU,11343
50
+ landingai_ade-0.18.1.dist-info/RECORD,,