Skip to content

Commit 1ad41f6

Browse files
feat(api): add extract endpoint enums
1 parent 28e36bc commit 1ad41f6

6 files changed

Lines changed: 81 additions & 38 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 2
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-f84d9496fa149b2f58d90ebc2087565f460de0440c3752333ccde20a19989c3f.yml
3-
openapi_spec_hash: bcd7408092ab2ef07966e692f4f638f1
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-542a8c1e91614660bfec8e61b9406f3d30e09e2678db8ea906bf021d71f1ed88.yml
3+
openapi_spec_hash: 8cb4f0857f891f556524d6ed09ed303b
44
config_hash: 1cbb3ff883547f7baa6d75485cd2cad8

src/landingai_ade/_client.py

Lines changed: 17 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def extract(
237237
schema: str,
238238
markdown: Optional[FileTypes] | Omit = omit,
239239
markdown_url: Optional[str] | Omit = omit,
240-
model: Optional[str] | Omit = omit,
240+
model: Optional[Literal["extract-20250630", "extract-20250930"]] | Omit = omit,
241241
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
242242
# The extra values given here take precedence over values defined on the client or passed to this method.
243243
extra_headers: Headers | None = None,
@@ -260,7 +260,7 @@ def extract(
260260
are extracted from the Markdown. The schema must be a valid JSON object and will
261261
be validated before processing the document.
262262
263-
markdown: The Markdown file to extract data from.
263+
markdown: The Markdown file or Markdown content to extract data from.
264264
265265
markdown_url: The URL to the Markdown file to extract data from.
266266
@@ -330,15 +330,13 @@ def parse(
330330
`https://api.va.eu-west-1.landing.ai/v1/ade/parse`.
331331
332332
Args:
333-
document: A file to be parsed. The file can be a PDF (50 pages max) or an image (50MB).
334-
See the list of supported file types here
335-
(https://docs.landing.ai/ade/ade-file-types). Either this parameter or the
336-
document_url parameter must be provided.
333+
document: A file to be parsed. The file can be a PDF or an image. See the list of
334+
supported file types here: https://docs.landing.ai/ade/ade-file-types. Either
335+
this parameter or the `document_url` parameter must be provided.
337336
338-
document_url: The URL to the file to be parsed. The file can be a PDF (50 pages max) or an
339-
image (50MB). See the list of supported file types here
340-
(https://docs.landing.ai/ade/ade-file-types). Either this parameter or the
341-
document parameter must be provided.
337+
document_url: The URL to the file to be parsed. The file can be a PDF or an image. See the
338+
list of supported file types here: https://docs.landing.ai/ade/ade-file-types.
339+
Either this parameter or the `document` parameter must be provided.
342340
343341
model: The version of the model to use for parsing.
344342
@@ -585,7 +583,7 @@ async def extract(
585583
schema: str,
586584
markdown: Optional[FileTypes] | Omit = omit,
587585
markdown_url: Optional[str] | Omit = omit,
588-
model: Optional[str] | Omit = omit,
586+
model: Optional[Literal["extract-20250630", "extract-20250930"]] | Omit = omit,
589587
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
590588
# The extra values given here take precedence over values defined on the client or passed to this method.
591589
extra_headers: Headers | None = None,
@@ -608,7 +606,7 @@ async def extract(
608606
are extracted from the Markdown. The schema must be a valid JSON object and will
609607
be validated before processing the document.
610608
611-
markdown: The Markdown file to extract data from.
609+
markdown: The Markdown file or Markdown content to extract data from.
612610
613611
markdown_url: The URL to the Markdown file to extract data from.
614612
@@ -678,15 +676,13 @@ async def parse(
678676
`https://api.va.eu-west-1.landing.ai/v1/ade/parse`.
679677
680678
Args:
681-
document: A file to be parsed. The file can be a PDF (50 pages max) or an image (50MB).
682-
See the list of supported file types here
683-
(https://docs.landing.ai/ade/ade-file-types). Either this parameter or the
684-
document_url parameter must be provided.
685-
686-
document_url: The URL to the file to be parsed. The file can be a PDF (50 pages max) or an
687-
image (50MB). See the list of supported file types here
688-
(https://docs.landing.ai/ade/ade-file-types). Either this parameter or the
689-
document parameter must be provided.
679+
document: A file to be parsed. The file can be a PDF or an image. See the list of
680+
supported file types here: https://docs.landing.ai/ade/ade-file-types. Either
681+
this parameter or the `document_url` parameter must be provided.
682+
683+
document_url: The URL to the file to be parsed. The file can be a PDF or an image. See the
684+
list of supported file types here: https://docs.landing.ai/ade/ade-file-types.
685+
Either this parameter or the `document` parameter must be provided.
690686
691687
model: The version of the model to use for parsing.
692688

src/landingai_ade/types/client_extract_params.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from __future__ import annotations
44

55
from typing import Optional
6-
from typing_extensions import Required, TypedDict
6+
from typing_extensions import Literal, Required, TypedDict
77

88
from .._types import FileTypes
99

@@ -20,10 +20,10 @@ class ClientExtractParams(TypedDict, total=False):
2020
"""
2121

2222
markdown: Optional[FileTypes]
23-
"""The Markdown file to extract data from."""
23+
"""The Markdown file or Markdown content to extract data from."""
2424

2525
markdown_url: Optional[str]
2626
"""The URL to the Markdown file to extract data from."""
2727

28-
model: Optional[str]
28+
model: Optional[Literal["extract-20250630", "extract-20250930"]]
2929
"""The version of the model to use for extraction."""

src/landingai_ade/types/client_parse_params.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ class ClientParseParams(TypedDict, total=False):
1414
document: Optional[FileTypes]
1515
"""A file to be parsed.
1616
17-
The file can be a PDF (50 pages max) or an image (50MB). See the list of
18-
supported file types here (https://docs.landing.ai/ade/ade-file-types). Either
19-
this parameter or the document_url parameter must be provided.
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.
2020
"""
2121

2222
document_url: Optional[str]
2323
"""The URL to the file to be parsed.
2424
25-
The file can be a PDF (50 pages max) or an image (50MB). See the list of
26-
supported file types here (https://docs.landing.ai/ade/ade-file-types). Either
27-
this parameter or the document parameter must be provided.
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.
2828
"""
2929

3030
model: Optional[str]

src/landingai_ade/types/parse_response.py

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List, Optional
3+
from typing import Dict, List, Optional
4+
from typing_extensions import Literal
45

56
from pydantic import Field as FieldInfo
67

78
from .._models import BaseModel
89

9-
__all__ = ["ParseResponse", "Chunk", "ChunkGrounding", "ChunkGroundingBox", "Metadata", "Split"]
10+
__all__ = [
11+
"ParseResponse",
12+
"Chunk",
13+
"ChunkGrounding",
14+
"ChunkGroundingBox",
15+
"Metadata",
16+
"Split",
17+
"Grounding",
18+
"GroundingBox",
19+
]
1020

1121

1222
class ChunkGroundingBox(BaseModel):
@@ -28,12 +38,12 @@ class ChunkGrounding(BaseModel):
2838
class Chunk(BaseModel):
2939
id: str
3040

41+
grounding: ChunkGrounding
42+
3143
markdown: str
3244

3345
type: str
3446

35-
grounding: Optional[ChunkGrounding] = None
36-
3747

3848
class Metadata(BaseModel):
3949
credit_usage: float
@@ -63,6 +73,41 @@ class Split(BaseModel):
6373
pages: List[int]
6474

6575

76+
class GroundingBox(BaseModel):
77+
bottom: float
78+
79+
left: float
80+
81+
right: float
82+
83+
top: float
84+
85+
86+
class Grounding(BaseModel):
87+
box: GroundingBox
88+
89+
page: int
90+
91+
type: Literal[
92+
"chunkLogo",
93+
"chunkCard",
94+
"chunkAttestation",
95+
"chunkScanCode",
96+
"chunkForm",
97+
"chunkTable",
98+
"chunkFigure",
99+
"chunkText",
100+
"chunkMarginalia",
101+
"chunkTitle",
102+
"chunkPageHeader",
103+
"chunkPageFooter",
104+
"chunkPageNumber",
105+
"chunkKeyValue",
106+
"table",
107+
"tableCell",
108+
]
109+
110+
66111
class ParseResponse(BaseModel):
67112
chunks: List[Chunk]
68113

@@ -71,3 +116,5 @@ class ParseResponse(BaseModel):
71116
metadata: Metadata
72117

73118
splits: List[Split]
119+
120+
grounding: Optional[Dict[str, Grounding]] = None

tests/api_resources/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def test_method_extract_with_all_params(self, client: LandingAIADE) -> None:
3232
schema="schema",
3333
markdown=b"raw file contents",
3434
markdown_url="markdown_url",
35-
model="model",
35+
model="extract-20250630",
3636
)
3737
assert_matches_type(ExtractResponse, client_, path=["response"])
3838

@@ -122,7 +122,7 @@ async def test_method_extract_with_all_params(self, async_client: AsyncLandingAI
122122
schema="schema",
123123
markdown=b"raw file contents",
124124
markdown_url="markdown_url",
125-
model="model",
125+
model="extract-20250630",
126126
)
127127
assert_matches_type(ExtractResponse, client, path=["response"])
128128

0 commit comments

Comments
 (0)