landingai-ade 0.14.1__py3-none-any.whl → 0.21.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.
- landingai_ade/_client.py +25 -8
- landingai_ade/_constants.py +2 -2
- landingai_ade/_files.py +12 -1
- landingai_ade/_models.py +8 -3
- landingai_ade/_streaming.py +4 -6
- landingai_ade/_types.py +2 -2
- landingai_ade/_utils/_sync.py +3 -31
- landingai_ade/_utils/_utils.py +1 -1
- landingai_ade/_version.py +1 -1
- landingai_ade/resources/__init__.py +18 -0
- landingai_ade/resources/parse_jobs.py +462 -0
- landingai_ade/types/__init__.py +6 -0
- landingai_ade/types/client_extract_params.py +6 -3
- landingai_ade/types/extract_response.py +7 -0
- landingai_ade/types/parse_job_create_params.py +45 -0
- landingai_ade/types/parse_job_create_response.py +9 -0
- landingai_ade/types/parse_job_get_response.py +233 -0
- landingai_ade/types/parse_job_list_params.py +21 -0
- landingai_ade/types/parse_job_list_response.py +31 -0
- landingai_ade/types/parse_response.py +6 -49
- landingai_ade/types/shared/__init__.py +4 -0
- landingai_ade/types/shared/parse_grounding_box.py +15 -0
- landingai_ade/types/shared/parse_metadata.py +25 -0
- {landingai_ade-0.14.1.dist-info → landingai_ade-0.21.1.dist-info}/METADATA +51 -14
- landingai_ade-0.21.1.dist-info/RECORD +50 -0
- landingai_ade-0.14.1.dist-info/RECORD +0 -41
- {landingai_ade-0.14.1.dist-info → landingai_ade-0.21.1.dist-info}/WHEEL +0 -0
- {landingai_ade-0.14.1.dist-info → landingai_ade-0.21.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Union, Optional
|
|
4
|
+
from typing_extensions import Literal, TypeAlias
|
|
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__ = [
|
|
13
|
+
"ParseJobGetResponse",
|
|
14
|
+
"Data",
|
|
15
|
+
"DataParseResponse",
|
|
16
|
+
"DataParseResponseChunk",
|
|
17
|
+
"DataParseResponseChunkGrounding",
|
|
18
|
+
"DataParseResponseSplit",
|
|
19
|
+
"DataParseResponseGrounding",
|
|
20
|
+
"DataSpreadsheetParseResponse",
|
|
21
|
+
"DataSpreadsheetParseResponseChunk",
|
|
22
|
+
"DataSpreadsheetParseResponseChunkGrounding",
|
|
23
|
+
"DataSpreadsheetParseResponseMetadata",
|
|
24
|
+
"DataSpreadsheetParseResponseSplit",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class DataParseResponseChunkGrounding(BaseModel):
|
|
29
|
+
box: ParseGroundingBox
|
|
30
|
+
|
|
31
|
+
page: int
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DataParseResponseChunk(BaseModel):
|
|
35
|
+
id: str
|
|
36
|
+
|
|
37
|
+
grounding: DataParseResponseChunkGrounding
|
|
38
|
+
|
|
39
|
+
markdown: str
|
|
40
|
+
|
|
41
|
+
type: str
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class DataParseResponseSplit(BaseModel):
|
|
45
|
+
chunks: List[str]
|
|
46
|
+
|
|
47
|
+
class_: str = FieldInfo(alias="class")
|
|
48
|
+
|
|
49
|
+
identifier: str
|
|
50
|
+
|
|
51
|
+
markdown: str
|
|
52
|
+
|
|
53
|
+
pages: List[int]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class DataParseResponseGrounding(BaseModel):
|
|
57
|
+
box: ParseGroundingBox
|
|
58
|
+
|
|
59
|
+
page: int
|
|
60
|
+
|
|
61
|
+
type: Literal[
|
|
62
|
+
"chunkLogo",
|
|
63
|
+
"chunkCard",
|
|
64
|
+
"chunkAttestation",
|
|
65
|
+
"chunkScanCode",
|
|
66
|
+
"chunkForm",
|
|
67
|
+
"chunkTable",
|
|
68
|
+
"chunkFigure",
|
|
69
|
+
"chunkText",
|
|
70
|
+
"chunkMarginalia",
|
|
71
|
+
"chunkTitle",
|
|
72
|
+
"chunkPageHeader",
|
|
73
|
+
"chunkPageFooter",
|
|
74
|
+
"chunkPageNumber",
|
|
75
|
+
"chunkKeyValue",
|
|
76
|
+
"table",
|
|
77
|
+
"tableCell",
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class DataParseResponse(BaseModel):
|
|
82
|
+
chunks: List[DataParseResponseChunk]
|
|
83
|
+
|
|
84
|
+
markdown: str
|
|
85
|
+
|
|
86
|
+
metadata: ParseMetadata
|
|
87
|
+
|
|
88
|
+
splits: List[DataParseResponseSplit]
|
|
89
|
+
|
|
90
|
+
grounding: Optional[Dict[str, DataParseResponseGrounding]] = None
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class DataSpreadsheetParseResponseChunkGrounding(BaseModel):
|
|
94
|
+
box: ParseGroundingBox
|
|
95
|
+
|
|
96
|
+
page: int
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class DataSpreadsheetParseResponseChunk(BaseModel):
|
|
100
|
+
id: str
|
|
101
|
+
"""
|
|
102
|
+
Chunk ID - format: '{sheet_name}-{cell_range}' for tables,
|
|
103
|
+
'{sheet_name}-image-{index}-{anchor_cell}-chunk-{i}-{type}' for parsed image
|
|
104
|
+
chunks
|
|
105
|
+
"""
|
|
106
|
+
|
|
107
|
+
markdown: str
|
|
108
|
+
"""
|
|
109
|
+
Chunk content as HTML table with anchor tag (for tables) or parsed markdown
|
|
110
|
+
content (for chunks from images)
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
type: str
|
|
114
|
+
"""
|
|
115
|
+
Chunk type: 'table' for spreadsheet tables, or types from /parse (text, table,
|
|
116
|
+
figure, form, etc.) for chunks derived from embedded images
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
grounding: Optional[DataSpreadsheetParseResponseChunkGrounding] = None
|
|
120
|
+
"""
|
|
121
|
+
Visual grounding coordinates from /parse API (only for chunks derived from
|
|
122
|
+
embedded images)
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class DataSpreadsheetParseResponseMetadata(BaseModel):
|
|
127
|
+
duration_ms: int
|
|
128
|
+
"""Processing duration in milliseconds"""
|
|
129
|
+
|
|
130
|
+
filename: str
|
|
131
|
+
"""Original filename"""
|
|
132
|
+
|
|
133
|
+
sheet_count: int
|
|
134
|
+
"""Number of sheets processed"""
|
|
135
|
+
|
|
136
|
+
total_cells: int
|
|
137
|
+
"""Total non-empty cells across all sheets"""
|
|
138
|
+
|
|
139
|
+
total_chunks: int
|
|
140
|
+
"""Total chunks (tables + images) extracted"""
|
|
141
|
+
|
|
142
|
+
total_rows: int
|
|
143
|
+
"""Total rows across all sheets"""
|
|
144
|
+
|
|
145
|
+
credit_usage: Optional[float] = None
|
|
146
|
+
"""Credits charged"""
|
|
147
|
+
|
|
148
|
+
job_id: Optional[str] = None
|
|
149
|
+
"""Inference history job ID"""
|
|
150
|
+
|
|
151
|
+
org_id: Optional[str] = None
|
|
152
|
+
"""Organization ID"""
|
|
153
|
+
|
|
154
|
+
total_images: Optional[int] = None
|
|
155
|
+
"""Total images extracted"""
|
|
156
|
+
|
|
157
|
+
version: Optional[str] = None
|
|
158
|
+
"""Model version for parsing images"""
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
class DataSpreadsheetParseResponseSplit(BaseModel):
|
|
162
|
+
chunks: List[str]
|
|
163
|
+
"""Chunk IDs in this split"""
|
|
164
|
+
|
|
165
|
+
class_: str = FieldInfo(alias="class")
|
|
166
|
+
"""
|
|
167
|
+
Split class: 'page' for per-sheet splits, 'full' for single split with all
|
|
168
|
+
content
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
identifier: str
|
|
172
|
+
"""Split identifier: sheet name for 'page' splits, 'full' for full split"""
|
|
173
|
+
|
|
174
|
+
markdown: str
|
|
175
|
+
"""Combined markdown for this split"""
|
|
176
|
+
|
|
177
|
+
sheets: List[int]
|
|
178
|
+
"""Sheet indices: single element for 'page' splits, all indices for 'full' split"""
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class DataSpreadsheetParseResponse(BaseModel):
|
|
182
|
+
chunks: List[DataSpreadsheetParseResponseChunk]
|
|
183
|
+
"""List of table chunks (HTML)"""
|
|
184
|
+
|
|
185
|
+
markdown: str
|
|
186
|
+
"""Full document as HTML with anchor tags and tables"""
|
|
187
|
+
|
|
188
|
+
metadata: DataSpreadsheetParseResponseMetadata
|
|
189
|
+
"""Metadata for spreadsheet parsing result."""
|
|
190
|
+
|
|
191
|
+
splits: List[DataSpreadsheetParseResponseSplit]
|
|
192
|
+
"""Sheet-based splits"""
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
Data: TypeAlias = Union[DataParseResponse, DataSpreadsheetParseResponse, None]
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
class ParseJobGetResponse(BaseModel):
|
|
199
|
+
job_id: str
|
|
200
|
+
|
|
201
|
+
progress: float
|
|
202
|
+
"""
|
|
203
|
+
Job completion progress as a decimal from 0 to 1, where 0 is not started, 1 is
|
|
204
|
+
finished, and values between 0 and 1 indicate work in progress.
|
|
205
|
+
"""
|
|
206
|
+
|
|
207
|
+
received_at: int
|
|
208
|
+
|
|
209
|
+
status: str
|
|
210
|
+
|
|
211
|
+
data: Optional[Data] = None
|
|
212
|
+
"""
|
|
213
|
+
The parsed output (ParseResponse for documents, SpreadsheetParseResponse for
|
|
214
|
+
spreadsheets), if the job is complete and the `output_save_url` parameter was
|
|
215
|
+
not used.
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
failure_reason: Optional[str] = None
|
|
219
|
+
|
|
220
|
+
metadata: Optional[ParseMetadata] = None
|
|
221
|
+
|
|
222
|
+
org_id: Optional[str] = None
|
|
223
|
+
|
|
224
|
+
output_url: Optional[str] = None
|
|
225
|
+
"""The URL to the parsed content.
|
|
226
|
+
|
|
227
|
+
This field contains a URL when the job is complete and either you specified the
|
|
228
|
+
`output_save_url` parameter or the result is larger than 1MB. When the result
|
|
229
|
+
exceeds 1MB, the URL is a presigned S3 URL that expires after 1 hour. Each time
|
|
230
|
+
you GET the job, a new presigned URL is generated.
|
|
231
|
+
"""
|
|
232
|
+
|
|
233
|
+
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:
|
|
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:
|
|
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:
|
|
73
|
+
metadata: ParseMetadata
|
|
117
74
|
|
|
118
75
|
splits: List[Split]
|
|
119
76
|
|
|
@@ -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,25 @@
|
|
|
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__ = ["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
|
|
24
|
+
|
|
25
|
+
failed_pages: Optional[List[int]] = None
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: landingai-ade
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.21.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
|
|
@@ -13,7 +13,6 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Operating System :: POSIX
|
|
15
15
|
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -21,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
22
|
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.9
|
|
25
24
|
Requires-Dist: anyio<5,>=3.5.0
|
|
26
25
|
Requires-Dist: distro<2,>=1.7.0
|
|
27
26
|
Requires-Dist: httpx<1,>=0.23.0
|
|
@@ -30,7 +29,7 @@ Requires-Dist: sniffio
|
|
|
30
29
|
Requires-Dist: typing-extensions<5,>=4.10
|
|
31
30
|
Provides-Extra: aiohttp
|
|
32
31
|
Requires-Dist: aiohttp; extra == 'aiohttp'
|
|
33
|
-
Requires-Dist: httpx-aiohttp>=0.1.
|
|
32
|
+
Requires-Dist: httpx-aiohttp>=0.1.9; extra == 'aiohttp'
|
|
34
33
|
Description-Content-Type: text/markdown
|
|
35
34
|
|
|
36
35
|
<!-- @format -->
|
|
@@ -40,7 +39,7 @@ Description-Content-Type: text/markdown
|
|
|
40
39
|
<!-- prettier-ignore -->
|
|
41
40
|
[)](https://pypi.org/project/landingai-ade/)
|
|
42
41
|
|
|
43
|
-
The LandingAI ADE Python library provides convenient access to the LandingAI ADE REST API from any Python 3.
|
|
42
|
+
The LandingAI ADE Python library provides convenient access to the LandingAI ADE REST API from any Python 3.9+
|
|
44
43
|
application. The library includes type definitions for all request params and response fields,
|
|
45
44
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
46
45
|
|
|
@@ -65,6 +64,7 @@ The full API of this library can be found in [api.md](https://github.com/landing
|
|
|
65
64
|
|
|
66
65
|
```python
|
|
67
66
|
import os
|
|
67
|
+
from pathlib import Path
|
|
68
68
|
from landingai_ade import LandingAIADE
|
|
69
69
|
|
|
70
70
|
client = LandingAIADE(
|
|
@@ -74,8 +74,8 @@ client = LandingAIADE(
|
|
|
74
74
|
)
|
|
75
75
|
|
|
76
76
|
response = client.parse(
|
|
77
|
-
#
|
|
78
|
-
|
|
77
|
+
# use document= for local files, document_url= for remote URLs
|
|
78
|
+
document=Path("path/to/file"),
|
|
79
79
|
model="dpt-2-latest",
|
|
80
80
|
)
|
|
81
81
|
print(response.chunks)
|
|
@@ -86,13 +86,48 @@ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
|
86
86
|
to add `VISION_AGENT_API_KEY="My Apikey"` to your `.env` file
|
|
87
87
|
so that your Apikey is not stored in source control.
|
|
88
88
|
|
|
89
|
+
### Parse Jobs
|
|
90
|
+
|
|
91
|
+
For processing large documents asynchronously:
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
import os
|
|
95
|
+
from pathlib import Path
|
|
96
|
+
from landingai_ade import LandingAIADE
|
|
97
|
+
|
|
98
|
+
client = LandingAIADE(
|
|
99
|
+
apikey=os.environ.get("VISION_AGENT_API_KEY"),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
# Create an async parse job
|
|
103
|
+
job = client.parse_jobs.create(
|
|
104
|
+
document=Path("path/to/large_file.pdf"),
|
|
105
|
+
model="dpt-2-latest",
|
|
106
|
+
)
|
|
107
|
+
print(f"Job created with ID: {job.job_id}")
|
|
108
|
+
|
|
109
|
+
# Get job status
|
|
110
|
+
job_status = client.parse_jobs.get(job.job_id)
|
|
111
|
+
print(f"Status: {job_status.status}")
|
|
112
|
+
|
|
113
|
+
# List all jobs (with optional filtering)
|
|
114
|
+
response = client.parse_jobs.list(
|
|
115
|
+
status="completed",
|
|
116
|
+
page=0,
|
|
117
|
+
page_size=10,
|
|
118
|
+
)
|
|
119
|
+
for job in response.jobs:
|
|
120
|
+
print(f"Job {job.job_id}: {job.status}")
|
|
121
|
+
```
|
|
122
|
+
|
|
89
123
|
### Extract
|
|
90
124
|
|
|
91
125
|
```python
|
|
126
|
+
import os
|
|
127
|
+
from pathlib import Path
|
|
92
128
|
from landingai_ade import LandingAIADE
|
|
93
129
|
from landingai_ade.lib import pydantic_to_json_schema
|
|
94
130
|
from pydantic import BaseModel, Field
|
|
95
|
-
from pathlib import Path
|
|
96
131
|
|
|
97
132
|
# Define your schema
|
|
98
133
|
class Person(BaseModel):
|
|
@@ -105,7 +140,7 @@ schema = pydantic_to_json_schema(Person)
|
|
|
105
140
|
client = LandingAIADE(apikey=os.environ.get("VISION_AGENT_API_KEY"))
|
|
106
141
|
response = client.extract(
|
|
107
142
|
schema=schema,
|
|
108
|
-
#
|
|
143
|
+
# use markdown= for local files, markdown_url= for remote URLs
|
|
109
144
|
markdown=Path('path/to/file.md')
|
|
110
145
|
)
|
|
111
146
|
```
|
|
@@ -117,6 +152,7 @@ Simply import `AsyncLandingAIADE` instead of `LandingAIADE` and use `await` with
|
|
|
117
152
|
```python
|
|
118
153
|
import os
|
|
119
154
|
import asyncio
|
|
155
|
+
from pathlib import Path
|
|
120
156
|
from landingai_ade import AsyncLandingAIADE
|
|
121
157
|
|
|
122
158
|
client = AsyncLandingAIADE(
|
|
@@ -128,7 +164,7 @@ client = AsyncLandingAIADE(
|
|
|
128
164
|
|
|
129
165
|
async def main() -> None:
|
|
130
166
|
response = await client.parse(
|
|
131
|
-
|
|
167
|
+
document=Path("path/to/file"),
|
|
132
168
|
model="dpt-2-latest",
|
|
133
169
|
)
|
|
134
170
|
print(response.chunks)
|
|
@@ -154,6 +190,7 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
|
|
|
154
190
|
|
|
155
191
|
```python
|
|
156
192
|
import asyncio
|
|
193
|
+
from pathlib import Path
|
|
157
194
|
from landingai_ade import DefaultAioHttpClient
|
|
158
195
|
from landingai_ade import AsyncLandingAIADE
|
|
159
196
|
|
|
@@ -164,7 +201,7 @@ async def main() -> None:
|
|
|
164
201
|
http_client=DefaultAioHttpClient(),
|
|
165
202
|
) as client:
|
|
166
203
|
response = await client.parse(
|
|
167
|
-
|
|
204
|
+
document=Path("path/to/file"),
|
|
168
205
|
model="dpt-2-latest",
|
|
169
206
|
)
|
|
170
207
|
print(response.chunks)
|
|
@@ -263,7 +300,7 @@ client.with_options(max_retries=5).parse()
|
|
|
263
300
|
|
|
264
301
|
### Timeouts
|
|
265
302
|
|
|
266
|
-
By default requests time out after
|
|
303
|
+
By default requests time out after 8 minutes. You can configure this with a `timeout` option,
|
|
267
304
|
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
268
305
|
|
|
269
306
|
```python
|
|
@@ -271,7 +308,7 @@ from landingai_ade import LandingAIADE
|
|
|
271
308
|
|
|
272
309
|
# Configure the default for all requests:
|
|
273
310
|
client = LandingAIADE(
|
|
274
|
-
# 20 seconds (default is
|
|
311
|
+
# 20 seconds (default is 8 minutes)
|
|
275
312
|
timeout=20.0,
|
|
276
313
|
)
|
|
277
314
|
|
|
@@ -450,7 +487,7 @@ print(landingai_ade.__version__)
|
|
|
450
487
|
|
|
451
488
|
## Requirements
|
|
452
489
|
|
|
453
|
-
Python 3.
|
|
490
|
+
Python 3.9 or higher.
|
|
454
491
|
|
|
455
492
|
## Contributing
|
|
456
493
|
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
landingai_ade/__init__.py,sha256=tyK5QngTNcumeBQ-uhvyRts2TtXr0eAR5rofvktz7JA,2760
|
|
2
|
+
landingai_ade/_base_client.py,sha256=vIP54_-Z2Yetpi2x_3RCVmlu7G48VMSe8j18zhXzunQ,67054
|
|
3
|
+
landingai_ade/_client.py,sha256=hf6Pa1_lk-24-cjBYGMye55wqEdXteOnEUT5-rgI1No,32400
|
|
4
|
+
landingai_ade/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
|
|
5
|
+
landingai_ade/_constants.py,sha256=GTZei0iejG5c3XydQEK4LDinwvGVxPC4N-6h-xuhSHU,464
|
|
6
|
+
landingai_ade/_exceptions.py,sha256=bunb9U_h8wb2_IA8tRYVuTx-clbqqDgX8pjmdgX10d8,3232
|
|
7
|
+
landingai_ade/_files.py,sha256=EBeHazTRU_MIhshfTmWef_cGAIHPC3yafBdaCMUoUZ8,3920
|
|
8
|
+
landingai_ade/_models.py,sha256=_jpXNYoIJGzLCqeD4LcmiD4UgZKYMLg4cZ8TcWUn94I,30559
|
|
9
|
+
landingai_ade/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
|
|
10
|
+
landingai_ade/_resource.py,sha256=fZFMI9zYnf0F6ACBB8teJVzhBelkymH2SMQripxfTvI,1136
|
|
11
|
+
landingai_ade/_response.py,sha256=qUH6kfV7CszYHyJKTrJXtJY5b2zPizEM6HyGgsisLtI,28858
|
|
12
|
+
landingai_ade/_streaming.py,sha256=LqRUdE-amT9AyWJvf_vqMH5MTepZmTPYbRm2AwzXigY,10173
|
|
13
|
+
landingai_ade/_types.py,sha256=8of7ETx2GzlS0kq-JMky4iQt-ZtOQeppgwjQMFF85nw,7253
|
|
14
|
+
landingai_ade/_version.py,sha256=TXhzxZEkwNmO4OvmeB091gtg9irsGCUyJypb_Goec0Q,166
|
|
15
|
+
landingai_ade/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
+
landingai_ade/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
17
|
+
landingai_ade/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
18
|
+
landingai_ade/_utils/_datetime_parse.py,sha256=bABTs0Bc6rabdFvnIwXjEhWL15TcRgWZ_6XGTqN8xUk,4204
|
|
19
|
+
landingai_ade/_utils/_logs.py,sha256=Zz26vs3oOIMP3ffOpZz5SHlrbwvWgbCUwyHYraJfMcM,795
|
|
20
|
+
landingai_ade/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
|
|
21
|
+
landingai_ade/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
|
22
|
+
landingai_ade/_utils/_resources_proxy.py,sha256=XHDSpCuvWuVyKDHHrf-OaKgSc4kSp8-Ddbsrm5YxBGU,624
|
|
23
|
+
landingai_ade/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
|
|
24
|
+
landingai_ade/_utils/_sync.py,sha256=HBnZkkBnzxtwOZe0212C4EyoRvxhTVtTrLFDz2_xVCg,1589
|
|
25
|
+
landingai_ade/_utils/_transform.py,sha256=NjCzmnfqYrsAikUHQig6N9QfuTVbKipuP3ur9mcNF-E,15951
|
|
26
|
+
landingai_ade/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
|
|
27
|
+
landingai_ade/_utils/_utils.py,sha256=ugfUaneOK7I8h9b3656flwf5u_kthY0gvNuqvgOLoSU,12252
|
|
28
|
+
landingai_ade/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
29
|
+
landingai_ade/lib/__init__.py,sha256=3a77mMSE61vT4VRcNc5b73fFsbw3vJrrYyAbvQaxUHA,237
|
|
30
|
+
landingai_ade/lib/schema_utils.py,sha256=TdfJbeyRaKuaaNpookuFwqasjxcYBXp0nvp3h9kXPDw,2517
|
|
31
|
+
landingai_ade/lib/url_utils.py,sha256=ydhsvrpcdM4DBoZOIbp83dME9FeKotUDtpzFVU9FZUE,1797
|
|
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
|
|
35
|
+
landingai_ade/types/client_extract_params.py,sha256=efQQ2wiFompakO6LC0fxL6TzuqFsw5FdXInxhTTIUXU,921
|
|
36
|
+
landingai_ade/types/client_parse_params.py,sha256=sTqMewspihj9q4BcgBYGoSJJlDjapsvPYBeoYlUAXp0,1250
|
|
37
|
+
landingai_ade/types/extract_response.py,sha256=gP6hxAnG0Q_sCRlkJVKBXYYzdH9BwWmlTao9RMJgrpI,903
|
|
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=yQHJjD_SUx6oL1ZtrO4wD69zXg6D6Ts7zJAf1GlhkC0,5643
|
|
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=KaMki2pDrnmWWk8FtevHNKoj7R7Lmd9n0awc1JOXNIY,436
|
|
47
|
+
landingai_ade-0.21.1.dist-info/METADATA,sha256=6BJGYDc3Ii0O3ztmVzpMXUTsVd-asaW-ITgxSaAhCzg,16037
|
|
48
|
+
landingai_ade-0.21.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
49
|
+
landingai_ade-0.21.1.dist-info/licenses/LICENSE,sha256=xQsP4c8KA_Ov7OhSD-tj_2U8RQ8z9MQUy-WEjgbJdZU,11343
|
|
50
|
+
landingai_ade-0.21.1.dist-info/RECORD,,
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
landingai_ade/__init__.py,sha256=tyK5QngTNcumeBQ-uhvyRts2TtXr0eAR5rofvktz7JA,2760
|
|
2
|
-
landingai_ade/_base_client.py,sha256=vIP54_-Z2Yetpi2x_3RCVmlu7G48VMSe8j18zhXzunQ,67054
|
|
3
|
-
landingai_ade/_client.py,sha256=5AlJv-zQ-gYg544RH4Of4ZUMAkuxeYyrTbztVTq7Dkg,31592
|
|
4
|
-
landingai_ade/_compat.py,sha256=DQBVORjFb33zch24jzkhM14msvnzY7mmSmgDLaVFUM8,6562
|
|
5
|
-
landingai_ade/_constants.py,sha256=S14PFzyN9-I31wiV7SmIlL5Ga0MLHxdvegInGdXH7tM,462
|
|
6
|
-
landingai_ade/_exceptions.py,sha256=bunb9U_h8wb2_IA8tRYVuTx-clbqqDgX8pjmdgX10d8,3232
|
|
7
|
-
landingai_ade/_files.py,sha256=-o6Spse7PuzyMcxecmdCX8_29_99NyozjfvgGhdPY28,3613
|
|
8
|
-
landingai_ade/_models.py,sha256=lKnskYPONAWDvWo8tmbbVk7HmG7UOsI0Nve0vSMmkRc,30452
|
|
9
|
-
landingai_ade/_qs.py,sha256=craIKyvPktJ94cvf9zn8j8ekG9dWJzhWv0ob34lIOv4,4828
|
|
10
|
-
landingai_ade/_resource.py,sha256=fZFMI9zYnf0F6ACBB8teJVzhBelkymH2SMQripxfTvI,1136
|
|
11
|
-
landingai_ade/_response.py,sha256=qUH6kfV7CszYHyJKTrJXtJY5b2zPizEM6HyGgsisLtI,28858
|
|
12
|
-
landingai_ade/_streaming.py,sha256=V4RaEBKfcNOdOfTAwMzlx_klsTLILvpnS7PvBWC5Exw,10124
|
|
13
|
-
landingai_ade/_types.py,sha256=NLzflzcpP13aYUFLmQMB1XUiX98QV0XwIljPyVDXm8k,7243
|
|
14
|
-
landingai_ade/_version.py,sha256=-KK0PeanmTWByqmS4FTOZ2VzNtxYRz3rJ3c9blxe5uw,166
|
|
15
|
-
landingai_ade/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
|
-
landingai_ade/_utils/__init__.py,sha256=7fch0GT9zpNnErbciSpUNa-SjTxxjY6kxHxKMOM4AGs,2305
|
|
17
|
-
landingai_ade/_utils/_compat.py,sha256=D8gtAvjJQrDWt9upS0XaG9Rr5l1QhiAx_I_1utT_tt0,1195
|
|
18
|
-
landingai_ade/_utils/_datetime_parse.py,sha256=bABTs0Bc6rabdFvnIwXjEhWL15TcRgWZ_6XGTqN8xUk,4204
|
|
19
|
-
landingai_ade/_utils/_logs.py,sha256=Zz26vs3oOIMP3ffOpZz5SHlrbwvWgbCUwyHYraJfMcM,795
|
|
20
|
-
landingai_ade/_utils/_proxy.py,sha256=aglnj2yBTDyGX9Akk2crZHrl10oqRmceUy2Zp008XEs,1975
|
|
21
|
-
landingai_ade/_utils/_reflection.py,sha256=ZmGkIgT_PuwedyNBrrKGbxoWtkpytJNU1uU4QHnmEMU,1364
|
|
22
|
-
landingai_ade/_utils/_resources_proxy.py,sha256=XHDSpCuvWuVyKDHHrf-OaKgSc4kSp8-Ddbsrm5YxBGU,624
|
|
23
|
-
landingai_ade/_utils/_streams.py,sha256=SMC90diFFecpEg_zgDRVbdR3hSEIgVVij4taD-noMLM,289
|
|
24
|
-
landingai_ade/_utils/_sync.py,sha256=TpGLrrhRNWTJtODNE6Fup3_k7zrWm1j2RlirzBwre-0,2862
|
|
25
|
-
landingai_ade/_utils/_transform.py,sha256=NjCzmnfqYrsAikUHQig6N9QfuTVbKipuP3ur9mcNF-E,15951
|
|
26
|
-
landingai_ade/_utils/_typing.py,sha256=N_5PPuFNsaygbtA_npZd98SVN1LQQvFTKL6bkWPBZGU,4786
|
|
27
|
-
landingai_ade/_utils/_utils.py,sha256=0dDqauUbVZEXV0NVl7Bwu904Wwo5eyFCZpQThhFNhyA,12253
|
|
28
|
-
landingai_ade/lib/.keep,sha256=wuNrz-5SXo3jJaJOJgz4vFHM41YH_g20F5cRQo0vLes,224
|
|
29
|
-
landingai_ade/lib/__init__.py,sha256=3a77mMSE61vT4VRcNc5b73fFsbw3vJrrYyAbvQaxUHA,237
|
|
30
|
-
landingai_ade/lib/schema_utils.py,sha256=TdfJbeyRaKuaaNpookuFwqasjxcYBXp0nvp3h9kXPDw,2517
|
|
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
|
|
34
|
-
landingai_ade/types/client_extract_params.py,sha256=Bafii5ZKxhKFed3OqRSId22pYGOEqtE5uNX-CgrfydE,916
|
|
35
|
-
landingai_ade/types/client_parse_params.py,sha256=sTqMewspihj9q4BcgBYGoSJJlDjapsvPYBeoYlUAXp0,1250
|
|
36
|
-
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.14.1.dist-info/METADATA,sha256=fPkTbeMvwZ5SeU1ibn18ebhz0q_xnt4m1vcbAd4UBtc,15288
|
|
39
|
-
landingai_ade-0.14.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
|
40
|
-
landingai_ade-0.14.1.dist-info/licenses/LICENSE,sha256=xQsP4c8KA_Ov7OhSD-tj_2U8RQ8z9MQUy-WEjgbJdZU,11343
|
|
41
|
-
landingai_ade-0.14.1.dist-info/RECORD,,
|