parallel-web 0.1.3__tar.gz → 0.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.

Potentially problematic release.


This version of parallel-web might be problematic. Click here for more details.

Files changed (134) hide show
  1. {parallel_web-0.1.3 → parallel_web-0.2.0}/.gitignore +0 -1
  2. parallel_web-0.2.0/.release-please-manifest.json +3 -0
  3. {parallel_web-0.1.3 → parallel_web-0.2.0}/CHANGELOG.md +46 -0
  4. {parallel_web-0.1.3 → parallel_web-0.2.0}/PKG-INFO +23 -159
  5. {parallel_web-0.1.3 → parallel_web-0.2.0}/README.md +18 -158
  6. parallel_web-0.2.0/api.md +94 -0
  7. {parallel_web-0.1.3 → parallel_web-0.2.0}/bin/check-release-environment +1 -1
  8. {parallel_web-0.1.3 → parallel_web-0.2.0}/pyproject.toml +7 -2
  9. {parallel_web-0.1.3 → parallel_web-0.2.0}/requirements-dev.lock +32 -2
  10. {parallel_web-0.1.3 → parallel_web-0.2.0}/requirements.lock +29 -2
  11. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/__init__.py +2 -1
  12. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_base_client.py +34 -2
  13. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_client.py +9 -0
  14. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_compat.py +1 -0
  15. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_files.py +4 -4
  16. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_models.py +32 -8
  17. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_types.py +35 -1
  18. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/__init__.py +1 -0
  19. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_typing.py +5 -0
  20. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_version.py +1 -1
  21. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/_pydantic.py +1 -0
  22. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/resources/__init__.py +14 -0
  23. parallel_web-0.2.0/src/parallel/resources/beta/__init__.py +47 -0
  24. parallel_web-0.2.0/src/parallel/resources/beta/beta.py +301 -0
  25. parallel_web-0.2.0/src/parallel/resources/beta/task_group.py +632 -0
  26. parallel_web-0.2.0/src/parallel/resources/beta/task_run.py +499 -0
  27. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/resources/task_run.py +47 -18
  28. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/__init__.py +15 -0
  29. parallel_web-0.2.0/src/parallel/types/auto_schema.py +13 -0
  30. parallel_web-0.2.0/src/parallel/types/auto_schema_param.py +12 -0
  31. parallel_web-0.2.0/src/parallel/types/beta/__init__.py +30 -0
  32. parallel_web-0.2.0/src/parallel/types/beta/beta_run_input.py +63 -0
  33. parallel_web-0.2.0/src/parallel/types/beta/beta_run_input_param.py +65 -0
  34. parallel_web-0.2.0/src/parallel/types/beta/beta_search_params.py +47 -0
  35. parallel_web-0.2.0/src/parallel/types/beta/beta_task_run_result.py +74 -0
  36. parallel_web-0.2.0/src/parallel/types/beta/error_event.py +16 -0
  37. parallel_web-0.2.0/src/parallel/types/beta/mcp_server.py +25 -0
  38. parallel_web-0.2.0/src/parallel/types/beta/mcp_server_param.py +25 -0
  39. parallel_web-0.2.0/src/parallel/types/beta/mcp_tool_call.py +27 -0
  40. parallel_web-0.2.0/src/parallel/types/beta/parallel_beta_param.py +12 -0
  41. parallel_web-0.2.0/src/parallel/types/beta/search_result.py +16 -0
  42. parallel_web-0.2.0/src/parallel/types/beta/task_group.py +24 -0
  43. parallel_web-0.2.0/src/parallel/types/beta/task_group_add_runs_params.py +30 -0
  44. parallel_web-0.2.0/src/parallel/types/beta/task_group_create_params.py +13 -0
  45. parallel_web-0.2.0/src/parallel/types/beta/task_group_events_params.py +16 -0
  46. parallel_web-0.2.0/src/parallel/types/beta/task_group_events_response.py +28 -0
  47. parallel_web-0.2.0/src/parallel/types/beta/task_group_get_runs_params.py +18 -0
  48. parallel_web-0.2.0/src/parallel/types/beta/task_group_get_runs_response.py +12 -0
  49. parallel_web-0.2.0/src/parallel/types/beta/task_group_run_response.py +30 -0
  50. parallel_web-0.2.0/src/parallel/types/beta/task_group_status.py +27 -0
  51. parallel_web-0.2.0/src/parallel/types/beta/task_run_create_params.py +70 -0
  52. parallel_web-0.2.0/src/parallel/types/beta/task_run_event.py +32 -0
  53. parallel_web-0.2.0/src/parallel/types/beta/task_run_events_response.py +58 -0
  54. parallel_web-0.2.0/src/parallel/types/beta/task_run_result_params.py +18 -0
  55. parallel_web-0.2.0/src/parallel/types/beta/web_search_result.py +18 -0
  56. parallel_web-0.2.0/src/parallel/types/beta/webhook.py +16 -0
  57. parallel_web-0.2.0/src/parallel/types/beta/webhook_param.py +16 -0
  58. parallel_web-0.2.0/src/parallel/types/citation.py +21 -0
  59. parallel_web-0.2.0/src/parallel/types/field_basis.py +25 -0
  60. parallel_web-0.2.0/src/parallel/types/json_schema.py +16 -0
  61. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/json_schema_param.py +2 -1
  62. parallel_web-0.2.0/src/parallel/types/parsed_task_run_result.py +38 -0
  63. parallel_web-0.2.0/src/parallel/types/shared/__init__.py +6 -0
  64. parallel_web-0.2.0/src/parallel/types/shared/error_object.py +18 -0
  65. parallel_web-0.2.0/src/parallel/types/shared/error_response.py +16 -0
  66. parallel_web-0.2.0/src/parallel/types/shared/source_policy.py +21 -0
  67. parallel_web-0.2.0/src/parallel/types/shared/warning.py +22 -0
  68. parallel_web-0.2.0/src/parallel/types/shared_params/__init__.py +3 -0
  69. parallel_web-0.2.0/src/parallel/types/shared_params/source_policy.py +22 -0
  70. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/task_run.py +17 -18
  71. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/task_run_create_params.py +12 -3
  72. parallel_web-0.2.0/src/parallel/types/task_run_json_output.py +46 -0
  73. parallel_web-0.2.0/src/parallel/types/task_run_result.py +52 -0
  74. parallel_web-0.2.0/src/parallel/types/task_run_text_output.py +37 -0
  75. parallel_web-0.2.0/src/parallel/types/task_spec.py +31 -0
  76. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/task_spec_param.py +3 -2
  77. parallel_web-0.2.0/src/parallel/types/text_schema.py +16 -0
  78. parallel_web-0.2.0/tests/api_resources/beta/__init__.py +1 -0
  79. parallel_web-0.2.0/tests/api_resources/beta/test_task_group.py +613 -0
  80. parallel_web-0.2.0/tests/api_resources/beta/test_task_run.py +349 -0
  81. parallel_web-0.2.0/tests/api_resources/test_beta.py +104 -0
  82. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/api_resources/test_task_run.py +37 -63
  83. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/conftest.py +37 -6
  84. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_client.py +30 -12
  85. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_models.py +73 -1
  86. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/utils.py +9 -1
  87. parallel_web-0.1.3/.release-please-manifest.json +0 -3
  88. parallel_web-0.1.3/api.md +0 -18
  89. parallel_web-0.1.3/src/parallel/types/parsed_task_run_result.py +0 -29
  90. parallel_web-0.1.3/src/parallel/types/task_run_result.py +0 -122
  91. {parallel_web-0.1.3 → parallel_web-0.2.0}/CONTRIBUTING.md +0 -0
  92. {parallel_web-0.1.3 → parallel_web-0.2.0}/LICENSE +0 -0
  93. {parallel_web-0.1.3 → parallel_web-0.2.0}/SECURITY.md +0 -0
  94. {parallel_web-0.1.3 → parallel_web-0.2.0}/bin/publish-pypi +0 -0
  95. {parallel_web-0.1.3 → parallel_web-0.2.0}/examples/.keep +0 -0
  96. {parallel_web-0.1.3 → parallel_web-0.2.0}/mypy.ini +0 -0
  97. {parallel_web-0.1.3 → parallel_web-0.2.0}/noxfile.py +0 -0
  98. {parallel_web-0.1.3 → parallel_web-0.2.0}/release-please-config.json +0 -0
  99. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_constants.py +0 -0
  100. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_exceptions.py +0 -0
  101. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_qs.py +0 -0
  102. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_resource.py +0 -0
  103. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_response.py +0 -0
  104. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_streaming.py +0 -0
  105. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_logs.py +0 -0
  106. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_proxy.py +0 -0
  107. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_reflection.py +0 -0
  108. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_resources_proxy.py +0 -0
  109. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_streams.py +0 -0
  110. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_sync.py +0 -0
  111. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_transform.py +0 -0
  112. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/_utils/_utils.py +0 -0
  113. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/.keep +0 -0
  114. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/__init__.py +0 -0
  115. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/_parsing/__init__.py +0 -0
  116. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/_parsing/_task_run_result.py +0 -0
  117. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/_parsing/_task_spec.py +0 -0
  118. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/lib/_time.py +0 -0
  119. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/py.typed +0 -0
  120. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/task_run_result_params.py +0 -0
  121. {parallel_web-0.1.3 → parallel_web-0.2.0}/src/parallel/types/text_schema_param.py +0 -0
  122. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/__init__.py +0 -0
  123. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/api_resources/__init__.py +0 -0
  124. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/sample_file.txt +0 -0
  125. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_deepcopy.py +0 -0
  126. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_extract_files.py +0 -0
  127. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_files.py +0 -0
  128. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_qs.py +0 -0
  129. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_required_args.py +0 -0
  130. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_response.py +0 -0
  131. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_streaming.py +0 -0
  132. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_transform.py +0 -0
  133. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_utils/test_proxy.py +0 -0
  134. {parallel_web-0.1.3 → parallel_web-0.2.0}/tests/test_utils/test_typing.py +0 -0
