parallel-web 0.1.2__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.2 → parallel_web-0.1.3}/CHANGELOG.md +8 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/PKG-INFO +64 -16
- {parallel_web-0.1.2 → parallel_web-0.1.3}/README.md +63 -15
- {parallel_web-0.1.2 → parallel_web-0.1.3}/pyproject.toml +1 -1
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_constants.py +2 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_version.py +1 -1
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/_time.py +2 -2
- parallel_web-0.1.2/.release-please-manifest.json +0 -3
- {parallel_web-0.1.2 → parallel_web-0.1.3}/.gitignore +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/CONTRIBUTING.md +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/LICENSE +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/SECURITY.md +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/api.md +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/bin/check-release-environment +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/bin/publish-pypi +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/examples/.keep +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/mypy.ini +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/noxfile.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/release-please-config.json +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/requirements-dev.lock +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/requirements.lock +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_base_client.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_client.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_compat.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_exceptions.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_files.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_models.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_qs.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_resource.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_response.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_streaming.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_types.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_logs.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_proxy.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_reflection.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_resources_proxy.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_streams.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_sync.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_transform.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_typing.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/_utils/_utils.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/.keep +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/_parsing/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/_parsing/_task_run_result.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/_parsing/_task_spec.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/lib/_pydantic.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/py.typed +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/resources/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/resources/task_run.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/json_schema_param.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/parsed_task_run_result.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/task_run.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/task_run_create_params.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/task_run_result.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/task_run_result_params.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/task_spec_param.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/src/parallel/types/text_schema_param.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/api_resources/__init__.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/api_resources/test_task_run.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/conftest.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/sample_file.txt +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_client.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_deepcopy.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_extract_files.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_files.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_models.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_qs.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_required_args.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_response.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_streaming.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_transform.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_utils/test_proxy.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/test_utils/test_typing.py +0 -0
- {parallel_web-0.1.2 → parallel_web-0.1.3}/tests/utils.py +0 -0
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
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
|
+
|
|
3
11
|
## 0.1.2 (2025-06-25)
|
|
4
12
|
|
|
5
13
|
Full Changelog: [v0.1.1...v0.1.2](https://github.com/parallel-web/parallel-sdk-python/compare/v0.1.1...v0.1.2)
|
|
@@ -1,6 +1,6 @@
|
|
|
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
5
|
Project-URL: Homepage, https://github.com/parallel-web/parallel-sdk-python
|
|
6
6
|
Project-URL: Repository, https://github.com/parallel-web/parallel-sdk-python
|
|
@@ -42,7 +42,7 @@ It is generated with [Stainless](https://www.stainless.com/).
|
|
|
42
42
|
|
|
43
43
|
## Documentation
|
|
44
44
|
|
|
45
|
-
The REST API documentation can be found
|
|
45
|
+
The REST API documentation can be found in our [docs](https://docs.parallel.ai).
|
|
46
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
|
|
@@ -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
|
|
|
@@ -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
|
|
|
@@ -5,6 +5,8 @@ import httpx
|
|
|
5
5
|
RAW_RESPONSE_HEADER = "X-Stainless-Raw-Response"
|
|
6
6
|
OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to"
|
|
7
7
|
|
|
8
|
+
# default timeout for execution requests which wait for results is 1 hour.
|
|
9
|
+
DEFAULT_EXECUTE_TIMEOUT_SECONDS = 3600
|
|
8
10
|
# default timeout for http requests is 10 minutes.
|
|
9
11
|
DEFAULT_TIMEOUT_SECONDS = 600
|
|
10
12
|
DEFAULT_TIMEOUT = httpx.Timeout(timeout=DEFAULT_TIMEOUT_SECONDS, connect=5.0)
|
|
@@ -5,7 +5,7 @@ from typing import Union, Iterator, NoReturn
|
|
|
5
5
|
import httpx
|
|
6
6
|
|
|
7
7
|
from .._types import NotGiven
|
|
8
|
-
from .._constants import
|
|
8
|
+
from .._constants import DEFAULT_EXECUTE_TIMEOUT_SECONDS
|
|
9
9
|
from .._exceptions import APIStatusError, APITimeoutError
|
|
10
10
|
from .._utils._utils import is_given
|
|
11
11
|
|
|
@@ -19,7 +19,7 @@ def prepare_timeout_float(timeout: Union[float, httpx.Timeout, None, NotGiven])
|
|
|
19
19
|
timeout = timeout.read
|
|
20
20
|
|
|
21
21
|
if not is_given(timeout) or timeout is None:
|
|
22
|
-
return
|
|
22
|
+
return DEFAULT_EXECUTE_TIMEOUT_SECONDS
|
|
23
23
|
|
|
24
24
|
return timeout
|
|
25
25
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|