Skip to content

Commit 030592d

Browse files
release: 1.1.0 (#57)
* codegen metadata * fix: ensure streams are always closed * chore(deps): mypy 1.18.1 has a regression, pin to 1.17 * feat(api): manual updates * release: 1.1.0 --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 70f9439 commit 030592d

14 files changed

Lines changed: 383 additions & 27 deletions

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.0.0"
2+
".": "1.1.0"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 5
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-5fd0d575b1a6fa494b29ccaadb9e17d22bbf11b82fc989046a7918bbe724d580.yml
3-
openapi_spec_hash: 27311a7b73611acc010ad87e18f18650
4-
config_hash: caa107af314426538518ba625510805f
1+
configured_endpoints: 6
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-b3f2ee0a1bc9c8c3d6f1bb4a50621c75ee98344774c3237637eef178291d8461.yml
3+
openapi_spec_hash: 24efc4d96b54caebcdf4445d319693ae
4+
config_hash: 43f45ffa1cb556d90dcef6d742ed239f

CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# Changelog
22

3+
## 1.1.0 (2025-12-02)
4+
5+
Full Changelog: [v1.0.0...v1.1.0](https://github.com/landing-ai/ade-python/compare/v1.0.0...v1.1.0)
6+
7+
### Features
8+
9+
* **api:** manual updates ([a2c622d](https://github.com/landing-ai/ade-python/commit/a2c622db797caf02fc38e8e10ec841793b545032))
10+
11+
12+
### Bug Fixes
13+
14+
* ensure streams are always closed ([c903098](https://github.com/landing-ai/ade-python/commit/c90309862771f208c24df5bb7a570769821d1a7a))
15+
16+
17+
### Chores
18+
19+
* **deps:** mypy 1.18.1 has a regression, pin to 1.17 ([a768a1c](https://github.com/landing-ai/ade-python/commit/a768a1c1cf8953a48c25712e293f49bee98494dc))
20+
321
## 1.0.0 (2025-11-22)
422

523
Full Changelog: [v0.21.2...v1.0.0](https://github.com/landing-ai/ade-python/compare/v0.21.2...v1.0.0)

api.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,14 @@ from landingai_ade.types import ParseGroundingBox, ParseMetadata
99
Types:
1010

1111
```python
12-
from landingai_ade.types import ExtractResponse, ParseResponse
12+
from landingai_ade.types import ExtractResponse, ParseResponse, SplitResponse
1313
```
1414

1515
Methods:
1616

1717
- <code title="post /v1/ade/extract">client.<a href="./src/landingai_ade/_client.py">extract</a>(\*\*<a href="src/landingai_ade/types/client_extract_params.py">params</a>) -> <a href="./src/landingai_ade/types/extract_response.py">ExtractResponse</a></code>
1818
- <code title="post /v1/ade/parse">client.<a href="./src/landingai_ade/_client.py">parse</a>(\*\*<a href="src/landingai_ade/types/client_parse_params.py">params</a>) -> <a href="./src/landingai_ade/types/parse_response.py">ParseResponse</a></code>
19+
- <code title="post /v1/ade/split">client.<a href="./src/landingai_ade/_client.py">split</a>(\*\*<a href="src/landingai_ade/types/client_split_params.py">params</a>) -> <a href="./src/landingai_ade/types/split_response.py">SplitResponse</a></code>
1920

2021
# ParseJobs
2122

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "landingai-ade"
3-
version = "1.0.0"
3+
version = "1.1.0"
44
description = "The official Python library for the landingai-ade API"
55
dynamic = ["readme"]
66
license = "Apache-2.0"
@@ -46,7 +46,7 @@ managed = true
4646
# version pins are in requirements-dev.lock
4747
dev-dependencies = [
4848
"pyright==1.1.399",
49-
"mypy",
49+
"mypy==1.17",
5050
"respx",
5151
"pytest",
5252
"pytest-asyncio",

requirements-dev.lock

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ mdurl==0.1.2
7272
multidict==6.4.4
7373
# via aiohttp
7474
# via yarl
75-
mypy==1.14.1
75+
mypy==1.17.0
7676
mypy-extensions==1.0.0
7777
# via mypy
7878
nodeenv==1.8.0
@@ -81,6 +81,8 @@ nox==2023.4.22
8181
packaging==23.2
8282
# via nox
8383
# via pytest
84+
pathspec==0.12.1
85+
# via mypy
8486
platformdirs==3.11.0
8587
# via virtualenv
8688
pluggy==1.5.0

requirements.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,21 @@ multidict==6.4.4
5555
propcache==0.3.1
5656
# via aiohttp
5757
# via yarl
58-
pydantic==2.11.9
58+
pydantic==2.12.5
5959
# via landingai-ade
60-
pydantic-core==2.33.2
60+
pydantic-core==2.41.5
6161
# via pydantic
6262
sniffio==1.3.0
6363
# via anyio
6464
# via landingai-ade
65-
typing-extensions==4.12.2
65+
typing-extensions==4.15.0
6666
# via anyio
6767
# via landingai-ade
6868
# via multidict
6969
# via pydantic
7070
# via pydantic-core
7171
# via typing-inspection
72-
typing-inspection==0.4.1
72+
typing-inspection==0.4.2
7373
# via pydantic
7474
yarl==1.20.0
7575
# via aiohttp

src/landingai_ade/_client.py

Lines changed: 145 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44

55
import os
66
import importlib.metadata
7-
from typing import Any, Dict, Mapping, Optional, cast
7+
from typing import Any, Dict, Mapping, Iterable, Optional, cast
88
from typing_extensions import Self, Literal, override
99

1010
import httpx
1111

1212
from . import _exceptions
1313
from ._qs import Querystring
14-
from .types import client_parse_params, client_extract_params
14+
from .types import client_parse_params, client_split_params, client_extract_params
1515
from ._types import (
1616
Body,
1717
Omit,
@@ -52,6 +52,7 @@
5252
)
5353
from .lib.url_utils import convert_url_to_file_if_local
5454
from .types.parse_response import ParseResponse
55+
from .types.split_response import SplitResponse
5556
from .types.extract_response import ExtractResponse
5657

5758
_LIB_VERSION = importlib.metadata.version("landingai-ade")
@@ -391,6 +392,71 @@ def parse(
391392
cast_to=ParseResponse,
392393
)
393394

395+
def split(
396+
self,
397+
*,
398+
options: Iterable[client_split_params.Option],
399+
markdown: Optional[FileTypes] | Omit = omit,
400+
markdown_url: Optional[str] | Omit = omit,
401+
model: Optional[str] | Omit = omit,
402+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
403+
# The extra values given here take precedence over values defined on the client or passed to this method.
404+
extra_headers: Headers | None = None,
405+
extra_query: Query | None = None,
406+
extra_body: Body | None = None,
407+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
408+
) -> SplitResponse:
409+
"""
410+
Split classification for documents.
411+
412+
This endpoint classifies document sections based on markdown content and split
413+
options.
414+
415+
For EU users, use this endpoint:
416+
417+
`https://api.va.eu-west-1.landing.ai/v1/ade/split`.
418+
419+
Args:
420+
options: List of split classification options/configuration. Can be provided as JSON
421+
string in form data.
422+
423+
markdown: The Markdown file or Markdown content to split.
424+
425+
markdown_url: The URL to the Markdown file to split.
426+
427+
model: Model version to use for split classification. Defaults to the latest version.
428+
429+
extra_headers: Send extra headers
430+
431+
extra_query: Add additional query parameters to the request
432+
433+
extra_body: Add additional JSON properties to the request
434+
435+
timeout: Override the client-level default timeout for this request, in seconds
436+
"""
437+
body = deepcopy_minimal(
438+
{
439+
"options": options,
440+
"markdown": markdown,
441+
"markdown_url": markdown_url,
442+
"model": model,
443+
}
444+
)
445+
files = extract_files(cast(Mapping[str, object], body), paths=[["markdown"]])
446+
# It should be noted that the actual Content-Type header that will be
447+
# sent to the server will contain a `boundary` parameter, e.g.
448+
# multipart/form-data; boundary=---abc--
449+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
450+
return self.post(
451+
"/v1/ade/split",
452+
body=maybe_transform(body, client_split_params.ClientSplitParams),
453+
files=files,
454+
options=make_request_options(
455+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
456+
),
457+
cast_to=SplitResponse,
458+
)
459+
394460
@override
395461
def _make_status_error(
396462
self,
@@ -742,6 +808,71 @@ async def parse(
742808
cast_to=ParseResponse,
743809
)
744810

811+
async def split(
812+
self,
813+
*,
814+
options: Iterable[client_split_params.Option],
815+
markdown: Optional[FileTypes] | Omit = omit,
816+
markdown_url: Optional[str] | Omit = omit,
817+
model: Optional[str] | Omit = omit,
818+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
819+
# The extra values given here take precedence over values defined on the client or passed to this method.
820+
extra_headers: Headers | None = None,
821+
extra_query: Query | None = None,
822+
extra_body: Body | None = None,
823+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
824+
) -> SplitResponse:
825+
"""
826+
Split classification for documents.
827+
828+
This endpoint classifies document sections based on markdown content and split
829+
options.
830+
831+
For EU users, use this endpoint:
832+
833+
`https://api.va.eu-west-1.landing.ai/v1/ade/split`.
834+
835+
Args:
836+
options: List of split classification options/configuration. Can be provided as JSON
837+
string in form data.
838+
839+
markdown: The Markdown file or Markdown content to split.
840+
841+
markdown_url: The URL to the Markdown file to split.
842+
843+
model: Model version to use for split classification. Defaults to the latest version.
844+
845+
extra_headers: Send extra headers
846+
847+
extra_query: Add additional query parameters to the request
848+
849+
extra_body: Add additional JSON properties to the request
850+
851+
timeout: Override the client-level default timeout for this request, in seconds
852+
"""
853+
body = deepcopy_minimal(
854+
{
855+
"options": options,
856+
"markdown": markdown,
857+
"markdown_url": markdown_url,
858+
"model": model,
859+
}
860+
)
861+
files = extract_files(cast(Mapping[str, object], body), paths=[["markdown"]])
862+
# It should be noted that the actual Content-Type header that will be
863+
# sent to the server will contain a `boundary` parameter, e.g.
864+
# multipart/form-data; boundary=---abc--
865+
extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})}
866+
return await self.post(
867+
"/v1/ade/split",
868+
body=await async_maybe_transform(body, client_split_params.ClientSplitParams),
869+
files=files,
870+
options=make_request_options(
871+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
872+
),
873+
cast_to=SplitResponse,
874+
)
875+
745876
@override
746877
def _make_status_error(
747878
self,
@@ -786,6 +917,9 @@ def __init__(self, client: LandingAIADE) -> None:
786917
self.parse = to_raw_response_wrapper(
787918
client.parse,
788919
)
920+
self.split = to_raw_response_wrapper(
921+
client.split,
922+
)
789923

790924

791925
class AsyncLandingAIADEWithRawResponse:
@@ -798,6 +932,9 @@ def __init__(self, client: AsyncLandingAIADE) -> None:
798932
self.parse = async_to_raw_response_wrapper(
799933
client.parse,
800934
)
935+
self.split = async_to_raw_response_wrapper(
936+
client.split,
937+
)
801938

802939

803940
class LandingAIADEWithStreamedResponse:
@@ -810,6 +947,9 @@ def __init__(self, client: LandingAIADE) -> None:
810947
self.parse = to_streamed_response_wrapper(
811948
client.parse,
812949
)
950+
self.split = to_streamed_response_wrapper(
951+
client.split,
952+
)
813953

814954

815955
class AsyncLandingAIADEWithStreamedResponse:
@@ -822,6 +962,9 @@ def __init__(self, client: AsyncLandingAIADE) -> None:
822962
self.parse = async_to_streamed_response_wrapper(
823963
client.parse,
824964
)
965+
self.split = async_to_streamed_response_wrapper(
966+
client.split,
967+
)
825968

826969

827970
Client = LandingAIADE

src/landingai_ade/_streaming.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ def __stream__(self) -> Iterator[_T]:
5454
process_data = self._client._process_response_data
5555
iterator = self._iter_events()
5656

57-
for sse in iterator:
58-
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
59-
60-
# As we might not fully consume the response stream, we need to close it explicitly
61-
response.close()
57+
try:
58+
for sse in iterator:
59+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
60+
finally:
61+
# Ensure the response is closed even if the consumer doesn't read all data
62+
response.close()
6263

6364
def __enter__(self) -> Self:
6465
return self
@@ -117,11 +118,12 @@ async def __stream__(self) -> AsyncIterator[_T]:
117118
process_data = self._client._process_response_data
118119
iterator = self._iter_events()
119120

120-
async for sse in iterator:
121-
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
122-
123-
# As we might not fully consume the response stream, we need to close it explicitly
124-
await response.aclose()
121+
try:
122+
async for sse in iterator:
123+
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
124+
finally:
125+
# Ensure the response is closed even if the consumer doesn't read all data
126+
await response.aclose()
125127

126128
async def __aenter__(self) -> Self:
127129
return self

src/landingai_ade/_version.py

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

33
__title__ = "landingai_ade"
4-
__version__ = "1.0.0" # x-release-please-version
4+
__version__ = "1.1.0" # x-release-please-version

0 commit comments

Comments
 (0)