runware-sdk 1.3.2__tar.gz → 1.4.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.
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/PKG-INFO +12 -1
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/README.md +11 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/pyproject.toml +8 -1
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/__init__.py +3 -1
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/_schemas_version.py +1 -1
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/client.py +4 -1
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/types/task_map.py +588 -366
- runware_sdk-1.4.0/runware/utils/file.py +97 -0
- runware_sdk-1.3.2/runware/utils/file.py +0 -43
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/LICENSE +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/_docs_cache.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/config.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/constants.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/content.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/errors.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/logger.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/py.typed +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/registry.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/stream.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/transport/__init__.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/transport/rest.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/transport/websocket.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/types/__init__.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/types/content.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/types/sdk.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/types/stream.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/types/transport.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/utils/__init__.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/utils/retry.py +0 -0
- {runware_sdk-1.3.2 → runware_sdk-1.4.0}/runware/validate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: runware-sdk
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Async Python SDK for the Runware platform — image, video, audio, text, and 3D generation, plus upscaling, background removal, and more, over REST or WebSocket with typed parameters and runtime validation.
|
|
5
5
|
Keywords: runware,ai,sdk,image-generation,video-generation,audio-generation,text-generation,inference,generative-ai,stable-diffusion,flux,websocket,async,asyncio,llm,streaming
|
|
6
6
|
Author: Runware
|
|
@@ -627,6 +627,8 @@ google = await client.content.get_creator("google")
|
|
|
627
627
|
page = await client.content.list_models({"paginate": True, "limit": 25, "offset": 0})
|
|
628
628
|
```
|
|
629
629
|
|
|
630
|
+
The per-model methods (`get_model`, `get_model_examples`, `get_model_pricing`) accept either the model's AIR or its catalog slug (the `model` field returned by `list_models`).
|
|
631
|
+
|
|
630
632
|
`creator`, `capabilities`, and `architecture` on each model are returned as id strings — resolve them against `list_creators`, `list_capabilities`, and the architecture id respectively when you need the human-readable label. Collections and creators are the only endpoints that resolve their inner `models` array to full objects.
|
|
631
633
|
|
|
632
634
|
## File helpers
|
|
@@ -643,6 +645,15 @@ await client.image_upload({"image": data_uri})
|
|
|
643
645
|
|
|
644
646
|
Accepts both `Path` and `bytes` — `bytes` is useful when the file lives in memory (e.g. a freshly downloaded blob).
|
|
645
647
|
|
|
648
|
+
`file_to_base64` does the same read but returns raw base64 with no `data:` prefix or MIME type (the server sniffs the real format from the bytes).
|
|
649
|
+
|
|
650
|
+
You usually don't need either helper for inputs: `run()` and `image_upload` auto-encode local file paths. Any string value (recursively, including nested dicts and lists) that points to an existing file on disk is read and replaced with its base64 before the request is sent. URLs, UUIDs, data URIs, existing base64, and prompts pass through untouched.
|
|
651
|
+
|
|
652
|
+
```python
|
|
653
|
+
await client.run({"model": "...", "seedImage": "./photo.jpg"})
|
|
654
|
+
await client.run({"model": "...", "referenceImages": ["./a.jpg", "./b.jpg"]})
|
|
655
|
+
```
|
|
656
|
+
|
|
646
657
|
## Custom dependencies
|
|
647
658
|
|
|
648
659
|
For testing, proxies, or custom auth flows, pass a `RuntimeDependencies`:
|
|
@@ -590,6 +590,8 @@ google = await client.content.get_creator("google")
|
|
|
590
590
|
page = await client.content.list_models({"paginate": True, "limit": 25, "offset": 0})
|
|
591
591
|
```
|
|
592
592
|
|
|
593
|
+
The per-model methods (`get_model`, `get_model_examples`, `get_model_pricing`) accept either the model's AIR or its catalog slug (the `model` field returned by `list_models`).
|
|
594
|
+
|
|
593
595
|
`creator`, `capabilities`, and `architecture` on each model are returned as id strings — resolve them against `list_creators`, `list_capabilities`, and the architecture id respectively when you need the human-readable label. Collections and creators are the only endpoints that resolve their inner `models` array to full objects.
|
|
594
596
|
|
|
595
597
|
## File helpers
|
|
@@ -606,6 +608,15 @@ await client.image_upload({"image": data_uri})
|
|
|
606
608
|
|
|
607
609
|
Accepts both `Path` and `bytes` — `bytes` is useful when the file lives in memory (e.g. a freshly downloaded blob).
|
|
608
610
|
|
|
611
|
+
`file_to_base64` does the same read but returns raw base64 with no `data:` prefix or MIME type (the server sniffs the real format from the bytes).
|
|
612
|
+
|
|
613
|
+
You usually don't need either helper for inputs: `run()` and `image_upload` auto-encode local file paths. Any string value (recursively, including nested dicts and lists) that points to an existing file on disk is read and replaced with its base64 before the request is sent. URLs, UUIDs, data URIs, existing base64, and prompts pass through untouched.
|
|
614
|
+
|
|
615
|
+
```python
|
|
616
|
+
await client.run({"model": "...", "seedImage": "./photo.jpg"})
|
|
617
|
+
await client.run({"model": "...", "referenceImages": ["./a.jpg", "./b.jpg"]})
|
|
618
|
+
```
|
|
619
|
+
|
|
609
620
|
## Custom dependencies
|
|
610
621
|
|
|
611
622
|
For testing, proxies, or custom auth flows, pass a `RuntimeDependencies`:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "runware-sdk"
|
|
3
|
-
version = "1.
|
|
3
|
+
version = "1.4.0"
|
|
4
4
|
description = "Async Python SDK for the Runware platform — image, video, audio, text, and 3D generation, plus upscaling, background removal, and more, over REST or WebSocket with typed parameters and runtime validation."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.11"
|
|
@@ -165,6 +165,13 @@ reportUnusedFunction = "none"
|
|
|
165
165
|
root = "scripts"
|
|
166
166
|
reportAny = "none"
|
|
167
167
|
reportExplicitAny = "none"
|
|
168
|
+
# The generator walks arbitrary JSON Schema where every node is `Any` until
|
|
169
|
+
# narrowed — fully typing a recursive, dynamic schema isn't worthwhile, so the
|
|
170
|
+
# honest-Any rules are off here (as in the tests env). Everything else stays
|
|
171
|
+
# enforced, including discarded call results (`_ =` at each side-effect call).
|
|
172
|
+
reportUnknownVariableType = "none"
|
|
173
|
+
reportUnknownMemberType = "none"
|
|
174
|
+
reportUnknownArgumentType = "none"
|
|
168
175
|
|
|
169
176
|
[tool.pytest.ini_options]
|
|
170
177
|
asyncio_mode = "auto"
|
|
@@ -48,6 +48,7 @@ Validation:
|
|
|
48
48
|
|
|
49
49
|
Helpers:
|
|
50
50
|
file_to_data_uri — encode files/bytes as data URIs for inputs
|
|
51
|
+
file_to_base64 — encode files/bytes as raw base64 (no data: prefix)
|
|
51
52
|
|
|
52
53
|
Schemas pin:
|
|
53
54
|
SCHEMAS_VERSION — the pinned schemas-bundle version
|
|
@@ -145,7 +146,7 @@ from .types.task_map import (
|
|
|
145
146
|
models,
|
|
146
147
|
operation_task_types,
|
|
147
148
|
)
|
|
148
|
-
from .utils.file import file_to_data_uri
|
|
149
|
+
from .utils.file import file_to_base64, file_to_data_uri
|
|
149
150
|
from .validate import clear_validator_cache
|
|
150
151
|
|
|
151
152
|
__all__ = [
|
|
@@ -235,6 +236,7 @@ __all__ = [
|
|
|
235
236
|
"create_logger",
|
|
236
237
|
"create_registry",
|
|
237
238
|
"create_runware_error",
|
|
239
|
+
"file_to_base64",
|
|
238
240
|
"file_to_data_uri",
|
|
239
241
|
"is_runware_error",
|
|
240
242
|
"modality_task_types",
|
|
@@ -78,6 +78,7 @@ from .types.task_map import (
|
|
|
78
78
|
operation_task_types as _bundled_operation_task_types,
|
|
79
79
|
)
|
|
80
80
|
from .types.transport import RequestOptions, WireFrame
|
|
81
|
+
from .utils.file import encode_local_files
|
|
81
82
|
from .validate import validate_tasks
|
|
82
83
|
|
|
83
84
|
|
|
@@ -253,6 +254,7 @@ class Runware:
|
|
|
253
254
|
options: RunOptions | None = None,
|
|
254
255
|
) -> list[dict[str, Any]]: # pyright: ignore[reportExplicitAny]
|
|
255
256
|
"""Run an inference task."""
|
|
257
|
+
params = cast("dict[str, Any]", encode_local_files(params)) # pyright: ignore[reportExplicitAny]
|
|
256
258
|
params = await self._normalize_model_param(params)
|
|
257
259
|
task_type = await self._resolve_task_type(params)
|
|
258
260
|
task_uuid = str(params.get("taskUUID") or uuid.uuid4())
|
|
@@ -366,9 +368,10 @@ class Runware:
|
|
|
366
368
|
async def image_upload(
|
|
367
369
|
self, params: ImageUploadParams, options: RunOptions | None = None,
|
|
368
370
|
) -> list[ImageUploadResult]:
|
|
371
|
+
encoded = cast("dict[str, Any]", encode_local_files(dict(params))) # pyright: ignore[reportExplicitAny]
|
|
369
372
|
return cast(
|
|
370
373
|
list[ImageUploadResult],
|
|
371
|
-
await self._utility("imageUpload",
|
|
374
|
+
await self._utility("imageUpload", encoded, options),
|
|
372
375
|
)
|
|
373
376
|
|
|
374
377
|
async def account_management(
|