Skip to content

Commit a48db63

Browse files
feat(api): manual updates
1 parent e8909b4 commit a48db63

61 files changed

Lines changed: 391 additions & 351 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,4 @@ jobs:
2828
run: |
2929
bash ./bin/publish-pypi
3030
env:
31-
PYPI_TOKEN: ${{ secrets.LANDINGAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
31+
PYPI_TOKEN: ${{ secrets.LANDINGAI_ADE_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ jobs:
1818
run: |
1919
bash ./bin/check-release-environment
2020
env:
21-
PYPI_TOKEN: ${{ secrets.LANDINGAI_PYPI_TOKEN || secrets.PYPI_TOKEN }}
21+
PYPI_TOKEN: ${{ secrets.LANDINGAI_ADE_PYPI_TOKEN || secrets.PYPI_TOKEN }}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 2
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/landingai%2Fade-f08049b74d593128128837d1e62b642bf68ee132184fddadc45d19fbc6d9f263.yml
33
openapi_spec_hash: 1cf6912d5249120cb222db3890587aab
4-
config_hash: 281dccbc22a7077488c2f8600daa3b7d
4+
config_hash: b5cab0bc5fca3bf0bcf2cd89cfe1b134

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ $ pip install -r requirements-dev.lock
3636

3737
Most of the SDK is generated code. Modifications to code will be persisted between generations, but may
3838
result in merge conflicts between manual patches and changes from the generator. The generator will never
39-
modify the contents of the `src/LandingAIAde/lib/` and `examples/` directories.
39+
modify the contents of the `src/landingai_ade/lib/` and `examples/` directories.
4040

4141
## Adding and running examples
4242

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright 2025 Landingai
189+
Copyright 2025 LandingAI ADE
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

README.md

Lines changed: 68 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
# Landingai Python API library
1+
# LandingAI ADE Python API library
22

33
<!-- prettier-ignore -->
44
[![PyPI version](https://img.shields.io/pypi/v/landingai-ade.svg?label=pypi%20(stable))](https://pypi.org/project/landingai-ade/)
55

6-
The Landingai Python library provides convenient access to the Landingai REST API from any Python 3.8+
6+
The LandingAI ADE Python library provides convenient access to the LandingAI ADE REST API from any Python 3.8+
77
application. The library includes type definitions for all request params and response fields,
88
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
99

@@ -26,41 +26,45 @@ The full API of this library can be found in [api.md](api.md).
2626

2727
```python
2828
import os
29-
from LandingAIAde import Landingai
29+
from landingai_ade import LandingAIADE
3030

31-
client = Landingai(
32-
apikey=os.environ.get("ADE_API_KEY"), # This is the default and can be omitted
31+
client = LandingAIADE(
32+
apikey=os.environ.get("VISION_AGENT_API_KEY"), # This is the default and can be omitted
3333
# defaults to "production".
3434
environment="eu",
3535
)
3636

37-
response = client.parse()
37+
response = client.parse(
38+
document_url="https://va.landing.ai/pdfs/LabReport.pdf",
39+
)
3840
print(response.chunks)
3941
```
4042

4143
While you can provide a `apikey` keyword argument,
4244
we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
43-
to add `ADE_API_KEY="My Apikey"` to your `.env` file
45+
to add `VISION_AGENT_API_KEY="My Apikey"` to your `.env` file
4446
so that your Apikey is not stored in source control.
4547

4648
## Async usage
4749

48-
Simply import `AsyncLandingai` instead of `Landingai` and use `await` with each API call:
50+
Simply import `AsyncLandingAIADE` instead of `LandingAIADE` and use `await` with each API call:
4951

5052
```python
5153
import os
5254
import asyncio
53-
from LandingAIAde import AsyncLandingai
55+
from landingai_ade import AsyncLandingAIADE
5456

55-
client = AsyncLandingai(
56-
apikey=os.environ.get("ADE_API_KEY"), # This is the default and can be omitted
57+
client = AsyncLandingAIADE(
58+
apikey=os.environ.get("VISION_AGENT_API_KEY"), # This is the default and can be omitted
5759
# defaults to "production".
5860
environment="eu",
5961
)
6062

6163

6264
async def main() -> None:
63-
response = await client.parse()
65+
response = await client.parse(
66+
document_url="https://va.landing.ai/pdfs/LabReport.pdf",
67+
)
6468
print(response.chunks)
6569

6670

@@ -84,16 +88,18 @@ Then you can enable it by instantiating the client with `http_client=DefaultAioH
8488

8589
```python
8690
import asyncio
87-
from LandingAIAde import DefaultAioHttpClient
88-
from LandingAIAde import AsyncLandingai
91+
from landingai_ade import DefaultAioHttpClient
92+
from landingai_ade import AsyncLandingAIADE
8993

9094

9195
async def main() -> None:
92-
async with AsyncLandingai(
96+
async with AsyncLandingAIADE(
9397
apikey="My Apikey",
9498
http_client=DefaultAioHttpClient(),
9599
) as client:
96-
response = await client.parse()
100+
response = await client.parse(
101+
document_url="https://va.landing.ai/pdfs/LabReport.pdf",
102+
)
97103
print(response.chunks)
98104

99105

@@ -115,9 +121,9 @@ Request parameters that correspond to file uploads can be passed as `bytes`, or
115121

116122
```python
117123
from pathlib import Path
118-
from LandingAIAde import Landingai
124+
from landingai_ade import LandingAIADE
119125

120-
client = Landingai()
126+
client = LandingAIADE()
121127

122128
client.parse(
123129
document=Path("/path/to/file"),
@@ -128,27 +134,29 @@ The async client uses the exact same interface. If you pass a [`PathLike`](https
128134

129135
## Handling errors
130136

131-
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `LandingAIAde.APIConnectionError` is raised.
137+
When the library is unable to connect to the API (for example, due to network connection problems or a timeout), a subclass of `landingai_ade.APIConnectionError` is raised.
132138

133139
When the API returns a non-success status code (that is, 4xx or 5xx
134-
response), a subclass of `LandingAIAde.APIStatusError` is raised, containing `status_code` and `response` properties.
140+
response), a subclass of `landingai_ade.APIStatusError` is raised, containing `status_code` and `response` properties.
135141

136-
All errors inherit from `LandingAIAde.APIError`.
142+
All errors inherit from `landingai_ade.APIError`.
137143

138144
```python
139-
import LandingAIAde
140-
from LandingAIAde import Landingai
145+
import landingai_ade
146+
from landingai_ade import LandingAIADE
141147

142-
client = Landingai()
148+
client = LandingAIADE()
143149

144150
try:
145-
client.parse()
146-
except LandingAIAde.APIConnectionError as e:
151+
client.extract(
152+
schema="schema",
153+
)
154+
except landingai_ade.APIConnectionError as e:
147155
print("The server could not be reached")
148156
print(e.__cause__) # an underlying Exception, likely raised within httpx.
149-
except LandingAIAde.RateLimitError as e:
157+
except landingai_ade.RateLimitError as e:
150158
print("A 429 status code was received; we should back off a bit.")
151-
except LandingAIAde.APIStatusError as e:
159+
except landingai_ade.APIStatusError as e:
152160
print("Another non-200-range status code was received")
153161
print(e.status_code)
154162
print(e.response)
@@ -176,16 +184,18 @@ Connection errors (for example, due to a network connectivity problem), 408 Requ
176184
You can use the `max_retries` option to configure or disable retry settings:
177185

178186
```python
179-
from LandingAIAde import Landingai
187+
from landingai_ade import LandingAIADE
180188

181189
# Configure the default for all requests:
182-
client = Landingai(
190+
client = LandingAIADE(
183191
# default is 2
184192
max_retries=0,
185193
)
186194

187195
# Or, configure per-request:
188-
client.with_options(max_retries=5).parse()
196+
client.with_options(max_retries=5).extract(
197+
schema="schema",
198+
)
189199
```
190200

191201
### Timeouts
@@ -194,21 +204,23 @@ By default requests time out after 1 minute. You can configure this with a `time
194204
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
195205

196206
```python
197-
from LandingAIAde import Landingai
207+
from landingai_ade import LandingAIADE
198208

199209
# Configure the default for all requests:
200-
client = Landingai(
210+
client = LandingAIADE(
201211
# 20 seconds (default is 1 minute)
202212
timeout=20.0,
203213
)
204214

205215
# More granular control:
206-
client = Landingai(
216+
client = LandingAIADE(
207217
timeout=httpx.Timeout(60.0, read=5.0, write=10.0, connect=2.0),
208218
)
209219

210220
# Override per-request:
211-
client.with_options(timeout=5.0).parse()
221+
client.with_options(timeout=5.0).extract(
222+
schema="schema",
223+
)
212224
```
213225

214226
On timeout, an `APITimeoutError` is thrown.
@@ -221,10 +233,10 @@ Note that requests that time out are [retried twice by default](#retries).
221233

222234
We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module.
223235

224-
You can enable logging by setting the environment variable `LANDINGAI_LOG` to `info`.
236+
You can enable logging by setting the environment variable `LANDINGAI_ADE_LOG` to `info`.
225237

226238
```shell
227-
$ export LANDINGAI_LOG=info
239+
$ export LANDINGAI_ADE_LOG=info
228240
```
229241

230242
Or to `debug` for more verbose logging.
@@ -246,19 +258,21 @@ if response.my_field is None:
246258
The "raw" Response object can be accessed by prefixing `.with_raw_response.` to any HTTP method call, e.g.,
247259

248260
```py
249-
from LandingAIAde import Landingai
261+
from landingai_ade import LandingAIADE
250262

251-
client = Landingai()
252-
response = client.with_raw_response.parse()
263+
client = LandingAIADE()
264+
response = client.with_raw_response.extract(
265+
schema="schema",
266+
)
253267
print(response.headers.get('X-My-Header'))
254268

255-
client = response.parse() # get the object that `parse()` would have returned
256-
print(client.chunks)
269+
client = response.parse() # get the object that `extract()` would have returned
270+
print(client.extraction)
257271
```
258272

259-
These methods return an [`APIResponse`](https://github.com/landing-ai/ade-python/tree/main/src/LandingAIAde/_response.py) object.
273+
These methods return an [`APIResponse`](https://github.com/landing-ai/ade-python/tree/main/src/landingai_ade/_response.py) object.
260274

261-
The async client returns an [`AsyncAPIResponse`](https://github.com/landing-ai/ade-python/tree/main/src/LandingAIAde/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
275+
The async client returns an [`AsyncAPIResponse`](https://github.com/landing-ai/ade-python/tree/main/src/landingai_ade/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
262276

263277
#### `.with_streaming_response`
264278

@@ -267,7 +281,9 @@ The above interface eagerly reads the full response body when you make the reque
267281
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
268282

269283
```python
270-
with client.with_streaming_response.parse() as response:
284+
with client.with_streaming_response.extract(
285+
schema="schema",
286+
) as response:
271287
print(response.headers.get("X-My-Header"))
272288

273289
for line in response.iter_lines():
@@ -320,10 +336,10 @@ You can directly override the [httpx client](https://www.python-httpx.org/api/#c
320336

321337
```python
322338
import httpx
323-
from LandingAIAde import Landingai, DefaultHttpxClient
339+
from landingai_ade import LandingAIADE, DefaultHttpxClient
324340

325-
client = Landingai(
326-
# Or use the `LANDINGAI_BASE_URL` env var
341+
client = LandingAIADE(
342+
# Or use the `LANDINGAI_ADE_BASE_URL` env var
327343
base_url="http://my.test.server.example.com:8083",
328344
http_client=DefaultHttpxClient(
329345
proxy="http://my.test.proxy.example.com",
@@ -343,9 +359,9 @@ client.with_options(http_client=DefaultHttpxClient(...))
343359
By default the library closes underlying HTTP connections whenever the client is [garbage collected](https://docs.python.org/3/reference/datamodel.html#object.__del__). You can manually close the client using the `.close()` method if desired, or with a context manager that closes when exiting.
344360

345361
```py
346-
from LandingAIAde import Landingai
362+
from landingai_ade import LandingAIADE
347363

348-
with Landingai() as client:
364+
with LandingAIADE() as client:
349365
# make requests here
350366
...
351367

@@ -371,8 +387,8 @@ If you've upgraded to the latest version but aren't seeing any new features you
371387
You can determine the version that is being used at runtime with:
372388

373389
```py
374-
import LandingAIAde
375-
print(LandingAIAde.__version__)
390+
import landingai_ade
391+
print(landingai_ade.__version__)
376392
```
377393

378394
## Requirements

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ before making any information public.
1616
## Reporting Non-SDK Related Security Issues
1717

1818
If you encounter security issues that are not directly related to SDKs but pertain to the services
19-
or products provided by Landingai, please follow the respective company's security reporting guidelines.
19+
or products provided by LandingAI ADE, please follow the respective company's security reporting guidelines.
2020

2121
---
2222

api.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# Landingai
1+
# LandingAIADE
22

33
Types:
44

55
```python
6-
from LandingAIAde.types import ExtractResponse, ParseResponse
6+
from landingai_ade.types import ExtractResponse, ParseResponse
77
```
88

99
Methods:
1010

11-
- <code title="post /v1/ade/extract">client.<a href="./src/LandingAIAde/_client.py">extract</a>(\*\*<a href="src/LandingAIAde/types/client_extract_params.py">params</a>) -> <a href="./src/LandingAIAde/types/extract_response.py">ExtractResponse</a></code>
12-
- <code title="post /v1/ade/parse">client.<a href="./src/LandingAIAde/_client.py">parse</a>(\*\*<a href="src/LandingAIAde/types/client_parse_params.py">params</a>) -> <a href="./src/LandingAIAde/types/parse_response.py">ParseResponse</a></code>
11+
- <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>
12+
- <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>

0 commit comments

Comments
 (0)