You need to sign in or sign up before continuing.
visionai-sdk-python 2.1.0__tar.gz → 2.2.0__tar.gz
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.
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/.github/workflows/ci.yml +2 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/.gitignore +2 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/PKG-INFO +76 -9
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/README.md +73 -8
- visionai_sdk_python-2.2.0/docs/relay-protocol.md +284 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/pyproject.toml +5 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/__init__.py +6 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/_base.py +91 -50
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/async_client.py +156 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/auth/__init__.py +15 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/auth/_mixin.py +1 -1
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/auth/async_resource.py +35 -17
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/auth/credentials.py +347 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/auth/models.py +1 -1
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/auth/resource.py +37 -17
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/client.py +154 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/constants.py +36 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/exceptions.py +97 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/instrumentation.py +12 -4
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/__init__.py +72 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/__init__.py +28 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/error_connection.json +3 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/error_request.json +4 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/heartbeat.json +1 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/register.json +8 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/registered.json +4 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/request.json +17 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/response.json +9 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/examples/response_text.json +5 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python/relay/protocol.py +210 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/vlm/async_resource.py +12 -18
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/vlm/resource.py +12 -18
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python.egg-info/PKG-INFO +76 -9
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python.egg-info/SOURCES.txt +19 -1
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python.egg-info/requires.txt +3 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python.egg-info/scm_file_list.json +18 -0
- visionai_sdk_python-2.2.0/src/visionai_sdk_python.egg-info/scm_version.json +8 -0
- visionai_sdk_python-2.2.0/tests/relay/__init__.py +0 -0
- visionai_sdk_python-2.2.0/tests/relay/test_protocol.py +211 -0
- visionai_sdk_python-2.2.0/tests/test__base.py +198 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/tests/test_async_client.py +4 -5
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/tests/test_client.py +4 -5
- visionai_sdk_python-2.2.0/tests/test_credentials.py +484 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/tests/test_instrumentation.py +25 -16
- visionai_sdk_python-2.2.0/tests/test_request.py +307 -0
- visionai_sdk_python-2.2.0/tests/test_transport_options.py +57 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/uv.lock +548 -354
- visionai_sdk_python-2.1.0/src/visionai_sdk_python/async_client.py +0 -103
- visionai_sdk_python-2.1.0/src/visionai_sdk_python/auth/__init__.py +0 -7
- visionai_sdk_python-2.1.0/src/visionai_sdk_python/client.py +0 -103
- visionai_sdk_python-2.1.0/src/visionai_sdk_python/constants.py +0 -49
- visionai_sdk_python-2.1.0/src/visionai_sdk_python/exceptions.py +0 -40
- visionai_sdk_python-2.1.0/src/visionai_sdk_python.egg-info/scm_version.json +0 -8
- visionai_sdk_python-2.1.0/tests/test__base.py +0 -102
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/.github/dependabot.yml +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/.github/workflows/publish.yml +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/setup.cfg +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/_jwt_verifier.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/_request_attribution.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/_source_header.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/endpoints.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/py.typed +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/vlm/__init__.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/vlm/_mixin.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/vlm/models.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python/vlm/preprocess.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python.egg-info/dependency_links.txt +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/src/visionai_sdk_python.egg-info/top_level.txt +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/tests/__init__.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/tests/constants.py +0 -0
- {visionai_sdk_python-2.1.0 → visionai_sdk_python-2.2.0}/tests/test_vlm_preprocess.py +0 -0
|
@@ -72,6 +72,7 @@ jobs:
|
|
|
72
72
|
run: >-
|
|
73
73
|
uv pip install
|
|
74
74
|
"httpx==0.28.1"
|
|
75
|
+
"httpx2==2.13.*"
|
|
75
76
|
"requests==2.31.*"
|
|
76
77
|
"aiohttp==3.9.*"
|
|
77
78
|
"wrapt==1.16.*"
|
|
@@ -81,6 +82,7 @@ jobs:
|
|
|
81
82
|
run: >-
|
|
82
83
|
uv pip install --upgrade
|
|
83
84
|
"httpx>=0.28.1"
|
|
85
|
+
"httpx2>=2.13,<3"
|
|
84
86
|
"requests>=2.31,<3"
|
|
85
87
|
"aiohttp>=3.9,<4"
|
|
86
88
|
"wrapt>=1.16,<3"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: visionai-sdk-python
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: VisionAI SDK for Python
|
|
5
5
|
Author-email: Tony Yang <tonyyang@linkervision.com>
|
|
6
6
|
Requires-Python: >=3.11
|
|
@@ -13,6 +13,8 @@ Provides-Extra: requests
|
|
|
13
13
|
Requires-Dist: requests<3,>=2.31; extra == "requests"
|
|
14
14
|
Provides-Extra: aiohttp
|
|
15
15
|
Requires-Dist: aiohttp<4,>=3.9; extra == "aiohttp"
|
|
16
|
+
Provides-Extra: httpx2
|
|
17
|
+
Requires-Dist: httpx2<3,>=2.13; extra == "httpx2"
|
|
16
18
|
Provides-Extra: instrumentation
|
|
17
19
|
Requires-Dist: wrapt<3,>=1.16; extra == "instrumentation"
|
|
18
20
|
|
|
@@ -43,6 +45,7 @@ Attributing direct `requests`/`aiohttp` calls, or using `instrumentation.instrum
|
|
|
43
45
|
```bash
|
|
44
46
|
pip install visionai-sdk-python[requests]
|
|
45
47
|
pip install visionai-sdk-python[aiohttp]
|
|
48
|
+
pip install visionai-sdk-python[httpx2]
|
|
46
49
|
pip install visionai-sdk-python[instrumentation] # needed for instrument() itself
|
|
47
50
|
```
|
|
48
51
|
|
|
@@ -134,15 +137,56 @@ token = client.auth.login("user@example.com", "password")
|
|
|
134
137
|
|
|
135
138
|
### OAuth Client Credentials
|
|
136
139
|
|
|
140
|
+
A `ClientCredentials` (or `AsyncClientCredentials`) holds the token for one Platform
|
|
141
|
+
client: it is minted on first use, cached until shortly before it expires, and one
|
|
142
|
+
instance can serve any number of clients and your own requests.
|
|
143
|
+
|
|
137
144
|
```python
|
|
138
|
-
|
|
139
|
-
token = client.auth.get_access_token(
|
|
140
|
-
client_id="your-client-id",
|
|
141
|
-
client_secret="your-client-secret"
|
|
142
|
-
)
|
|
143
|
-
```
|
|
145
|
+
from visionai_sdk_python import Client, ClientCredentials
|
|
144
146
|
|
|
145
|
-
|
|
147
|
+
cred = ClientCredentials(
|
|
148
|
+
auth_url="...", client_id="your-client-id", client_secret="your-client-secret"
|
|
149
|
+
)
|
|
150
|
+
client = Client(auth_url="...", vlm_url="...", credential=cred) # vlm.chat() uses it
|
|
151
|
+
|
|
152
|
+
token = cred.get_token().token # for a WebSocket upgrade or another library
|
|
153
|
+
|
|
154
|
+
# Any other HTTP call with the same token, sent to the host you name; a 401 gets one
|
|
155
|
+
# fresh token and one retry
|
|
156
|
+
nodes = client.request("GET", "https://vs.example.com/mgmt/nodes").json()
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
`request()` raises on a non-2xx like the resource methods (`AuthenticationError`,
|
|
160
|
+
`ClientError`, `ServerError`, ...), unlike plain httpx, and sends the token to whatever
|
|
161
|
+
host `url` names, so `url` comes from configuration or code, never from a caller. A
|
|
162
|
+
client built with `http_client=` (or a credential with `http=`) uses that client's TLS,
|
|
163
|
+
timeout and limits; passing `verify_ssl` / `timeout` / `max_connections` /
|
|
164
|
+
`max_keepalive_connections` with it raises `ValueError`.
|
|
165
|
+
|
|
166
|
+
A mint is a Platform round trip and, on sites that cap client tokens, a scarce one:
|
|
167
|
+
concurrent callers share one mint, a refresh that fails keeps the current token while
|
|
168
|
+
Platform still accepts it, a 401 on a token minted more than 30 minutes ago buys a
|
|
169
|
+
replacement (`cred.invalidate(token)`; a younger one is kept, so a persistent 401
|
|
170
|
+
mints at most twice an hour), and after a 429 no mint is tried for an hour
|
|
171
|
+
(`RateLimitedError`). `get_token(force_refresh=True)` mints on demand.
|
|
172
|
+
|
|
173
|
+
`client.auth.get_access_token(client_id, client_secret)` still works and now builds a
|
|
174
|
+
`ClientCredentials` underneath; it returns the cached token unless `force_refresh=True`.
|
|
175
|
+
A later `login()` or `set_token()` replaces the credential: the last explicit
|
|
176
|
+
authentication wins. `vlm_url` is optional for clients that only authenticate.
|
|
177
|
+
|
|
178
|
+
## Relay protocol (internal)
|
|
179
|
+
|
|
180
|
+
`visionai_sdk_python.relay` holds the wire format between platform-relay and
|
|
181
|
+
platform-edge-agent: the frame models, the constants and `parse_agent_frame()` /
|
|
182
|
+
`parse_relay_frame()` (text frames only: `bytes` or `None` is an `InvalidFrame`) /
|
|
183
|
+
`dump_frame()` (which refuses a frame over `MAX_FRAME_BYTES`). The spec is
|
|
184
|
+
[`docs/relay-protocol.md`](docs/relay-protocol.md); both sides import this module instead of
|
|
185
|
+
keeping a copy, and a protocol change edits the spec and the module in one PR. The spec's
|
|
186
|
+
JSON examples ship with it (`visionai_sdk_python.relay.examples`: `example(name)` /
|
|
187
|
+
`example_text(name)`), so every implementation tests against the same frames. The decisions
|
|
188
|
+
behind the protocol are platform-service's `docs/adr/0001-relay-protocol.md`. It is internal
|
|
189
|
+
to the platform and not a public API.
|
|
146
190
|
|
|
147
191
|
## VLM Inference
|
|
148
192
|
|
|
@@ -250,6 +294,25 @@ client = Client(
|
|
|
250
294
|
)
|
|
251
295
|
```
|
|
252
296
|
|
|
297
|
+
### Token issuers
|
|
298
|
+
|
|
299
|
+
`allowed_issuers` is optional. When you leave it out, the SDK derives the
|
|
300
|
+
trusted issuers from `auth_url` and accepts a token whose `iss` claim either:
|
|
301
|
+
|
|
302
|
+
- equals `{auth_url}/keycloak/realms/linker-platform`, the realm every
|
|
303
|
+
deployment hosts behind its own base URL; or
|
|
304
|
+
- equals an external issuer the site is known to still accept — today only
|
|
305
|
+
production, which takes its Auth0 tenant alongside Keycloak while it migrates.
|
|
306
|
+
|
|
307
|
+
That means `auth_url` has to be the site's **public base URL** — the same host
|
|
308
|
+
that appears in the token's `iss` claim. Pointing it at an in-cluster or proxied
|
|
309
|
+
address (for example a backend service URL) derives issuers that no token will
|
|
310
|
+
ever carry, and verification fails with `jwt.InvalidIssuerError`. Pass
|
|
311
|
+
`allowed_issuers` explicitly if you need to talk to a site through such an
|
|
312
|
+
address.
|
|
313
|
+
|
|
314
|
+
Passing `allowed_issuers` yourself replaces both rules with an exact-match list.
|
|
315
|
+
|
|
253
316
|
## Error Handling
|
|
254
317
|
|
|
255
318
|
```python
|
|
@@ -364,7 +427,10 @@ instrumentation.instrument(
|
|
|
364
427
|
```
|
|
365
428
|
|
|
366
429
|
This wraps a request-dispatch method of `requests.Session`, `httpx.Client`/
|
|
367
|
-
`AsyncClient
|
|
430
|
+
`AsyncClient`, `httpx2.Client`/`AsyncClient` (the httpx fork Starlette prefers
|
|
431
|
+
from 1.2.0 on, see
|
|
432
|
+
[Kludex/starlette#3291](https://github.com/Kludex/starlette/pull/3291)) and
|
|
433
|
+
`aiohttp.ClientSession` in place, so it also covers calls made
|
|
368
434
|
by third-party packages you cannot edit, module-level one-shots like
|
|
369
435
|
`requests.get()`, and requests sent through a client instance that already
|
|
370
436
|
existed before `instrument()` ran (see "Call it any time" below).
|
|
@@ -376,6 +442,7 @@ it patches are separately optional, and whichever is not installed is skipped:
|
|
|
376
442
|
pip install visionai-sdk-python[instrumentation]
|
|
377
443
|
pip install visionai-sdk-python[requests] # httpx is already a core dependency
|
|
378
444
|
pip install visionai-sdk-python[aiohttp]
|
|
445
|
+
pip install visionai-sdk-python[httpx2]
|
|
379
446
|
```
|
|
380
447
|
|
|
381
448
|
### Destination scoping
|
|
@@ -25,6 +25,7 @@ Attributing direct `requests`/`aiohttp` calls, or using `instrumentation.instrum
|
|
|
25
25
|
```bash
|
|
26
26
|
pip install visionai-sdk-python[requests]
|
|
27
27
|
pip install visionai-sdk-python[aiohttp]
|
|
28
|
+
pip install visionai-sdk-python[httpx2]
|
|
28
29
|
pip install visionai-sdk-python[instrumentation] # needed for instrument() itself
|
|
29
30
|
```
|
|
30
31
|
|
|
@@ -116,15 +117,56 @@ token = client.auth.login("user@example.com", "password")
|
|
|
116
117
|
|
|
117
118
|
### OAuth Client Credentials
|
|
118
119
|
|
|
120
|
+
A `ClientCredentials` (or `AsyncClientCredentials`) holds the token for one Platform
|
|
121
|
+
client: it is minted on first use, cached until shortly before it expires, and one
|
|
122
|
+
instance can serve any number of clients and your own requests.
|
|
123
|
+
|
|
119
124
|
```python
|
|
120
|
-
|
|
121
|
-
token = client.auth.get_access_token(
|
|
122
|
-
client_id="your-client-id",
|
|
123
|
-
client_secret="your-client-secret"
|
|
124
|
-
)
|
|
125
|
-
```
|
|
125
|
+
from visionai_sdk_python import Client, ClientCredentials
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
cred = ClientCredentials(
|
|
128
|
+
auth_url="...", client_id="your-client-id", client_secret="your-client-secret"
|
|
129
|
+
)
|
|
130
|
+
client = Client(auth_url="...", vlm_url="...", credential=cred) # vlm.chat() uses it
|
|
131
|
+
|
|
132
|
+
token = cred.get_token().token # for a WebSocket upgrade or another library
|
|
133
|
+
|
|
134
|
+
# Any other HTTP call with the same token, sent to the host you name; a 401 gets one
|
|
135
|
+
# fresh token and one retry
|
|
136
|
+
nodes = client.request("GET", "https://vs.example.com/mgmt/nodes").json()
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`request()` raises on a non-2xx like the resource methods (`AuthenticationError`,
|
|
140
|
+
`ClientError`, `ServerError`, ...), unlike plain httpx, and sends the token to whatever
|
|
141
|
+
host `url` names, so `url` comes from configuration or code, never from a caller. A
|
|
142
|
+
client built with `http_client=` (or a credential with `http=`) uses that client's TLS,
|
|
143
|
+
timeout and limits; passing `verify_ssl` / `timeout` / `max_connections` /
|
|
144
|
+
`max_keepalive_connections` with it raises `ValueError`.
|
|
145
|
+
|
|
146
|
+
A mint is a Platform round trip and, on sites that cap client tokens, a scarce one:
|
|
147
|
+
concurrent callers share one mint, a refresh that fails keeps the current token while
|
|
148
|
+
Platform still accepts it, a 401 on a token minted more than 30 minutes ago buys a
|
|
149
|
+
replacement (`cred.invalidate(token)`; a younger one is kept, so a persistent 401
|
|
150
|
+
mints at most twice an hour), and after a 429 no mint is tried for an hour
|
|
151
|
+
(`RateLimitedError`). `get_token(force_refresh=True)` mints on demand.
|
|
152
|
+
|
|
153
|
+
`client.auth.get_access_token(client_id, client_secret)` still works and now builds a
|
|
154
|
+
`ClientCredentials` underneath; it returns the cached token unless `force_refresh=True`.
|
|
155
|
+
A later `login()` or `set_token()` replaces the credential: the last explicit
|
|
156
|
+
authentication wins. `vlm_url` is optional for clients that only authenticate.
|
|
157
|
+
|
|
158
|
+
## Relay protocol (internal)
|
|
159
|
+
|
|
160
|
+
`visionai_sdk_python.relay` holds the wire format between platform-relay and
|
|
161
|
+
platform-edge-agent: the frame models, the constants and `parse_agent_frame()` /
|
|
162
|
+
`parse_relay_frame()` (text frames only: `bytes` or `None` is an `InvalidFrame`) /
|
|
163
|
+
`dump_frame()` (which refuses a frame over `MAX_FRAME_BYTES`). The spec is
|
|
164
|
+
[`docs/relay-protocol.md`](docs/relay-protocol.md); both sides import this module instead of
|
|
165
|
+
keeping a copy, and a protocol change edits the spec and the module in one PR. The spec's
|
|
166
|
+
JSON examples ship with it (`visionai_sdk_python.relay.examples`: `example(name)` /
|
|
167
|
+
`example_text(name)`), so every implementation tests against the same frames. The decisions
|
|
168
|
+
behind the protocol are platform-service's `docs/adr/0001-relay-protocol.md`. It is internal
|
|
169
|
+
to the platform and not a public API.
|
|
128
170
|
|
|
129
171
|
## VLM Inference
|
|
130
172
|
|
|
@@ -232,6 +274,25 @@ client = Client(
|
|
|
232
274
|
)
|
|
233
275
|
```
|
|
234
276
|
|
|
277
|
+
### Token issuers
|
|
278
|
+
|
|
279
|
+
`allowed_issuers` is optional. When you leave it out, the SDK derives the
|
|
280
|
+
trusted issuers from `auth_url` and accepts a token whose `iss` claim either:
|
|
281
|
+
|
|
282
|
+
- equals `{auth_url}/keycloak/realms/linker-platform`, the realm every
|
|
283
|
+
deployment hosts behind its own base URL; or
|
|
284
|
+
- equals an external issuer the site is known to still accept — today only
|
|
285
|
+
production, which takes its Auth0 tenant alongside Keycloak while it migrates.
|
|
286
|
+
|
|
287
|
+
That means `auth_url` has to be the site's **public base URL** — the same host
|
|
288
|
+
that appears in the token's `iss` claim. Pointing it at an in-cluster or proxied
|
|
289
|
+
address (for example a backend service URL) derives issuers that no token will
|
|
290
|
+
ever carry, and verification fails with `jwt.InvalidIssuerError`. Pass
|
|
291
|
+
`allowed_issuers` explicitly if you need to talk to a site through such an
|
|
292
|
+
address.
|
|
293
|
+
|
|
294
|
+
Passing `allowed_issuers` yourself replaces both rules with an exact-match list.
|
|
295
|
+
|
|
235
296
|
## Error Handling
|
|
236
297
|
|
|
237
298
|
```python
|
|
@@ -346,7 +407,10 @@ instrumentation.instrument(
|
|
|
346
407
|
```
|
|
347
408
|
|
|
348
409
|
This wraps a request-dispatch method of `requests.Session`, `httpx.Client`/
|
|
349
|
-
`AsyncClient
|
|
410
|
+
`AsyncClient`, `httpx2.Client`/`AsyncClient` (the httpx fork Starlette prefers
|
|
411
|
+
from 1.2.0 on, see
|
|
412
|
+
[Kludex/starlette#3291](https://github.com/Kludex/starlette/pull/3291)) and
|
|
413
|
+
`aiohttp.ClientSession` in place, so it also covers calls made
|
|
350
414
|
by third-party packages you cannot edit, module-level one-shots like
|
|
351
415
|
`requests.get()`, and requests sent through a client instance that already
|
|
352
416
|
existed before `instrument()` ran (see "Call it any time" below).
|
|
@@ -358,6 +422,7 @@ it patches are separately optional, and whichever is not installed is skipped:
|
|
|
358
422
|
pip install visionai-sdk-python[instrumentation]
|
|
359
423
|
pip install visionai-sdk-python[requests] # httpx is already a core dependency
|
|
360
424
|
pip install visionai-sdk-python[aiohttp]
|
|
425
|
+
pip install visionai-sdk-python[httpx2]
|
|
361
426
|
```
|
|
362
427
|
|
|
363
428
|
### Destination scoping
|
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
# platform-relay ↔ platform-edge-agent wire format, `platform-relay.v1`
|
|
2
|
+
|
|
3
|
+
What goes over the WebSocket between platform-relay (platform-service) and platform-edge-agent
|
|
4
|
+
(visionai-vlm-scheduling-service). `visionai_sdk_python.relay` implements it, the models, the
|
|
5
|
+
constants and the parsers, and both sides import that module instead of keeping a copy. The JSON
|
|
6
|
+
examples below ship as `visionai_sdk_python.relay.examples` and are the fixtures of the SDK's, the
|
|
7
|
+
relay's and the agent's tests. A protocol change edits this file and the module in one PR; the two
|
|
8
|
+
consumers then bump the SDK.
|
|
9
|
+
|
|
10
|
+
Why the protocol looks like this is platform-service's `docs/adr/0001-relay-protocol.md`. How the
|
|
11
|
+
relay implements it (the Platform check at `register`, routing, its HTTP API and status mapping) is
|
|
12
|
+
`relay/README.md` in that repository; the agent's side is in visionai-vlm-scheduling-service.
|
|
13
|
+
|
|
14
|
+
## 1. Connection
|
|
15
|
+
|
|
16
|
+
The agent connects to `wss://<platform_domain>/relay/ws`. The HTTP upgrade carries the agent's
|
|
17
|
+
identity and the protocol version:
|
|
18
|
+
|
|
19
|
+
```http
|
|
20
|
+
GET /relay/ws HTTP/1.1
|
|
21
|
+
Host: <platform_domain>
|
|
22
|
+
Upgrade: websocket
|
|
23
|
+
Connection: Upgrade
|
|
24
|
+
Sec-WebSocket-Version: 13
|
|
25
|
+
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
|
|
26
|
+
Sec-WebSocket-Protocol: platform-relay.v1
|
|
27
|
+
Authorization: Bearer eyJhbGciOi…
|
|
28
|
+
|
|
29
|
+
HTTP/1.1 101 Switching Protocols
|
|
30
|
+
Upgrade: websocket
|
|
31
|
+
Connection: Upgrade
|
|
32
|
+
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=
|
|
33
|
+
Sec-WebSocket-Protocol: platform-relay.v1
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
- `Authorization` is a platform M2M token (client credentials). A refused upgrade is an HTTP
|
|
37
|
+
status, not a close code, with a JSON body `{"detail": "<why>"}`: 400 when the relay knows none
|
|
38
|
+
of the offered subprotocols; 401 when Platform does not accept the token (the agent fetches a new
|
|
39
|
+
token, once, and reconnects); 403 when the token is valid but the relay does not serve that
|
|
40
|
+
identity, a user token or a client outside its allowlist (a new token would not help: the agent
|
|
41
|
+
keeps it and retries after its backoff); 503 when the relay got no answer from Platform, a 429 of
|
|
42
|
+
its auth-failure throttle included (the agent retries with the same token).
|
|
43
|
+
- `Sec-WebSocket-Protocol` carries the protocol version (§6).
|
|
44
|
+
- After `101` the connection is the identity. Messages carry no agent or tenant fields.
|
|
45
|
+
|
|
46
|
+
Transport:
|
|
47
|
+
|
|
48
|
+
- Text frames only, one JSON object per frame, UTF-8. A binary frame is answered with
|
|
49
|
+
`error invalid_message`.
|
|
50
|
+
- Maximum frame size 16 MiB in both directions; both sides check the encoded frame before sending
|
|
51
|
+
(`dump_frame()` refuses a larger one).
|
|
52
|
+
- WebSocket ping every 20 s, pong timeout 60 s, on both sides. Large frames on slow links delay
|
|
53
|
+
pongs, so the timeout is not the library default.
|
|
54
|
+
|
|
55
|
+
## 2. Messages
|
|
56
|
+
|
|
57
|
+
Six message types, told apart by `type`. Optional fields may be omitted or `null`. Receivers ignore
|
|
58
|
+
unknown fields.
|
|
59
|
+
|
|
60
|
+
| `type` | Sender | Fields |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| `register` | agent | `agent_id`, `cluster_id`, `workspaces` |
|
|
63
|
+
| `registered` | relay | `accepted`, `rejected` |
|
|
64
|
+
| `heartbeat` | agent | none |
|
|
65
|
+
| `request` | relay | `request_id`, `workspace_id`, `method`, `path`, `headers`, `body`, `timeout_s` |
|
|
66
|
+
| `response` | agent | `request_id`, `status`, `headers`, `body` |
|
|
67
|
+
| `error` | either | `request_id` (optional), `code`, `message` |
|
|
68
|
+
|
|
69
|
+
| Field | Type | Meaning |
|
|
70
|
+
|---|---|---|
|
|
71
|
+
| `agent_id` | string | The agent's pod name. With `cluster_id` it identifies a reconnecting agent (§3). |
|
|
72
|
+
| `cluster_id` | string | The agent's site, from its own configuration: the value vlm-mgmt reports as `VLM_CLUSTER_NAME` and Platform stores in `Node.cluster`. Required. |
|
|
73
|
+
| `workspaces` | array of object | `{"id", "models"}` per workspace the agent serves. `id` is the workspace's Platform id, a lowercase hyphenated UUID. Complete list; replaces the previous one. |
|
|
74
|
+
| `models` | array of object | `{"name", "version", "replicas"}` per model the workspace's VS lists as available (§3). Empty when it lists none. |
|
|
75
|
+
| `replicas` | integer | Required; a `register` without it is invalid (§5). Available nodes listing that model and version (§3); weights the relay's routing. |
|
|
76
|
+
| `accepted` | array of string | Workspace ids from `workspaces` the relay registered. |
|
|
77
|
+
| `rejected` | array of object | `{"id", "reason"}` per refused workspace: the workspace id and a reason from §5. |
|
|
78
|
+
| `request_id` | string | UUID v4 minted by the relay. `response` and `error` echo it. |
|
|
79
|
+
| `workspace_id` | string | Target workspace of a `request`. |
|
|
80
|
+
| `method`, `path` | string | The caller's HTTP method and path below `/<workspace_id>`, query string included. |
|
|
81
|
+
| `headers` | object | `request`: `Authorization`, `X-Request-Source`, `Content-Type` only. `response`: `Content-Type` only. Names are case-insensitive. |
|
|
82
|
+
| `body` | object, string or null | The HTTP body: JSON as an object, anything else as a string, `null` when there is none. |
|
|
83
|
+
| `timeout_s` | integer | Seconds the agent waits for VS. |
|
|
84
|
+
| `status` | integer | VS's HTTP status code, unchanged. |
|
|
85
|
+
| `code`, `message` | string | Error code (§5) and a human-readable detail, at most 200 characters. |
|
|
86
|
+
|
|
87
|
+
Examples. Image data and tokens are truncated; the `request` body is what Dataverse sends today.
|
|
88
|
+
|
|
89
|
+
`register`, agent → relay, first frame after `101`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{"type": "register",
|
|
93
|
+
"agent_id": "platform-edge-agent-7d9f4b6c8-xk2pq",
|
|
94
|
+
"cluster_id": "aws-offline-edge",
|
|
95
|
+
"workspaces": [{"id": "31a6638a-5c2e-4f1b-9a7d-0e3c6b8d2f41",
|
|
96
|
+
"models": [{"name": "cr2-8b", "version": "4.5.0", "replicas": 2},
|
|
97
|
+
{"name": "cr2-8b", "version": "4.6.0", "replicas": 1}]},
|
|
98
|
+
{"id": "7589d018-2b4c-4e6f-8a1d-3c5e7f9b1d23", "models": []},
|
|
99
|
+
{"id": "QA Workspace", "models": []}]}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
`registered`, relay → agent. Platform lists no node of `aws-offline-edge` for `7589…`; `QA Workspace`
|
|
103
|
+
is not a UUID:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{"type": "registered",
|
|
107
|
+
"accepted": ["31a6638a-5c2e-4f1b-9a7d-0e3c6b8d2f41"],
|
|
108
|
+
"rejected": [{"id": "7589d018-2b4c-4e6f-8a1d-3c5e7f9b1d23", "reason": "cluster_mismatch"},
|
|
109
|
+
{"id": "QA Workspace", "reason": "invalid_id"}]}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`heartbeat`, agent → relay, every 30 s:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{"type": "heartbeat"}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`request`, relay → agent:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{"type": "request",
|
|
122
|
+
"request_id": "7f3c2a1e-9d4b-4c8a-b2e6-1f5d3a7c9e0b",
|
|
123
|
+
"workspace_id": "31a6638a-5c2e-4f1b-9a7d-0e3c6b8d2f41",
|
|
124
|
+
"method": "POST",
|
|
125
|
+
"path": "/api/chat",
|
|
126
|
+
"headers": {"Authorization": "Bearer eyJhbGciOi…",
|
|
127
|
+
"X-Request-Source": "dataverse",
|
|
128
|
+
"Content-Type": "application/json"},
|
|
129
|
+
"body": {"img": "data:image/jpeg;base64,/9j/4AAQ…",
|
|
130
|
+
"prompt": "Describe the scene.",
|
|
131
|
+
"temperature": 0.2, "max_tokens": 500, "top_p": 0.7,
|
|
132
|
+
"stream": false, "use_cache": true, "num_beams": 1,
|
|
133
|
+
"model": "cr2-8b", "model_version": null,
|
|
134
|
+
"api_endpoint": null, "hook": null,
|
|
135
|
+
"keep_alive": true, "use_response_postprocess": true,
|
|
136
|
+
"workspace_id": "31a6638a-5c2e-4f1b-9a7d-0e3c6b8d2f41"},
|
|
137
|
+
"timeout_s": 100}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
`response`, agent → relay. The same shape carries VS's 408, 422 and 500 answers:
|
|
141
|
+
|
|
142
|
+
```json
|
|
143
|
+
{"type": "response",
|
|
144
|
+
"request_id": "7f3c2a1e-9d4b-4c8a-b2e6-1f5d3a7c9e0b",
|
|
145
|
+
"status": 200,
|
|
146
|
+
"headers": {"Content-Type": "application/json"},
|
|
147
|
+
"body": {"chat_id": "high:1760424000123-3f9a1c7e",
|
|
148
|
+
"status": "completed",
|
|
149
|
+
"message": "{\"description\": \"A forklift in a warehouse aisle.\"}",
|
|
150
|
+
"dispatch": {"model_name": "cr2-8b", "model_version": "4.5.0",
|
|
151
|
+
"api_endpoint": "http://cr2-8b:8000"}}}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
`response` with a non-JSON body, for example an unhandled 500 from VS:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{"type": "response",
|
|
158
|
+
"request_id": "7f3c2a1e-9d4b-4c8a-b2e6-1f5d3a7c9e0b",
|
|
159
|
+
"status": 500,
|
|
160
|
+
"headers": {"Content-Type": "text/plain; charset=utf-8"},
|
|
161
|
+
"body": "Internal Server Error"}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
`error` about one request, agent → relay:
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{"type": "error",
|
|
168
|
+
"request_id": "7f3c2a1e-9d4b-4c8a-b2e6-1f5d3a7c9e0b",
|
|
169
|
+
"code": "upstream_unreachable",
|
|
170
|
+
"message": "connect to vlm-scheduling-service-backend.31a6638a-5c2e-4f1b-9a7d-0e3c6b8d2f41.svc.cluster.local:80 failed"}
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
`error` about the connection, relay → agent, no `request_id`:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{"type": "error",
|
|
177
|
+
"code": "invalid_message",
|
|
178
|
+
"message": "unknown type 'ping'"}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## 3. Registration and liveness
|
|
182
|
+
|
|
183
|
+
- The first frame after `101` MUST be `register`, within 10 s. Otherwise the relay closes with 1008.
|
|
184
|
+
- `workspaces` is every workspace the agent serves; an empty list is valid. `models` is what that
|
|
185
|
+
workspace's VS reports on `GET /mgmt/nodes`: the `model_name` / `model_version` pairs of nodes
|
|
186
|
+
with `status: available`, and in `replicas` how many such nodes list each pair.
|
|
187
|
+
- The relay answers every `register` with `registered`, checking each workspace on its own (reasons
|
|
188
|
+
in §5). The connection stays open whatever the outcome.
|
|
189
|
+
- The agent re-sends `register` when its list changes, and on its next poll after a
|
|
190
|
+
`platform_unavailable` rejection. The new list replaces the previous one; an agent shutting down
|
|
191
|
+
may send an empty list first so no new `request` reaches it while it drains.
|
|
192
|
+
- A new connection with the same `cluster_id` and `agent_id` replaces the old one: the relay closes
|
|
193
|
+
the old connection with 4000.
|
|
194
|
+
- The agent sends `heartbeat` every 30 s; the relay does not reply. No frame for 90 s: the relay
|
|
195
|
+
closes with 4001.
|
|
196
|
+
- Shutdown: on SIGTERM the agent finishes in-flight requests, 10 s at most, then closes with 1001.
|
|
197
|
+
The relay fails the requests still open on a connection that closes, whatever the code.
|
|
198
|
+
|
|
199
|
+
## 4. Request and response
|
|
200
|
+
|
|
201
|
+
The relay wraps the caller's HTTP request; the agent replays it against VS. The shape is generic
|
|
202
|
+
HTTP so further paths can be added without a protocol change.
|
|
203
|
+
|
|
204
|
+
- Several requests may be in flight on one connection. Responses may arrive in any order; the
|
|
205
|
+
`request_id` pairs them.
|
|
206
|
+
- The agent forwards the three allowed headers unchanged and adds `X-Request-ID: <request_id>`.
|
|
207
|
+
Nothing else is added.
|
|
208
|
+
- `timeout_s` is the agent's HTTP timeout for the call. Chat uses 100.
|
|
209
|
+
- Paths allowed in v1: `POST /api/chat`. Anything else: `error path_not_allowed`.
|
|
210
|
+
- The agent answers 422 without calling VS when the body has `stream: true`: a response is one
|
|
211
|
+
frame, so SSE cannot be carried.
|
|
212
|
+
- The agent always answers: VS unreachable → `error upstream_unreachable`; no answer within
|
|
213
|
+
`timeout_s` → `error upstream_timeout`; a `response` that would not fit a frame →
|
|
214
|
+
`error upstream_too_large`; any other body → `response` with the body as a string.
|
|
215
|
+
- Neither side logs `Authorization` or `body.img` (linker-convention `conventions/logging.md` §6).
|
|
216
|
+
|
|
217
|
+
One chat, end to end:
|
|
218
|
+
|
|
219
|
+
```text
|
|
220
|
+
agent → relay HTTP upgrade, Authorization + Sec-WebSocket-Protocol: platform-relay.v1
|
|
221
|
+
relay → agent 101 Switching Protocols
|
|
222
|
+
agent → relay {"type": "register", "agent_id": "…", "cluster_id": "aws-offline-edge", "workspaces": [{"id": "31a6…", "models": [{"name": "cr2-8b", "version": "4.5.0", "replicas": 2}]}, {"id": "7589…", "models": []}]}
|
|
223
|
+
relay → agent {"type": "registered", "accepted": ["31a6…", "7589…"], "rejected": []}
|
|
224
|
+
… Dataverse: POST http://platform-relay/31a6…/api/chat
|
|
225
|
+
relay → agent {"type": "request", "request_id": "7f3c…", "workspace_id": "31a6…", "method": "POST", "path": "/api/chat", …}
|
|
226
|
+
… agent: POST http://vlm-scheduling-service-backend.31a6….svc.cluster.local/api/chat
|
|
227
|
+
agent → relay {"type": "response", "request_id": "7f3c…", "status": 200, …}
|
|
228
|
+
… relay: 200 with VS's body back to Dataverse
|
|
229
|
+
agent → relay {"type": "heartbeat"} every 30 s throughout
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 5. Errors and close codes
|
|
233
|
+
|
|
234
|
+
An `error` that carries a `request_id` ends that request at once. An `error` without
|
|
235
|
+
`request_id` is logged and the connection stays open.
|
|
236
|
+
|
|
237
|
+
| `code` | Sender | When |
|
|
238
|
+
|---|---|---|
|
|
239
|
+
| `invalid_message` | either | Frame is binary, not JSON, has no `type`, an unknown `type`, or fails validation |
|
|
240
|
+
| `unknown_workspace` | agent | `workspace_id` is not in the agent's current list |
|
|
241
|
+
| `path_not_allowed` | agent | `method` + `path` outside §4 |
|
|
242
|
+
| `upstream_unreachable` | agent | Connection to VS failed, or VS's answer could not be read |
|
|
243
|
+
| `upstream_timeout` | agent | VS did not answer within `timeout_s` |
|
|
244
|
+
| `upstream_too_large` | agent | VS answered, but the `response` frame would be over 16 MiB |
|
|
245
|
+
| any other value | either | Added by a later version |
|
|
246
|
+
|
|
247
|
+
`reason` values in `registered.rejected`:
|
|
248
|
+
|
|
249
|
+
| `reason` | When |
|
|
250
|
+
|---|---|
|
|
251
|
+
| `invalid_id` | `id` is not a lowercase hyphenated UUID, or appears twice |
|
|
252
|
+
| `cluster_mismatch` | Platform lists no node of `cluster_id` for that workspace |
|
|
253
|
+
| `platform_unavailable` | The relay could not ask Platform; the agent's next `register` retries |
|
|
254
|
+
|
|
255
|
+
Close codes:
|
|
256
|
+
|
|
257
|
+
| Code | Sender | When |
|
|
258
|
+
|---|---|---|
|
|
259
|
+
| 1000 | either | Normal close |
|
|
260
|
+
| 1001 | either | Shutting down. Agents reconnect after a relay 1001; the relay drops the entry after an agent 1001 |
|
|
261
|
+
| 1008 | relay | Protocol violation: no `register` within 10 s, or a first frame that is not `register` |
|
|
262
|
+
| 1009 | either | Frame over 16 MiB. Both sides enforce the limit before sending, so this is a bug |
|
|
263
|
+
| 4000 | relay | Replaced by a new connection with the same `cluster_id` and `agent_id` |
|
|
264
|
+
| 4001 | relay | No frame for 90 s |
|
|
265
|
+
|
|
266
|
+
HTTP 400, 401 and 503 at the upgrade (§1) are not close codes; the connection never opens.
|
|
267
|
+
|
|
268
|
+
## 6. Versioning
|
|
269
|
+
|
|
270
|
+
- The version is the WebSocket subprotocol name, `platform-relay.v1`. Messages carry no version field.
|
|
271
|
+
- Adding an optional field is not a new version. Receivers ignore unknown fields.
|
|
272
|
+
- Changing a field's meaning, removing one, or changing the message flow is `platform-relay.v2`.
|
|
273
|
+
- An agent may offer several versions, newest first: `platform-relay.v2, platform-relay.v1`. The
|
|
274
|
+
relay answers with the one it picked. An agent refused at the upgrade backs off and retries; it
|
|
275
|
+
does not fall back to an unversioned connection.
|
|
276
|
+
|
|
277
|
+
## 7. Limits
|
|
278
|
+
|
|
279
|
+
- 16 MiB per frame, both directions (`MAX_FRAME_BYTES`); the relay refuses a request body over
|
|
280
|
+
15 MiB before anything is sent (`MAX_BODY_BYTES`).
|
|
281
|
+
- `error.message` is cut at 200 characters (`MAX_MESSAGE_CHARS`): it quotes parts of the peer's
|
|
282
|
+
frame, and the error must fit a frame itself.
|
|
283
|
+
- Timers: `register` within 10 s of the upgrade, `heartbeat` every 30 s, stale after 90 s; the
|
|
284
|
+
agent waits `timeout_s` (100) for VS and the relay 110 s for the agent.
|
|
@@ -24,6 +24,7 @@ dependencies = [
|
|
|
24
24
|
[project.optional-dependencies]
|
|
25
25
|
requests = ["requests>=2.31,<3"]
|
|
26
26
|
aiohttp = ["aiohttp>=3.9,<4"]
|
|
27
|
+
httpx2 = ["httpx2>=2.13,<3"]
|
|
27
28
|
instrumentation = ["wrapt>=1.16,<3"]
|
|
28
29
|
|
|
29
30
|
[build-system]
|
|
@@ -32,6 +33,9 @@ build-backend = "setuptools.build_meta"
|
|
|
32
33
|
|
|
33
34
|
[tool.setuptools_scm]
|
|
34
35
|
|
|
36
|
+
[tool.setuptools.package-data]
|
|
37
|
+
"visionai_sdk_python.relay.examples" = ["*.json"]
|
|
38
|
+
|
|
35
39
|
[tool.uv]
|
|
36
40
|
# Mitigate supply chain attacks. Kept in sync with
|
|
37
41
|
# .github/dependabot.yml's cooldown.default-days (3 days, matching the
|
|
@@ -54,6 +58,7 @@ dev = [
|
|
|
54
58
|
"ruff>=0.15.11",
|
|
55
59
|
"requests>=2.31,<3",
|
|
56
60
|
"aiohttp>=3.9,<4",
|
|
61
|
+
"httpx2>=2.13,<3",
|
|
57
62
|
"wrapt>=1.16,<3",
|
|
58
63
|
]
|
|
59
64
|
|
|
@@ -4,6 +4,7 @@ A client library for interacting with VisionAI authentication and VLM services.
|
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
6
|
from .async_client import AsyncClient
|
|
7
|
+
from .auth.credentials import AccessToken, AsyncClientCredentials, ClientCredentials
|
|
7
8
|
from .client import Client
|
|
8
9
|
from .exceptions import (
|
|
9
10
|
AuthenticationError,
|
|
@@ -11,16 +12,21 @@ from .exceptions import (
|
|
|
11
12
|
JwksDiscoveryError,
|
|
12
13
|
NetworkError,
|
|
13
14
|
PermissionDeniedError,
|
|
15
|
+
RateLimitedError,
|
|
14
16
|
ServerError,
|
|
15
17
|
VisionaiSDKError,
|
|
16
18
|
)
|
|
17
19
|
|
|
18
20
|
__all__ = [
|
|
21
|
+
"AccessToken",
|
|
19
22
|
"AsyncClient",
|
|
23
|
+
"AsyncClientCredentials",
|
|
20
24
|
"Client",
|
|
25
|
+
"ClientCredentials",
|
|
21
26
|
"VisionaiSDKError",
|
|
22
27
|
"AuthenticationError",
|
|
23
28
|
"PermissionDeniedError",
|
|
29
|
+
"RateLimitedError",
|
|
24
30
|
"ClientError",
|
|
25
31
|
"ServerError",
|
|
26
32
|
"NetworkError",
|