parallel-web 0.1.1__tar.gz → 0.1.3__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.
Potentially problematic release.
This version of parallel-web might be problematic. Click here for more details.
- parallel_web-0.1.3/.release-please-manifest.json +3 -0
- parallel_web-0.1.3/CHANGELOG.md +84 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/CONTRIBUTING.md +3 -4
- {parallel_web-0.1.1 → parallel_web-0.1.3}/PKG-INFO +75 -27
- {parallel_web-0.1.1 → parallel_web-0.1.3}/README.md +68 -20
- {parallel_web-0.1.1 → parallel_web-0.1.3}/SECURITY.md +2 -2
- {parallel_web-0.1.1 → parallel_web-0.1.3}/pyproject.toml +6 -5
- {parallel_web-0.1.1 → parallel_web-0.1.3}/requirements-dev.lock +4 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/__init__.py +5 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_base_client.py +22 -2
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_constants.py +2 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_models.py +2 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_types.py +2 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_proxy.py +4 -1
- parallel_web-0.1.3/src/parallel/_utils/_resources_proxy.py +24 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_version.py +1 -1
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/_time.py +21 -4
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/resources/task_run.py +4 -4
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/conftest.py +2 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_client.py +116 -41
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_utils/test_proxy.py +11 -0
- parallel_web-0.1.1/.release-please-manifest.json +0 -3
- parallel_web-0.1.1/CHANGELOG.md +0 -34
- {parallel_web-0.1.1 → parallel_web-0.1.3}/.gitignore +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/LICENSE +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/api.md +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/bin/check-release-environment +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/bin/publish-pypi +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/examples/.keep +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/mypy.ini +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/noxfile.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/release-please-config.json +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/requirements.lock +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_client.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_compat.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_exceptions.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_files.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_qs.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_resource.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_response.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_streaming.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_logs.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_reflection.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_streams.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_sync.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_transform.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_typing.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/_utils/_utils.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/.keep +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/_parsing/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/_parsing/_task_run_result.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/_parsing/_task_spec.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/lib/_pydantic.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/py.typed +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/resources/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/json_schema_param.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/parsed_task_run_result.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/task_run.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/task_run_create_params.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/task_run_result.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/task_run_result_params.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/task_spec_param.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/src/parallel/types/text_schema_param.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/api_resources/__init__.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/api_resources/test_task_run.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/sample_file.txt +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_deepcopy.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_extract_files.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_files.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_models.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_qs.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_required_args.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_response.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_streaming.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_transform.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/test_utils/test_typing.py +0 -0
- {parallel_web-0.1.1 → parallel_web-0.1.3}/tests/utils.py +0 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.3 (2025-08-09)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.1.2...v0.1.3](https://github.com/parallel-web/parallel-sdk-python/compare/v0.1.2...v0.1.3)
|
|
6
|
+
|
|
7
|
+
### Chores
|
|
8
|
+
|
|
9
|
+
* **readme:** update descriptions ([3212a0f](https://github.com/parallel-web/parallel-sdk-python/commit/3212a0fc32d744e7df3d0dcedf527b176a73a91b))
|
|
10
|
+
|
|
11
|
+
## 0.1.2 (2025-06-25)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.1.1...v0.1.2](https://github.com/parallel-web/parallel-sdk-python/compare/v0.1.1...v0.1.2)
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* **api:** add execute method and structured output support ([5e51379](https://github.com/parallel-web/parallel-sdk-python/commit/5e51379e3ff28bdf70a3cc9167d4413bf3e8690c))
|
|
18
|
+
* **api:** update via SDK Studio ([7526908](https://github.com/parallel-web/parallel-sdk-python/commit/752690867c75ee970582fabc05c939a2f619cb3f))
|
|
19
|
+
* **api:** update via SDK Studio ([6698e71](https://github.com/parallel-web/parallel-sdk-python/commit/6698e716bdddcf2146cc802cfaaa26f7ddb4d3dc))
|
|
20
|
+
* **client:** add follow_redirects request option ([deff733](https://github.com/parallel-web/parallel-sdk-python/commit/deff733f189070bb471ebd6cbf92dfd61d19734a))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Bug Fixes
|
|
24
|
+
|
|
25
|
+
* **api:** handle retryable errors ([#2](https://github.com/parallel-web/parallel-sdk-python/issues/2)) ([5317550](https://github.com/parallel-web/parallel-sdk-python/commit/531755070eb4b798a7f0b51153414425a0c293b0))
|
|
26
|
+
* **client:** correctly parse binary response | stream ([9546f27](https://github.com/parallel-web/parallel-sdk-python/commit/9546f276ca2d63cf3c6a9b0eef23f1eed35758fa))
|
|
27
|
+
* **package:** support direct resource imports ([52fe297](https://github.com/parallel-web/parallel-sdk-python/commit/52fe297a34a6a2a473be0f124e2febab1df527fe))
|
|
28
|
+
* **pydantic:** add fields to json schema, better error messages ([38a2ddc](https://github.com/parallel-web/parallel-sdk-python/commit/38a2ddc348ac7acf11f9f75f69900b628e539c1d))
|
|
29
|
+
* **tests:** fix: tests which call HTTP endpoints directly with the example parameters ([bfad009](https://github.com/parallel-web/parallel-sdk-python/commit/bfad009314f4f3ce31265d2be07f091eb7db664a))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Chores
|
|
33
|
+
|
|
34
|
+
* **ci:** enable for pull requests ([0ae47ea](https://github.com/parallel-web/parallel-sdk-python/commit/0ae47eaf080510a886eb40aed7c8189faa940f2c))
|
|
35
|
+
* **ci:** fix installation instructions ([150a642](https://github.com/parallel-web/parallel-sdk-python/commit/150a6429ee584a0c32160be88d9bdcd4eeab4579))
|
|
36
|
+
* **ci:** upload sdks to package manager ([3bd8b36](https://github.com/parallel-web/parallel-sdk-python/commit/3bd8b361b84bad87c0943c2fe71465c92cdea599))
|
|
37
|
+
* **docs:** grammar improvements ([c5b636b](https://github.com/parallel-web/parallel-sdk-python/commit/c5b636bfeb60b02f84f5b9e93687359cd9c5c251))
|
|
38
|
+
* **docs:** remove reference to rye shell ([a64869e](https://github.com/parallel-web/parallel-sdk-python/commit/a64869e70e9c493f2dc3e8618327f28544d36058))
|
|
39
|
+
* **docs:** remove unnecessary param examples ([e15712a](https://github.com/parallel-web/parallel-sdk-python/commit/e15712a074ba66a6b0d225bb3a6979a767c15225))
|
|
40
|
+
* **internal:** avoid errors for isinstance checks on proxies ([4149fb9](https://github.com/parallel-web/parallel-sdk-python/commit/4149fb963b39db2211f404f94bf7b55a57c2556b))
|
|
41
|
+
* **internal:** codegen related update ([6a0bb66](https://github.com/parallel-web/parallel-sdk-python/commit/6a0bb662f5011bbea13f75334eb55c5144b50e8b))
|
|
42
|
+
* **internal:** update conftest.py ([0e08356](https://github.com/parallel-web/parallel-sdk-python/commit/0e0835661e91993042605131065729d006761a5a))
|
|
43
|
+
* **readme:** update badges ([36c14b5](https://github.com/parallel-web/parallel-sdk-python/commit/36c14b529ec8611508b6b7cc9065c67e59e5ecdc))
|
|
44
|
+
* **readme:** update low level api examples ([f17e34e](https://github.com/parallel-web/parallel-sdk-python/commit/f17e34e0e0a6d3205c344c278f1643826938e9d1))
|
|
45
|
+
* **tests:** add tests for httpx client instantiation & proxies ([d84ffff](https://github.com/parallel-web/parallel-sdk-python/commit/d84ffff48a814edc81ef62249353053df6398c90))
|
|
46
|
+
* **tests:** run tests in parallel ([62252c6](https://github.com/parallel-web/parallel-sdk-python/commit/62252c6f1098ad138978b6efa1fc2a9c22961040))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### Documentation
|
|
50
|
+
|
|
51
|
+
* **client:** fix httpx.Timeout documentation reference ([17f87ee](https://github.com/parallel-web/parallel-sdk-python/commit/17f87eef5af2b06b3791f9218b7ab4f9098faf9c))
|
|
52
|
+
|
|
53
|
+
## 0.1.1 (2025-04-25)
|
|
54
|
+
|
|
55
|
+
Full Changelog: [v0.1.0...v0.1.1](https://github.com/shapleyai/parallel-sdk-python/compare/v0.1.0...v0.1.1)
|
|
56
|
+
|
|
57
|
+
### Features
|
|
58
|
+
|
|
59
|
+
* **api:** update via SDK Studio ([4cc79c4](https://github.com/shapleyai/parallel-sdk-python/commit/4cc79c4d1edaa9d1d080b81830961252c8b327c1))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### Bug Fixes
|
|
63
|
+
|
|
64
|
+
* **pydantic:** add fields to json schema, better error messages ([38a2ddc](https://github.com/shapleyai/parallel-sdk-python/commit/38a2ddc348ac7acf11f9f75f69900b628e539c1d))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
### Chores
|
|
68
|
+
|
|
69
|
+
* **readme:** update low level api examples ([f17e34e](https://github.com/shapleyai/parallel-sdk-python/commit/f17e34e0e0a6d3205c344c278f1643826938e9d1))
|
|
70
|
+
|
|
71
|
+
## 0.1.0 (2025-04-24)
|
|
72
|
+
|
|
73
|
+
Full Changelog: [v0.0.1-alpha.0...v0.1.0](https://github.com/shapleyai/parallel-sdk-python/compare/v0.0.1-alpha.0...v0.1.0)
|
|
74
|
+
|
|
75
|
+
### Features
|
|
76
|
+
|
|
77
|
+
* **api:** add execute method and structured output support ([5e51379](https://github.com/shapleyai/parallel-sdk-python/commit/5e51379e3ff28bdf70a3cc9167d4413bf3e8690c))
|
|
78
|
+
* **api:** update via SDK Studio ([c393d04](https://github.com/shapleyai/parallel-sdk-python/commit/c393d048bddb554c37eb750ca57c4335243a70ed))
|
|
79
|
+
* **api:** update via SDK Studio ([6698e71](https://github.com/shapleyai/parallel-sdk-python/commit/6698e716bdddcf2146cc802cfaaa26f7ddb4d3dc))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
### Chores
|
|
83
|
+
|
|
84
|
+
* go live ([061677a](https://github.com/shapleyai/parallel-sdk-python/commit/061677a22549f3dd3d9f4591c9ccfdf71209c12e))
|
|
@@ -17,8 +17,7 @@ $ rye sync --all-features
|
|
|
17
17
|
You can then run scripts using `rye run python script.py` or by activating the virtual environment:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
|
|
21
|
-
# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work
|
|
20
|
+
# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work
|
|
22
21
|
$ source .venv/bin/activate
|
|
23
22
|
|
|
24
23
|
# now you can omit the `rye run` prefix
|
|
@@ -63,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
|
|
|
63
62
|
To install via git:
|
|
64
63
|
|
|
65
64
|
```sh
|
|
66
|
-
$ pip install git+ssh://git@github.com/
|
|
65
|
+
$ pip install git+ssh://git@github.com/parallel-web/parallel-sdk-python.git
|
|
67
66
|
```
|
|
68
67
|
|
|
69
68
|
Alternatively, you can build from source and install the wheel file:
|
|
@@ -121,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
|
|
|
121
120
|
|
|
122
121
|
### Publish with a GitHub workflow
|
|
123
122
|
|
|
124
|
-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/
|
|
123
|
+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/parallel-web/parallel-sdk-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
|
|
125
124
|
|
|
126
125
|
### Publish manually
|
|
127
126
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: parallel-web
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: The official Python library for the Parallel API
|
|
5
|
-
Project-URL: Homepage, https://github.com/
|
|
6
|
-
Project-URL: Repository, https://github.com/
|
|
5
|
+
Project-URL: Homepage, https://github.com/parallel-web/parallel-sdk-python
|
|
6
|
+
Project-URL: Repository, https://github.com/parallel-web/parallel-sdk-python
|
|
7
7
|
Author-email: Parallel <support@parallel.ai>
|
|
8
8
|
License: MIT
|
|
9
9
|
Classifier: Intended Audience :: Developers
|
|
@@ -31,7 +31,7 @@ Description-Content-Type: text/markdown
|
|
|
31
31
|
|
|
32
32
|
# Parallel Python API library
|
|
33
33
|
|
|
34
|
-
[](https://pypi.org/project/parallel-web/)
|
|
34
|
+
[>)](https://pypi.org/project/parallel-web/)
|
|
35
35
|
|
|
36
36
|
The Parallel Python library provides convenient access to the Parallel REST API from any Python 3.8+
|
|
37
37
|
application. The library includes type definitions for all request params and response fields,
|
|
@@ -42,8 +42,8 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
42
42
|
|
|
43
43
|
## Documentation
|
|
44
44
|
|
|
45
|
-
The REST API documentation can be found
|
|
46
|
-
The full API of this Python library can be found in [api.md](https://github.com/
|
|
45
|
+
The REST API documentation can be found in our [docs](https://docs.parallel.ai).
|
|
46
|
+
The full API of this Python library can be found in [api.md](https://github.com/parallel-web/parallel-sdk-python/tree/main/api.md).
|
|
47
47
|
|
|
48
48
|
## Installation
|
|
49
49
|
|
|
@@ -54,7 +54,7 @@ pip install parallel-web
|
|
|
54
54
|
|
|
55
55
|
## Usage
|
|
56
56
|
|
|
57
|
-
The full API of this library can be found in [api.md](https://github.com/
|
|
57
|
+
The full API of this library can be found in [api.md](https://github.com/parallel-web/parallel-sdk-python/tree/main/api.md).
|
|
58
58
|
|
|
59
59
|
```python
|
|
60
60
|
import os
|
|
@@ -69,7 +69,7 @@ run_result = client.task_run.execute(
|
|
|
69
69
|
processor="core",
|
|
70
70
|
output="GDP"
|
|
71
71
|
)
|
|
72
|
-
print(run_result.output)
|
|
72
|
+
print(run_result.output.parsed)
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
While you can provide an `api_key` keyword argument,
|
|
@@ -77,6 +77,11 @@ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
|
77
77
|
to add `PARALLEL_API_KEY="My API Key"` to your `.env` file
|
|
78
78
|
so that your API Key is not stored in source control.
|
|
79
79
|
|
|
80
|
+
The API also supports typed inputs and outputs via Pydantic objects. See the relevant
|
|
81
|
+
section on [convenience methods](https://github.com/parallel-web/parallel-sdk-python/tree/main/#convenience-methods).
|
|
82
|
+
|
|
83
|
+
For information on what tasks are and how to specify them, see [our docs](https://docs.parallel.ai/task-api/core-concepts/specify-a-task).
|
|
84
|
+
|
|
80
85
|
## Async usage
|
|
81
86
|
|
|
82
87
|
Simply import `AsyncParallel` instead of `Parallel` and use `await` with each API call:
|
|
@@ -97,7 +102,7 @@ async def main() -> None:
|
|
|
97
102
|
processor="core",
|
|
98
103
|
output="GDP"
|
|
99
104
|
)
|
|
100
|
-
print(run_result.output)
|
|
105
|
+
print(run_result.output.parsed)
|
|
101
106
|
|
|
102
107
|
|
|
103
108
|
if __name__ == "__main__":
|
|
@@ -106,16 +111,17 @@ if __name__ == "__main__":
|
|
|
106
111
|
|
|
107
112
|
To get the best performance out of Parallel's API, we recommend
|
|
108
113
|
using the asynchronous client, especially for executing multiple Task Runs concurrently.
|
|
109
|
-
Functionality between the synchronous and asynchronous clients is identical
|
|
114
|
+
Functionality between the synchronous and asynchronous clients is identical, including
|
|
115
|
+
the convenience methods.
|
|
110
116
|
|
|
111
117
|
## Convenience methods
|
|
112
118
|
|
|
113
119
|
### Execute
|
|
114
120
|
|
|
115
|
-
The `execute` method provides a single call
|
|
116
|
-
polling until
|
|
121
|
+
The `execute` method provides a single call that combines creating a task run,
|
|
122
|
+
polling until completion, and parsing structured outputs (if specified).
|
|
117
123
|
|
|
118
|
-
If an output type
|
|
124
|
+
If an output type that inherits from `BaseModel` is
|
|
119
125
|
specified in the call to `.execute()`, the response content will be parsed into an
|
|
120
126
|
instance of the provided output type. The parsed output can be accessed via the
|
|
121
127
|
`parsed` property on the output field of the response.
|
|
@@ -146,15 +152,15 @@ async def main() -> None:
|
|
|
146
152
|
processor="core",
|
|
147
153
|
output="GDP"
|
|
148
154
|
)
|
|
149
|
-
print(run_result.output)
|
|
155
|
+
print(run_result.output.parsed)
|
|
150
156
|
|
|
151
157
|
|
|
152
158
|
if __name__ == "__main__":
|
|
153
159
|
asyncio.run(main())
|
|
154
160
|
```
|
|
155
161
|
|
|
156
|
-
The async client
|
|
157
|
-
To
|
|
162
|
+
The async client lets you create multiple task runs without blocking.
|
|
163
|
+
To submit several at once, call `execute()` and gather the results at the end.
|
|
158
164
|
|
|
159
165
|
```python
|
|
160
166
|
import asyncio
|
|
@@ -212,9 +218,51 @@ if __name__ == "__main__":
|
|
|
212
218
|
asyncio.run(main())
|
|
213
219
|
```
|
|
214
220
|
|
|
215
|
-
|
|
221
|
+
#### `execute()` vs `create()`
|
|
222
|
+
|
|
223
|
+
The `execute` and `create` methods differ slightly in their signatures and
|
|
224
|
+
behavior — `create` requires a Task Spec object that contains the output schema,
|
|
225
|
+
while `execute` accepts an output schema as a top‑level parameter. `execute` is
|
|
226
|
+
also a one‑shot method that combines creation, polling, and parsing for you.
|
|
227
|
+
|
|
228
|
+
Use `create` when you want a run ID immediately and prefer to control polling
|
|
229
|
+
yourself. `execute` is best for one‑shot task execution and for typed inputs and
|
|
230
|
+
outputs — note that no outputs are available until the call finishes. Finally, for
|
|
231
|
+
the output of `execute`, parsed content is available via `run_result.output.parsed`.
|
|
232
|
+
|
|
233
|
+
Both `execute` and `create` validate inputs when appropriate input types are
|
|
234
|
+
provided. For `execute`, validation happens when a pydantic input is provided. For
|
|
235
|
+
`create`, validation occurs when the input schema is specified inside the task spec
|
|
236
|
+
parameter. Additionally, in both calls, the un-parsed result content is accessible via
|
|
237
|
+
the `run_result.output.content`.
|
|
238
|
+
|
|
239
|
+
## Frequently Asked Questions
|
|
240
|
+
|
|
241
|
+
**Does the Task API accept prompts or objectives?**
|
|
242
|
+
|
|
243
|
+
No, there are no `objective` or `prompt` parameters that can be specified for calls to
|
|
244
|
+
the Task API. Instead, provide any directives or instructions via the schemas. For
|
|
245
|
+
more information, check [our docs](https://docs.parallel.ai/task-api/core-concepts/specify-a-task).
|
|
246
|
+
|
|
247
|
+
**Can I access beta parameters or endpoints via the SDK?**
|
|
248
|
+
|
|
249
|
+
The SDK currently does not support beta parameters in the Task API. You can consider
|
|
250
|
+
using [custom requests](https://github.com/parallel-web/parallel-sdk-python/tree/main/#making-customundocumented-requests) in conjunction with
|
|
251
|
+
[low level APIs](https://github.com/parallel-web/parallel-sdk-python/tree/main/#lowlevel-api-access).
|
|
252
|
+
|
|
253
|
+
**Can I specify a timeout for API calls?**
|
|
254
|
+
|
|
255
|
+
Yes, all methods support a timeout. For more information, see [Timeouts](https://github.com/parallel-web/parallel-sdk-python/tree/main/#timeouts).
|
|
256
|
+
|
|
257
|
+
**Can I specify retries via the SDK?**
|
|
258
|
+
|
|
259
|
+
Yes, errors can be retried via the SDK — the default retry count is 2. The maximum number
|
|
260
|
+
of retries can be configured at the client level. For information on which errors
|
|
261
|
+
are automatically retried and how to configure retry settings, see [Retries](https://github.com/parallel-web/parallel-sdk-python/tree/main/#retries).
|
|
262
|
+
|
|
263
|
+
## Low‑level API access
|
|
216
264
|
|
|
217
|
-
The library also provides
|
|
265
|
+
The library also provides low‑level access to the Parallel API.
|
|
218
266
|
|
|
219
267
|
```python
|
|
220
268
|
from parallel import Parallel
|
|
@@ -262,13 +310,13 @@ task_run = client.task_run.create(
|
|
|
262
310
|
)
|
|
263
311
|
|
|
264
312
|
run_result = client.task_run.result(task_run.run_id)
|
|
265
|
-
print(run_result.output)
|
|
313
|
+
print(run_result.output.content)
|
|
266
314
|
```
|
|
267
315
|
|
|
268
316
|
For more information, please check out the relevant section in our docs:
|
|
269
317
|
|
|
270
|
-
- [Task Spec](https://docs.parallel.ai/core-concepts/task
|
|
271
|
-
- [Task Runs](https://docs.parallel.ai/core-concepts/task-
|
|
318
|
+
- [Task Spec](https://docs.parallel.ai/task-api/core-concepts/specify-a-task)
|
|
319
|
+
- [Task Runs](https://docs.parallel.ai/task-api/core-concepts/execute-task-run)
|
|
272
320
|
|
|
273
321
|
## Handling errors
|
|
274
322
|
|
|
@@ -343,7 +391,7 @@ client.with_options(max_retries=5).task_run.execute(
|
|
|
343
391
|
### Timeouts
|
|
344
392
|
|
|
345
393
|
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
|
346
|
-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
|
|
394
|
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
347
395
|
|
|
348
396
|
```python
|
|
349
397
|
from parallel import Parallel
|
|
@@ -369,7 +417,7 @@ client.with_options(timeout=5.0).task_run.execute(
|
|
|
369
417
|
|
|
370
418
|
On timeout, an `APITimeoutError` is thrown.
|
|
371
419
|
|
|
372
|
-
Note that requests that time out are [retried twice by default](https://github.com/
|
|
420
|
+
Note that requests that time out are [retried twice by default](https://github.com/parallel-web/parallel-sdk-python/tree/main/#retries).
|
|
373
421
|
|
|
374
422
|
## Advanced
|
|
375
423
|
|
|
@@ -416,9 +464,9 @@ task_run = response.parse() # get the object that `task_run.execute()` would ha
|
|
|
416
464
|
print(task_run.output)
|
|
417
465
|
```
|
|
418
466
|
|
|
419
|
-
These methods return an [`APIResponse`](https://github.com/
|
|
467
|
+
These methods return an [`APIResponse`](https://github.com/parallel-web/parallel-sdk-python/tree/main/src/parallel/_response.py) object.
|
|
420
468
|
|
|
421
|
-
The async client returns an [`AsyncAPIResponse`](https://github.com/
|
|
469
|
+
The async client returns an [`AsyncAPIResponse`](https://github.com/parallel-web/parallel-sdk-python/tree/main/src/parallel/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
|
|
422
470
|
|
|
423
471
|
#### `.with_streaming_response`
|
|
424
472
|
|
|
@@ -526,7 +574,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
|
|
|
526
574
|
|
|
527
575
|
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
528
576
|
|
|
529
|
-
We are keen for your feedback; please open an [issue](https://www.github.com/
|
|
577
|
+
We are keen for your feedback; please open an [issue](https://www.github.com/parallel-web/parallel-sdk-python/issues) with questions, bugs, or suggestions.
|
|
530
578
|
|
|
531
579
|
### Determining the installed version
|
|
532
580
|
|
|
@@ -545,4 +593,4 @@ Python 3.8 or higher.
|
|
|
545
593
|
|
|
546
594
|
## Contributing
|
|
547
595
|
|
|
548
|
-
See [the contributing documentation](https://github.com/
|
|
596
|
+
See [the contributing documentation](https://github.com/parallel-web/parallel-sdk-python/tree/main/./CONTRIBUTING.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Parallel Python API library
|
|
2
2
|
|
|
3
|
-
[](https://pypi.org/project/parallel-web/)
|
|
3
|
+
[>)](https://pypi.org/project/parallel-web/)
|
|
4
4
|
|
|
5
5
|
The Parallel Python library provides convenient access to the Parallel REST API from any Python 3.8+
|
|
6
6
|
application. The library includes type definitions for all request params and response fields,
|
|
@@ -11,7 +11,7 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
11
11
|
|
|
12
12
|
## Documentation
|
|
13
13
|
|
|
14
|
-
The REST API documentation can be found
|
|
14
|
+
The REST API documentation can be found in our [docs](https://docs.parallel.ai).
|
|
15
15
|
The full API of this Python library can be found in [api.md](api.md).
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
@@ -38,7 +38,7 @@ run_result = client.task_run.execute(
|
|
|
38
38
|
processor="core",
|
|
39
39
|
output="GDP"
|
|
40
40
|
)
|
|
41
|
-
print(run_result.output)
|
|
41
|
+
print(run_result.output.parsed)
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
While you can provide an `api_key` keyword argument,
|
|
@@ -46,6 +46,11 @@ we recommend using [python-dotenv](https://pypi.org/project/python-dotenv/)
|
|
|
46
46
|
to add `PARALLEL_API_KEY="My API Key"` to your `.env` file
|
|
47
47
|
so that your API Key is not stored in source control.
|
|
48
48
|
|
|
49
|
+
The API also supports typed inputs and outputs via Pydantic objects. See the relevant
|
|
50
|
+
section on [convenience methods](#convenience-methods).
|
|
51
|
+
|
|
52
|
+
For information on what tasks are and how to specify them, see [our docs](https://docs.parallel.ai/task-api/core-concepts/specify-a-task).
|
|
53
|
+
|
|
49
54
|
## Async usage
|
|
50
55
|
|
|
51
56
|
Simply import `AsyncParallel` instead of `Parallel` and use `await` with each API call:
|
|
@@ -66,7 +71,7 @@ async def main() -> None:
|
|
|
66
71
|
processor="core",
|
|
67
72
|
output="GDP"
|
|
68
73
|
)
|
|
69
|
-
print(run_result.output)
|
|
74
|
+
print(run_result.output.parsed)
|
|
70
75
|
|
|
71
76
|
|
|
72
77
|
if __name__ == "__main__":
|
|
@@ -75,16 +80,17 @@ if __name__ == "__main__":
|
|
|
75
80
|
|
|
76
81
|
To get the best performance out of Parallel's API, we recommend
|
|
77
82
|
using the asynchronous client, especially for executing multiple Task Runs concurrently.
|
|
78
|
-
Functionality between the synchronous and asynchronous clients is identical
|
|
83
|
+
Functionality between the synchronous and asynchronous clients is identical, including
|
|
84
|
+
the convenience methods.
|
|
79
85
|
|
|
80
86
|
## Convenience methods
|
|
81
87
|
|
|
82
88
|
### Execute
|
|
83
89
|
|
|
84
|
-
The `execute` method provides a single call
|
|
85
|
-
polling until
|
|
90
|
+
The `execute` method provides a single call that combines creating a task run,
|
|
91
|
+
polling until completion, and parsing structured outputs (if specified).
|
|
86
92
|
|
|
87
|
-
If an output type
|
|
93
|
+
If an output type that inherits from `BaseModel` is
|
|
88
94
|
specified in the call to `.execute()`, the response content will be parsed into an
|
|
89
95
|
instance of the provided output type. The parsed output can be accessed via the
|
|
90
96
|
`parsed` property on the output field of the response.
|
|
@@ -115,15 +121,15 @@ async def main() -> None:
|
|
|
115
121
|
processor="core",
|
|
116
122
|
output="GDP"
|
|
117
123
|
)
|
|
118
|
-
print(run_result.output)
|
|
124
|
+
print(run_result.output.parsed)
|
|
119
125
|
|
|
120
126
|
|
|
121
127
|
if __name__ == "__main__":
|
|
122
128
|
asyncio.run(main())
|
|
123
129
|
```
|
|
124
130
|
|
|
125
|
-
The async client
|
|
126
|
-
To
|
|
131
|
+
The async client lets you create multiple task runs without blocking.
|
|
132
|
+
To submit several at once, call `execute()` and gather the results at the end.
|
|
127
133
|
|
|
128
134
|
```python
|
|
129
135
|
import asyncio
|
|
@@ -181,9 +187,51 @@ if __name__ == "__main__":
|
|
|
181
187
|
asyncio.run(main())
|
|
182
188
|
```
|
|
183
189
|
|
|
184
|
-
|
|
190
|
+
#### `execute()` vs `create()`
|
|
191
|
+
|
|
192
|
+
The `execute` and `create` methods differ slightly in their signatures and
|
|
193
|
+
behavior — `create` requires a Task Spec object that contains the output schema,
|
|
194
|
+
while `execute` accepts an output schema as a top‑level parameter. `execute` is
|
|
195
|
+
also a one‑shot method that combines creation, polling, and parsing for you.
|
|
196
|
+
|
|
197
|
+
Use `create` when you want a run ID immediately and prefer to control polling
|
|
198
|
+
yourself. `execute` is best for one‑shot task execution and for typed inputs and
|
|
199
|
+
outputs — note that no outputs are available until the call finishes. Finally, for
|
|
200
|
+
the output of `execute`, parsed content is available via `run_result.output.parsed`.
|
|
201
|
+
|
|
202
|
+
Both `execute` and `create` validate inputs when appropriate input types are
|
|
203
|
+
provided. For `execute`, validation happens when a pydantic input is provided. For
|
|
204
|
+
`create`, validation occurs when the input schema is specified inside the task spec
|
|
205
|
+
parameter. Additionally, in both calls, the un-parsed result content is accessible via
|
|
206
|
+
the `run_result.output.content`.
|
|
207
|
+
|
|
208
|
+
## Frequently Asked Questions
|
|
209
|
+
|
|
210
|
+
**Does the Task API accept prompts or objectives?**
|
|
211
|
+
|
|
212
|
+
No, there are no `objective` or `prompt` parameters that can be specified for calls to
|
|
213
|
+
the Task API. Instead, provide any directives or instructions via the schemas. For
|
|
214
|
+
more information, check [our docs](https://docs.parallel.ai/task-api/core-concepts/specify-a-task).
|
|
215
|
+
|
|
216
|
+
**Can I access beta parameters or endpoints via the SDK?**
|
|
217
|
+
|
|
218
|
+
The SDK currently does not support beta parameters in the Task API. You can consider
|
|
219
|
+
using [custom requests](#making-customundocumented-requests) in conjunction with
|
|
220
|
+
[low level APIs](#lowlevel-api-access).
|
|
221
|
+
|
|
222
|
+
**Can I specify a timeout for API calls?**
|
|
223
|
+
|
|
224
|
+
Yes, all methods support a timeout. For more information, see [Timeouts](#timeouts).
|
|
225
|
+
|
|
226
|
+
**Can I specify retries via the SDK?**
|
|
227
|
+
|
|
228
|
+
Yes, errors can be retried via the SDK — the default retry count is 2. The maximum number
|
|
229
|
+
of retries can be configured at the client level. For information on which errors
|
|
230
|
+
are automatically retried and how to configure retry settings, see [Retries](#retries).
|
|
231
|
+
|
|
232
|
+
## Low‑level API access
|
|
185
233
|
|
|
186
|
-
The library also provides
|
|
234
|
+
The library also provides low‑level access to the Parallel API.
|
|
187
235
|
|
|
188
236
|
```python
|
|
189
237
|
from parallel import Parallel
|
|
@@ -231,13 +279,13 @@ task_run = client.task_run.create(
|
|
|
231
279
|
)
|
|
232
280
|
|
|
233
281
|
run_result = client.task_run.result(task_run.run_id)
|
|
234
|
-
print(run_result.output)
|
|
282
|
+
print(run_result.output.content)
|
|
235
283
|
```
|
|
236
284
|
|
|
237
285
|
For more information, please check out the relevant section in our docs:
|
|
238
286
|
|
|
239
|
-
- [Task Spec](https://docs.parallel.ai/core-concepts/task
|
|
240
|
-
- [Task Runs](https://docs.parallel.ai/core-concepts/task-
|
|
287
|
+
- [Task Spec](https://docs.parallel.ai/task-api/core-concepts/specify-a-task)
|
|
288
|
+
- [Task Runs](https://docs.parallel.ai/task-api/core-concepts/execute-task-run)
|
|
241
289
|
|
|
242
290
|
## Handling errors
|
|
243
291
|
|
|
@@ -312,7 +360,7 @@ client.with_options(max_retries=5).task_run.execute(
|
|
|
312
360
|
### Timeouts
|
|
313
361
|
|
|
314
362
|
By default requests time out after 1 minute. You can configure this with a `timeout` option,
|
|
315
|
-
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object:
|
|
363
|
+
which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object:
|
|
316
364
|
|
|
317
365
|
```python
|
|
318
366
|
from parallel import Parallel
|
|
@@ -385,9 +433,9 @@ task_run = response.parse() # get the object that `task_run.execute()` would ha
|
|
|
385
433
|
print(task_run.output)
|
|
386
434
|
```
|
|
387
435
|
|
|
388
|
-
These methods return an [`APIResponse`](https://github.com/
|
|
436
|
+
These methods return an [`APIResponse`](https://github.com/parallel-web/parallel-sdk-python/tree/main/src/parallel/_response.py) object.
|
|
389
437
|
|
|
390
|
-
The async client returns an [`AsyncAPIResponse`](https://github.com/
|
|
438
|
+
The async client returns an [`AsyncAPIResponse`](https://github.com/parallel-web/parallel-sdk-python/tree/main/src/parallel/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
|
|
391
439
|
|
|
392
440
|
#### `.with_streaming_response`
|
|
393
441
|
|
|
@@ -495,7 +543,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
|
|
|
495
543
|
|
|
496
544
|
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
|
|
497
545
|
|
|
498
|
-
We are keen for your feedback; please open an [issue](https://www.github.com/
|
|
546
|
+
We are keen for your feedback; please open an [issue](https://www.github.com/parallel-web/parallel-sdk-python/issues) with questions, bugs, or suggestions.
|
|
499
547
|
|
|
500
548
|
### Determining the installed version
|
|
501
549
|
|
|
@@ -16,11 +16,11 @@ before making any information public.
|
|
|
16
16
|
## Reporting Non-SDK Related Security Issues
|
|
17
17
|
|
|
18
18
|
If you encounter security issues that are not directly related to SDKs but pertain to the services
|
|
19
|
-
or products provided by Parallel please follow the respective company's security reporting guidelines.
|
|
19
|
+
or products provided by Parallel, please follow the respective company's security reporting guidelines.
|
|
20
20
|
|
|
21
21
|
### Parallel Terms and Policies
|
|
22
22
|
|
|
23
|
-
Please contact support@parallel.ai for any questions or concerns regarding security of our services.
|
|
23
|
+
Please contact support@parallel.ai for any questions or concerns regarding the security of our services.
|
|
24
24
|
|
|
25
25
|
---
|
|
26
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "parallel-web"
|
|
3
|
-
version = "0.1.
|
|
3
|
+
version = "0.1.3"
|
|
4
4
|
description = "The official Python library for the Parallel API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "MIT"
|
|
@@ -34,8 +34,8 @@ classifiers = [
|
|
|
34
34
|
]
|
|
35
35
|
|
|
36
36
|
[project.urls]
|
|
37
|
-
Homepage = "https://github.com/
|
|
38
|
-
Repository = "https://github.com/
|
|
37
|
+
Homepage = "https://github.com/parallel-web/parallel-sdk-python"
|
|
38
|
+
Repository = "https://github.com/parallel-web/parallel-sdk-python"
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
[tool.rye]
|
|
@@ -54,6 +54,7 @@ dev-dependencies = [
|
|
|
54
54
|
"importlib-metadata>=6.7.0",
|
|
55
55
|
"rich>=13.7.1",
|
|
56
56
|
"nest_asyncio==1.6.0",
|
|
57
|
+
"pytest-xdist>=3.6.1",
|
|
57
58
|
]
|
|
58
59
|
|
|
59
60
|
[tool.rye.scripts]
|
|
@@ -121,11 +122,11 @@ path = "README.md"
|
|
|
121
122
|
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
|
|
122
123
|
# replace relative links with absolute links
|
|
123
124
|
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
|
|
124
|
-
replacement = '[\1](https://github.com/
|
|
125
|
+
replacement = '[\1](https://github.com/parallel-web/parallel-sdk-python/tree/main/\g<2>)'
|
|
125
126
|
|
|
126
127
|
[tool.pytest.ini_options]
|
|
127
128
|
testpaths = ["tests"]
|
|
128
|
-
addopts = "--tb=short"
|
|
129
|
+
addopts = "--tb=short -n auto"
|
|
129
130
|
xfail_strict = true
|
|
130
131
|
asyncio_mode = "auto"
|
|
131
132
|
asyncio_default_fixture_loop_scope = "session"
|
|
@@ -30,6 +30,8 @@ distro==1.8.0
|
|
|
30
30
|
exceptiongroup==1.2.2
|
|
31
31
|
# via anyio
|
|
32
32
|
# via pytest
|
|
33
|
+
execnet==2.1.1
|
|
34
|
+
# via pytest-xdist
|
|
33
35
|
filelock==3.12.4
|
|
34
36
|
# via virtualenv
|
|
35
37
|
h11==0.14.0
|
|
@@ -72,7 +74,9 @@ pygments==2.18.0
|
|
|
72
74
|
pyright==1.1.399
|
|
73
75
|
pytest==8.3.3
|
|
74
76
|
# via pytest-asyncio
|
|
77
|
+
# via pytest-xdist
|
|
75
78
|
pytest-asyncio==0.24.0
|
|
79
|
+
pytest-xdist==3.7.0
|
|
76
80
|
python-dateutil==2.8.2
|
|
77
81
|
# via time-machine
|
|
78
82
|
pytz==2023.3.post1
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
+
import typing as _t
|
|
4
|
+
|
|
3
5
|
from . import types
|
|
4
6
|
from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes
|
|
5
7
|
from ._utils import file_from_path
|
|
@@ -78,6 +80,9 @@ __all__ = [
|
|
|
78
80
|
"DefaultAsyncHttpxClient",
|
|
79
81
|
]
|
|
80
82
|
|
|
83
|
+
if not _t.TYPE_CHECKING:
|
|
84
|
+
from ._utils._resources_proxy import resources as resources
|
|
85
|
+
|
|
81
86
|
_setup_logging()
|
|
82
87
|
|
|
83
88
|
# Update the __module__ attribute for exported symbols so that
|