@@ -1,5 +1,4 @@
1
1
  .prism.log
2
- .vscode
3
2
  _dev
4
3
 
5
4
  __pycache__
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.2.0"
3
+ }
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 (2025-09-01)
4
+
5
+ Full Changelog: [v0.1.3...v0.2.0](https://github.com/parallel-web/parallel-sdk-python/compare/v0.1.3...v0.2.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** update via SDK Studio ([b048bd7](https://github.com/parallel-web/parallel-sdk-python/commit/b048bd7e1c5a992ae274aa4b6df16a9d5b0f843e))
10
+ * **api:** update via SDK Studio ([b9abf3c](https://github.com/parallel-web/parallel-sdk-python/commit/b9abf3c8b0e22b260149f01b1ef608924eefe735))
11
+ * **api:** update via SDK Studio ([4326698](https://github.com/parallel-web/parallel-sdk-python/commit/43266988c2123fa1aff00bf0b62c355b0c2bf04e))
12
+ * clean up environment call outs ([3a102e9](https://github.com/parallel-web/parallel-sdk-python/commit/3a102e9a05476e4d28c0ac386cd156cc0fe8b5cf))
13
+ * **client:** add support for aiohttp ([4e2aa32](https://github.com/parallel-web/parallel-sdk-python/commit/4e2aa32ad8242745f56e5a8b810d33c362967dad))
14
+ * **client:** support file upload requests ([ec0c2cf](https://github.com/parallel-web/parallel-sdk-python/commit/ec0c2cf30bd24524567232ad0f661facda124203))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * add types for backwards compatibility ([c975302](https://github.com/parallel-web/parallel-sdk-python/commit/c975302c0d61d1d6731ccaeb7977c2009cb0b666))
20
+ * avoid newer type syntax ([2ea196d](https://github.com/parallel-web/parallel-sdk-python/commit/2ea196d5d4c7881e61dc848a1387770b4e27e304))
21
+ * **ci:** correct conditional ([99d37f6](https://github.com/parallel-web/parallel-sdk-python/commit/99d37f657a249987ccae60dd0e62f296ab0c1d85))
22
+ * **ci:** release-doctor — report correct token name ([310076b](https://github.com/parallel-web/parallel-sdk-python/commit/310076b2f8a75ed29ba2a1fae0f6e840ec43bb5b))
23
+ * **client:** don't send Content-Type header on GET requests ([f103b4a](https://github.com/parallel-web/parallel-sdk-python/commit/f103b4a72fc25f6a8dd1bda0c8d040aba1f527d1))
24
+ * **parsing:** correctly handle nested discriminated unions ([c9a2300](https://github.com/parallel-web/parallel-sdk-python/commit/c9a23002be2d78a11b5c1b7c901f4ddb32663393))
25
+ * **parsing:** ignore empty metadata ([ab434aa](https://github.com/parallel-web/parallel-sdk-python/commit/ab434aa7bd088fc16279255ae36138ab6dff0730))
26
+ * **parsing:** parse extra field types ([85f5cd4](https://github.com/parallel-web/parallel-sdk-python/commit/85f5cd4191ae168ed443e78a2c7bd747d51404b3))
27
+
28
+
29
+ ### Chores
30
+
31
+ * **ci:** change upload type ([40dbd3b](https://github.com/parallel-web/parallel-sdk-python/commit/40dbd3b7d5becf0fe54b62a4acd8696957380053))
32
+ * **ci:** only run for pushes and fork pull requests ([d55fbea](https://github.com/parallel-web/parallel-sdk-python/commit/d55fbea54037d2d833ecc281cbddbc8d6700d24d))
33
+ * **internal:** add Sequence related utils ([cb9a7a9](https://github.com/parallel-web/parallel-sdk-python/commit/cb9a7a905ca4a4a9ba35e540f6c47a8bf89c87d2))
34
+ * **internal:** bump pinned h11 dep ([818f1dd](https://github.com/parallel-web/parallel-sdk-python/commit/818f1ddb3ba1be6bfdb9aee1322d6a3d8a98667a))
35
+ * **internal:** change ci workflow machines ([a90da34](https://github.com/parallel-web/parallel-sdk-python/commit/a90da34910585453eac918a5f273749c00d2f743))
36
+ * **internal:** codegen related update ([47ea68b](https://github.com/parallel-web/parallel-sdk-python/commit/47ea68bd44ad52ac1c18e7215c013f408914890c))
37
+ * **internal:** fix ruff target version ([4e5dbda](https://github.com/parallel-web/parallel-sdk-python/commit/4e5dbda03907f45ac31d18d89714e86f26e79866))
38
+ * **internal:** update comment in script ([631b045](https://github.com/parallel-web/parallel-sdk-python/commit/631b045ae2f138e4c8098fafd9466451d61ca82a))
39
+ * **internal:** update pyright exclude list ([8d2fb29](https://github.com/parallel-web/parallel-sdk-python/commit/8d2fb29b5d80a2fa9ee81a6f9510134fb7bab908))
40
+ * **internal:** version bump ([90d26a5](https://github.com/parallel-web/parallel-sdk-python/commit/90d26a5e8db8bd6a27f9bbc96595da87bd7ea0f3))
41
+ * **package:** mark python 3.13 as supported ([6fa54c4](https://github.com/parallel-web/parallel-sdk-python/commit/6fa54c42a17f5e731f5e97214f0212a0828d3cb8))
42
+ * **project:** add settings file for vscode ([acdeda2](https://github.com/parallel-web/parallel-sdk-python/commit/acdeda2f1f95f5bade2da52d5a2aa8560e71369d))
43
+ * **readme:** fix version rendering on pypi ([2bf10b0](https://github.com/parallel-web/parallel-sdk-python/commit/2bf10b073ab7e015b08c106d265a9091752df51a))
44
+ * **readme:** Remove references to methods, update FAQ for beta ([cefefbf](https://github.com/parallel-web/parallel-sdk-python/commit/cefefbfccba78fdabcc925728836d70400d4e5aa))
45
+ * **tests:** skip some failing tests on the latest python versions ([13b1533](https://github.com/parallel-web/parallel-sdk-python/commit/13b153381e9b7c998a7ebef878518222678dfa83))
46
+ * update @stainless-api/prism-cli to v5.15.0 ([56b5aab](https://github.com/parallel-web/parallel-sdk-python/commit/56b5aab87a833c27b8e1a2bc7c4bf2169ee281a8))
47
+ * update github action ([3d90e19](https://github.com/parallel-web/parallel-sdk-python/commit/3d90e196184e540242fb310cc55b0219d20dff45))
48
+
3
49
  ## 0.1.3 (2025-08-09)
4
50
 
5
51
  Full Changelog: [v0.1.2...v0.1.3](https://github.com/parallel-web/parallel-sdk-python/compare/v0.1.2...v0.1.3)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: parallel-web
3
- Version: 0.1.3
3
+ Version: 0.2.0
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
@@ -18,6 +18,7 @@ Classifier: Programming Language :: Python :: 3.9
18
18
  Classifier: Programming Language :: Python :: 3.10
19
19
  Classifier: Programming Language :: Python :: 3.11
20
20
  Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
21
22
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
22
23
  Classifier: Typing :: Typed
23
24
  Requires-Python: >=3.8
@@ -27,11 +28,15 @@ Requires-Dist: httpx<1,>=0.23.0
27
28
  Requires-Dist: pydantic<3,>=1.9.0
28
29
  Requires-Dist: sniffio
29
30
  Requires-Dist: typing-extensions<5,>=4.10
31
+ Provides-Extra: aiohttp
32
+ Requires-Dist: aiohttp; extra == 'aiohttp'
33
+ Requires-Dist: httpx-aiohttp>=0.1.8; extra == 'aiohttp'
30
34
  Description-Content-Type: text/markdown
31
35
 
32
36
  # Parallel Python API library
33
37
 
34
- [![PyPI version](https://github.com/parallel-web/parallel-sdk-python/tree/main/<https://img.shields.io/pypi/v/parallel-web.svg?label=pypi%20(stable)>)](https://pypi.org/project/parallel-web/)
38
+ <!-- prettier-ignore -->
39
+ [![PyPI version](https://img.shields.io/pypi/v/parallel-web.svg?label=pypi%20(stable))](https://pypi.org/project/parallel-web/)
35
40
 
36
41
  The Parallel Python library provides convenient access to the Parallel REST API from any Python 3.8+
37
42
  application. The library includes type definitions for all request params and response fields,
@@ -64,12 +69,12 @@ client = Parallel(
64
69
  api_key=os.environ.get("PARALLEL_API_KEY"), # This is the default and can be omitted
65
70
  )
66
71
 
67
- run_result = client.task_run.execute(
72
+ task_run = client.task_run.create(
68
73
  input="France (2023)",
69
74
  processor="core",
70
- output="GDP"
71
75
  )
72
- print(run_result.output.parsed)
76
+ task_run_result = client.task_run.result(run_id=task_run.run_id)
77
+ print(task_run_result.output)
73
78
  ```
74
79
 
75
80
  While you can provide an `api_key` keyword argument,
@@ -97,12 +102,9 @@ client = AsyncParallel(
97
102
 
98
103
 
99
104
  async def main() -> None:
100
- run_result = await client.task_run.execute(
101
- input="France (2023)",
102
- processor="core",
103
- output="GDP"
104
- )
105
- print(run_result.output.parsed)
105
+ task_run = await client.task_run.create(input="France (2023)", processor="core")
106
+ run_result = await client.task_run.result(run_id=task_run.run_id)
107
+ print(run_result.output.content)
106
108
 
107
109
 
108
110
  if __name__ == "__main__":
@@ -114,128 +116,6 @@ using the asynchronous client, especially for executing multiple Task Runs concu
114
116
  Functionality between the synchronous and asynchronous clients is identical, including
115
117
  the convenience methods.
116
118
 
117
- ## Convenience methods
118
-
119
- ### Execute
120
-
121
- The `execute` method provides a single call that combines creating a task run,
122
- polling until completion, and parsing structured outputs (if specified).
123
-
124
- If an output type that inherits from `BaseModel` is
125
- specified in the call to `.execute()`, the response content will be parsed into an
126
- instance of the provided output type. The parsed output can be accessed via the
127
- `parsed` property on the output field of the response.
128
-
129
- ```python
130
- import os
131
- import asyncio
132
- from parallel import AsyncParallel
133
- from pydantic import BaseModel
134
-
135
- client = AsyncParallel()
136
-
137
- class SampleOutputStructure(BaseModel):
138
- output: str
139
-
140
- async def main() -> None:
141
- # with pydantic
142
- run_result = await client.task_run.execute(
143
- input="France (2023)",
144
- processor="core",
145
- output=SampleOutputStructure,
146
- )
147
- # parsed output of type SampleOutputStructure
148
- print(run_result.output.parsed)
149
- # without pydantic
150
- run_result = await client.task_run.execute(
151
- input="France (2023)",
152
- processor="core",
153
- output="GDP"
154
- )
155
- print(run_result.output.parsed)
156
-
157
-
158
- if __name__ == "__main__":
159
- asyncio.run(main())
160
- ```
161
-
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.
164
-
165
- ```python
166
- import asyncio
167
- import os
168
-
169
- from parallel import AsyncParallel
170
- from pydantic import BaseModel, Field
171
- from typing import List
172
-
173
- class CountryInput(BaseModel):
174
- country: str = Field(
175
- description="Name of the country to research. Must be a recognized "
176
- "sovereign nation (e.g., 'France', 'Japan')."
177
- )
178
- year: int = Field(
179
- description="Year for which to retrieve data. Must be 2000 or later. "
180
- "Use most recent full-year estimates if year is current."
181
- )
182
-
183
- class CountryOutput(BaseModel):
184
- gdp: str = Field(
185
- description="GDP in USD for the year, formatted like '$3.1 trillion (2023)'."
186
- )
187
- top_exports: List[str] = Field(
188
- description="Top 3 exported goods/services by value. Use credible sources."
189
- )
190
- top_imports: List[str] = Field(
191
- description="Top 3 imported goods/services by value. Use credible sources."
192
- )
193
-
194
- async def main():
195
- # Initialize the Parallel client
196
- client = AsyncParallel(api_key=os.environ.get("PARALLEL_API_KEY"))
197
-
198
- # Prepare structured input
199
- input_data = [
200
- CountryInput(country="France", year=2023),
201
- CountryInput(country="Germany", year=2023),
202
- CountryInput(country="Italy", year=2023)
203
- ]
204
-
205
- run_results = await asyncio.gather(*[
206
- client.task_run.execute(
207
- input=datum,
208
- output=CountryOutput,
209
- processor="core"
210
- )
211
- for datum in input_data
212
- ])
213
-
214
- for run_input, run_result in zip(input_data, run_results):
215
- print(f"Task run output for {run_input}: {run_result.output.parsed}")
216
-
217
- if __name__ == "__main__":
218
- asyncio.run(main())
219
- ```
220
-
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
119
  ## Frequently Asked Questions
240
120
 
241
121
  **Does the Task API accept prompts or objectives?**
@@ -246,9 +126,8 @@ more information, check [our docs](https://docs.parallel.ai/task-api/core-concep
246
126
 
247
127
  **Can I access beta parameters or endpoints via the SDK?**
248
128
 
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).
129
+ Yes, the SDK supports both beta endpoints and beta header parameters for the Task API.
130
+ All beta parameters are accessible via the `client.beta` namespace in the SDK.
252
131
 
253
132
  **Can I specify a timeout for API calls?**
254
133
 
@@ -334,11 +213,7 @@ from parallel import Parallel
334
213
  client = Parallel()
335
214
 
336
215
  try:
337
- client.task_run.execute(
338
- input="France (2023)",
339
- processor="core",
340
- output="GDP"
341
- )
216
+ client.task_run.create(input="France (2023)", processor="core")
342
217
  except parallel.APIConnectionError as e:
343
218
  print("The server could not be reached")
344
219
  print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -381,11 +256,7 @@ client = Parallel(
381
256
  )
382
257
 
383
258
  # Or, configure per-request:
384
- client.with_options(max_retries=5).task_run.execute(
385
- input="France (2023)",
386
- processor="core",
387
- output="GDP"
388
- )
259
+ client.with_options(max_retries=5).task_run.create(input="France (2023)", processor="core")
389
260
  ```
390
261
 
391
262
  ### Timeouts
@@ -408,11 +279,7 @@ client = Parallel(
408
279
  )
409
280
 
410
281
  # Override per-request:
411
- client.with_options(timeout=5.0).task_run.execute(
412
- input="France (2023)",
413
- processor="core",
414
- output="GDP"
415
- )
282
+ client.with_options(timeout=5.0).task_run.create(input="France (2023)", processor="core")
416
283
  ```
417
284
 
418
285
  On timeout, an `APITimeoutError` is thrown.
@@ -453,15 +320,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
453
320
  from parallel import Parallel
454
321
 
455
322
  client = Parallel()
456
- response = client.task_run.with_raw_response.execute(
323
+ response = client.task_run.with_raw_response.create(
457
324
  input="France (2023)",
458
325
  processor="core",
459
- output="GDP"
460
326
  )
461
327
  print(response.headers.get('X-My-Header'))
462
328
 
463
- task_run = response.parse() # get the object that `task_run.execute()` would have returned
464
- print(task_run.output)
329
+ task_run = response.parse()
330
+ print(task_run.run_id)
465
331
  ```
466
332
 
467
333
  These methods return an [`APIResponse`](https://github.com/parallel-web/parallel-sdk-python/tree/main/src/parallel/_response.py) object.
@@ -475,10 +341,8 @@ The above interface eagerly reads the full response body when you make the reque
475
341
  To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
476
342
 
477
343
  ```python
478
- with client.task_run.with_streaming_response.execute(
479
- input="France (2023)",
480
- processor="core",
481
- output="GDP"
344
+ with client.task_run.with_streaming_response.create(
345
+ input="France (2023)", processor="core"
482
346
  ) as response:
483
347
  print(response.headers.get("X-My-Header"))
484
348
 
@@ -1,6 +1,7 @@
1
1
  # Parallel Python API library
2
2
 
3
- [![PyPI version](<https://img.shields.io/pypi/v/parallel-web.svg?label=pypi%20(stable)>)](https://pypi.org/project/parallel-web/)
3
+ <!-- prettier-ignore -->
4
+ [![PyPI version](https://img.shields.io/pypi/v/parallel-web.svg?label=pypi%20(stable))](https://pypi.org/project/parallel-web/)
4
5
 
5
6
  The Parallel Python library provides convenient access to the Parallel REST API from any Python 3.8+
6
7
  application. The library includes type definitions for all request params and response fields,
@@ -33,12 +34,12 @@ client = Parallel(
33
34
  api_key=os.environ.get("PARALLEL_API_KEY"), # This is the default and can be omitted
34
35
  )
35
36
 
36
- run_result = client.task_run.execute(
37
+ task_run = client.task_run.create(
37
38
  input="France (2023)",
38
39
  processor="core",
39
- output="GDP"
40
40
  )
41
- print(run_result.output.parsed)
41
+ task_run_result = client.task_run.result(run_id=task_run.run_id)
42
+ print(task_run_result.output)
42
43
  ```
43
44
 
44
45
  While you can provide an `api_key` keyword argument,
@@ -66,12 +67,9 @@ client = AsyncParallel(
66
67
 
67
68
 
68
69
  async def main() -> None:
69
- run_result = await client.task_run.execute(
70
- input="France (2023)",
71
- processor="core",
72
- output="GDP"
73
- )
74
- print(run_result.output.parsed)
70
+ task_run = await client.task_run.create(input="France (2023)", processor="core")
71
+ run_result = await client.task_run.result(run_id=task_run.run_id)
72
+ print(run_result.output.content)
75
73
 
76
74
 
77
75
  if __name__ == "__main__":
@@ -83,128 +81,6 @@ using the asynchronous client, especially for executing multiple Task Runs concu
83
81
  Functionality between the synchronous and asynchronous clients is identical, including
84
82
  the convenience methods.
85
83
 
86
- ## Convenience methods
87
-
88
- ### Execute
89
-
90
- The `execute` method provides a single call that combines creating a task run,
91
- polling until completion, and parsing structured outputs (if specified).
92
-
93
- If an output type that inherits from `BaseModel` is
94
- specified in the call to `.execute()`, the response content will be parsed into an
95
- instance of the provided output type. The parsed output can be accessed via the
96
- `parsed` property on the output field of the response.
97
-
98
- ```python
99
- import os
100
- import asyncio
101
- from parallel import AsyncParallel
102
- from pydantic import BaseModel
103
-
104
- client = AsyncParallel()
105
-
106
- class SampleOutputStructure(BaseModel):
107
- output: str
108
-
109
- async def main() -> None:
110
- # with pydantic
111
- run_result = await client.task_run.execute(
112
- input="France (2023)",
113
- processor="core",
114
- output=SampleOutputStructure,
115
- )
116
- # parsed output of type SampleOutputStructure
117
- print(run_result.output.parsed)
118
- # without pydantic
119
- run_result = await client.task_run.execute(
120
- input="France (2023)",
121
- processor="core",
122
- output="GDP"
123
- )
124
- print(run_result.output.parsed)
125
-
126
-
127
- if __name__ == "__main__":
128
- asyncio.run(main())
129
- ```
130
-
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.
133
-
134
- ```python
135
- import asyncio
136
- import os
137
-
138
- from parallel import AsyncParallel
139
- from pydantic import BaseModel, Field
140
- from typing import List
141
-
142
- class CountryInput(BaseModel):
143
- country: str = Field(
144
- description="Name of the country to research. Must be a recognized "
145
- "sovereign nation (e.g., 'France', 'Japan')."
146
- )
147
- year: int = Field(
148
- description="Year for which to retrieve data. Must be 2000 or later. "
149
- "Use most recent full-year estimates if year is current."
150
- )
151
-
152
- class CountryOutput(BaseModel):
153
- gdp: str = Field(
154
- description="GDP in USD for the year, formatted like '$3.1 trillion (2023)'."
155
- )
156
- top_exports: List[str] = Field(
157
- description="Top 3 exported goods/services by value. Use credible sources."
158
- )
159
- top_imports: List[str] = Field(
160
- description="Top 3 imported goods/services by value. Use credible sources."
161
- )
162
-
163
- async def main():
164
- # Initialize the Parallel client
165
- client = AsyncParallel(api_key=os.environ.get("PARALLEL_API_KEY"))
166
-
167
- # Prepare structured input
168
- input_data = [
169
- CountryInput(country="France", year=2023),
170
- CountryInput(country="Germany", year=2023),
171
- CountryInput(country="Italy", year=2023)
172
- ]
173
-
174
- run_results = await asyncio.gather(*[
175
- client.task_run.execute(
176
- input=datum,
177
- output=CountryOutput,
178
- processor="core"
179
- )
180
- for datum in input_data
181
- ])
182
-
183
- for run_input, run_result in zip(input_data, run_results):
184
- print(f"Task run output for {run_input}: {run_result.output.parsed}")
185
-
186
- if __name__ == "__main__":
187
- asyncio.run(main())
188
- ```
189
-
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
84
  ## Frequently Asked Questions
209
85
 
210
86
  **Does the Task API accept prompts or objectives?**
@@ -215,9 +91,8 @@ more information, check [our docs](https://docs.parallel.ai/task-api/core-concep
215
91
 
216
92
  **Can I access beta parameters or endpoints via the SDK?**
217
93
 
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).
94
+ Yes, the SDK supports both beta endpoints and beta header parameters for the Task API.
95
+ All beta parameters are accessible via the `client.beta` namespace in the SDK.
221
96
 
222
97
  **Can I specify a timeout for API calls?**
223
98
 
@@ -303,11 +178,7 @@ from parallel import Parallel
303
178
  client = Parallel()
304
179
 
305
180
  try:
306
- client.task_run.execute(
307
- input="France (2023)",
308
- processor="core",
309
- output="GDP"
310
- )
181
+ client.task_run.create(input="France (2023)", processor="core")
311
182
  except parallel.APIConnectionError as e:
312
183
  print("The server could not be reached")
313
184
  print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -350,11 +221,7 @@ client = Parallel(
350
221
  )
351
222
 
352
223
  # Or, configure per-request:
353
- client.with_options(max_retries=5).task_run.execute(
354
- input="France (2023)",
355
- processor="core",
356
- output="GDP"
357
- )
224
+ client.with_options(max_retries=5).task_run.create(input="France (2023)", processor="core")
358
225
  ```
359
226
 
360
227
  ### Timeouts
@@ -377,11 +244,7 @@ client = Parallel(
377
244
  )
378
245
 
379
246
  # Override per-request:
380
- client.with_options(timeout=5.0).task_run.execute(
381
- input="France (2023)",
382
- processor="core",
383
- output="GDP"
384
- )
247
+ client.with_options(timeout=5.0).task_run.create(input="France (2023)", processor="core")
385
248
  ```
386
249
 
387
250
  On timeout, an `APITimeoutError` is thrown.
@@ -422,15 +285,14 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
422
285
  from parallel import Parallel
423
286
 
424
287
  client = Parallel()
425
- response = client.task_run.with_raw_response.execute(
288
+ response = client.task_run.with_raw_response.create(
426
289
  input="France (2023)",
427
290
  processor="core",
428
- output="GDP"
429
291
  )
430
292
  print(response.headers.get('X-My-Header'))
431
293
 
432
- task_run = response.parse() # get the object that `task_run.execute()` would have returned
433
- print(task_run.output)
294
+ task_run = response.parse()
295
+ print(task_run.run_id)
434
296
  ```
435
297
 
436
298
  These methods return an [`APIResponse`](https://github.com/parallel-web/parallel-sdk-python/tree/main/src/parallel/_response.py) object.
@@ -444,10 +306,8 @@ The above interface eagerly reads the full response body when you make the reque
444
306
  To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
445
307
 
446
308
  ```python
447
- with client.task_run.with_streaming_response.execute(
448
- input="France (2023)",
449
- processor="core",
450
- output="GDP"
309
+ with client.task_run.with_streaming_response.create(
310
+ input="France (2023)", processor="core"
451
311
  ) as response:
452
312
  print(response.headers.get("X-My-Header"))
453
313