parallel-web 0.1.3__py3-none-any.whl → 0.2.0__py3-none-any.whl
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/__init__.py +2 -1
- parallel/_base_client.py +34 -2
- parallel/_client.py +9 -0
- parallel/_compat.py +1 -0
- parallel/_files.py +4 -4
- parallel/_models.py +32 -8
- parallel/_types.py +35 -1
- parallel/_utils/__init__.py +1 -0
- parallel/_utils/_typing.py +5 -0
- parallel/_version.py +1 -1
- parallel/lib/_pydantic.py +1 -0
- parallel/resources/__init__.py +14 -0
- parallel/resources/beta/__init__.py +47 -0
- parallel/resources/beta/beta.py +301 -0
- parallel/resources/beta/task_group.py +632 -0
- parallel/resources/beta/task_run.py +499 -0
- parallel/resources/task_run.py +47 -18
- parallel/types/__init__.py +15 -0
- parallel/types/auto_schema.py +13 -0
- parallel/types/auto_schema_param.py +12 -0
- parallel/types/beta/__init__.py +30 -0
- parallel/types/beta/beta_run_input.py +63 -0
- parallel/types/beta/beta_run_input_param.py +65 -0
- parallel/types/beta/beta_search_params.py +47 -0
- parallel/types/beta/beta_task_run_result.py +74 -0
- parallel/types/beta/error_event.py +16 -0
- parallel/types/beta/mcp_server.py +25 -0
- parallel/types/beta/mcp_server_param.py +25 -0
- parallel/types/beta/mcp_tool_call.py +27 -0
- parallel/types/beta/parallel_beta_param.py +12 -0
- parallel/types/beta/search_result.py +16 -0
- parallel/types/beta/task_group.py +24 -0
- parallel/types/beta/task_group_add_runs_params.py +30 -0
- parallel/types/beta/task_group_create_params.py +13 -0
- parallel/types/beta/task_group_events_params.py +16 -0
- parallel/types/beta/task_group_events_response.py +28 -0
- parallel/types/beta/task_group_get_runs_params.py +18 -0
- parallel/types/beta/task_group_get_runs_response.py +12 -0
- parallel/types/beta/task_group_run_response.py +30 -0
- parallel/types/beta/task_group_status.py +27 -0
- parallel/types/beta/task_run_create_params.py +70 -0
- parallel/types/beta/task_run_event.py +32 -0
- parallel/types/beta/task_run_events_response.py +58 -0
- parallel/types/beta/task_run_result_params.py +18 -0
- parallel/types/beta/web_search_result.py +18 -0
- parallel/types/beta/webhook.py +16 -0
- parallel/types/beta/webhook_param.py +16 -0
- parallel/types/citation.py +21 -0
- parallel/types/field_basis.py +25 -0
- parallel/types/json_schema.py +16 -0
- parallel/types/json_schema_param.py +2 -1
- parallel/types/parsed_task_run_result.py +13 -4
- parallel/types/shared/__init__.py +6 -0
- parallel/types/shared/error_object.py +18 -0
- parallel/types/shared/error_response.py +16 -0
- parallel/types/shared/source_policy.py +21 -0
- parallel/types/shared/warning.py +22 -0
- parallel/types/shared_params/__init__.py +3 -0
- parallel/types/shared_params/source_policy.py +22 -0
- parallel/types/task_run.py +17 -18
- parallel/types/task_run_create_params.py +12 -3
- parallel/types/task_run_json_output.py +46 -0
- parallel/types/task_run_result.py +24 -94
- parallel/types/task_run_text_output.py +37 -0
- parallel/types/task_spec.py +31 -0
- parallel/types/task_spec_param.py +3 -2
- parallel/types/text_schema.py +16 -0
- {parallel_web-0.1.3.dist-info → parallel_web-0.2.0.dist-info}/METADATA +23 -159
- parallel_web-0.2.0.dist-info/RECORD +94 -0
- parallel_web-0.1.3.dist-info/RECORD +0 -47
- {parallel_web-0.1.3.dist-info → parallel_web-0.2.0.dist-info}/WHEEL +0 -0
- {parallel_web-0.1.3.dist-info → parallel_web-0.2.0.dist-info}/licenses/LICENSE +0 -0
parallel/resources/task_run.py
CHANGED
|
@@ -31,6 +31,7 @@ from ..lib._parsing._task_run_result import (
|
|
|
31
31
|
wait_for_result_async as _wait_for_result_async,
|
|
32
32
|
task_run_result_parser,
|
|
33
33
|
)
|
|
34
|
+
from ..types.shared_params.source_policy import SourcePolicy
|
|
34
35
|
|
|
35
36
|
__all__ = ["TaskRunResource", "AsyncTaskRunResource"]
|
|
36
37
|
|
|
@@ -58,9 +59,10 @@ class TaskRunResource(SyncAPIResource):
|
|
|
58
59
|
def create(
|
|
59
60
|
self,
|
|
60
61
|
*,
|
|
61
|
-
input: Union[str, object],
|
|
62
|
+
input: Union[str, Dict[str, object]],
|
|
62
63
|
processor: str,
|
|
63
64
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
65
|
+
source_policy: Optional[SourcePolicy] | NotGiven = NOT_GIVEN,
|
|
64
66
|
task_spec: Optional[TaskSpecParam] | NotGiven = NOT_GIVEN,
|
|
65
67
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
68
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -70,7 +72,11 @@ class TaskRunResource(SyncAPIResource):
|
|
|
70
72
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
71
73
|
) -> TaskRun:
|
|
72
74
|
"""
|
|
73
|
-
Initiates a
|
|
75
|
+
Initiates a task run.
|
|
76
|
+
|
|
77
|
+
Returns immediately with a run object in status 'queued'.
|
|
78
|
+
|
|
79
|
+
Beta features can be enabled by setting the 'parallel-beta' header.
|
|
74
80
|
|
|
75
81
|
Args:
|
|
76
82
|
input: Input to the task, either text or a JSON object.
|
|
@@ -80,10 +86,16 @@ class TaskRunResource(SyncAPIResource):
|
|
|
80
86
|
metadata: User-provided metadata stored with the run. Keys and values must be strings with
|
|
81
87
|
a maximum length of 16 and 512 characters respectively.
|
|
82
88
|
|
|
89
|
+
source_policy: Source policy for web search results.
|
|
90
|
+
|
|
91
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
92
|
+
|
|
83
93
|
task_spec: Specification for a task.
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
96
|
+
Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
97
|
+
|
|
98
|
+
For convenience bare strings are also accepted as input or output schemas.
|
|
87
99
|
|
|
88
100
|
extra_headers: Send extra headers
|
|
89
101
|
|
|
@@ -100,6 +112,7 @@ class TaskRunResource(SyncAPIResource):
|
|
|
100
112
|
"input": input,
|
|
101
113
|
"processor": processor,
|
|
102
114
|
"metadata": metadata,
|
|
115
|
+
"source_policy": source_policy,
|
|
103
116
|
"task_spec": task_spec,
|
|
104
117
|
},
|
|
105
118
|
task_run_create_params.TaskRunCreateParams,
|
|
@@ -122,7 +135,9 @@ class TaskRunResource(SyncAPIResource):
|
|
|
122
135
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
123
136
|
) -> TaskRun:
|
|
124
137
|
"""
|
|
125
|
-
Retrieves
|
|
138
|
+
Retrieves run status by run_id.
|
|
139
|
+
|
|
140
|
+
The run result is available from the `/result` endpoint.
|
|
126
141
|
|
|
127
142
|
Args:
|
|
128
143
|
extra_headers: Send extra headers
|
|
@@ -156,7 +171,7 @@ class TaskRunResource(SyncAPIResource):
|
|
|
156
171
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
157
172
|
) -> TaskRunResult:
|
|
158
173
|
"""
|
|
159
|
-
Retrieves a run by run_id, blocking until the run is completed.
|
|
174
|
+
Retrieves a run result by run_id, blocking until the run is completed.
|
|
160
175
|
|
|
161
176
|
Args:
|
|
162
177
|
extra_headers: Send extra headers
|
|
@@ -212,7 +227,7 @@ class TaskRunResource(SyncAPIResource):
|
|
|
212
227
|
def execute(
|
|
213
228
|
self,
|
|
214
229
|
*,
|
|
215
|
-
input: Union[str, object],
|
|
230
|
+
input: Union[str, Dict[str, object]],
|
|
216
231
|
processor: str,
|
|
217
232
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
218
233
|
output: Optional[OutputSchema] | NotGiven = NOT_GIVEN,
|
|
@@ -227,7 +242,7 @@ class TaskRunResource(SyncAPIResource):
|
|
|
227
242
|
def execute(
|
|
228
243
|
self,
|
|
229
244
|
*,
|
|
230
|
-
input: Union[str, object],
|
|
245
|
+
input: Union[str, Dict[str, object]],
|
|
231
246
|
processor: str,
|
|
232
247
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
233
248
|
output: Type[OutputT],
|
|
@@ -241,7 +256,7 @@ class TaskRunResource(SyncAPIResource):
|
|
|
241
256
|
def execute(
|
|
242
257
|
self,
|
|
243
258
|
*,
|
|
244
|
-
input: Union[str, object],
|
|
259
|
+
input: Union[str, Dict[str, object]],
|
|
245
260
|
processor: str,
|
|
246
261
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
247
262
|
output: Optional[OutputSchema] | Type[OutputT] | NotGiven = NOT_GIVEN,
|
|
@@ -333,9 +348,10 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
333
348
|
async def create(
|
|
334
349
|
self,
|
|
335
350
|
*,
|
|
336
|
-
input: Union[str, object],
|
|
351
|
+
input: Union[str, Dict[str, object]],
|
|
337
352
|
processor: str,
|
|
338
353
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
354
|
+
source_policy: Optional[SourcePolicy] | NotGiven = NOT_GIVEN,
|
|
339
355
|
task_spec: Optional[TaskSpecParam] | NotGiven = NOT_GIVEN,
|
|
340
356
|
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
341
357
|
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
@@ -345,7 +361,11 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
345
361
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
346
362
|
) -> TaskRun:
|
|
347
363
|
"""
|
|
348
|
-
Initiates a
|
|
364
|
+
Initiates a task run.
|
|
365
|
+
|
|
366
|
+
Returns immediately with a run object in status 'queued'.
|
|
367
|
+
|
|
368
|
+
Beta features can be enabled by setting the 'parallel-beta' header.
|
|
349
369
|
|
|
350
370
|
Args:
|
|
351
371
|
input: Input to the task, either text or a JSON object.
|
|
@@ -355,10 +375,16 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
355
375
|
metadata: User-provided metadata stored with the run. Keys and values must be strings with
|
|
356
376
|
a maximum length of 16 and 512 characters respectively.
|
|
357
377
|
|
|
378
|
+
source_policy: Source policy for web search results.
|
|
379
|
+
|
|
380
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
381
|
+
|
|
358
382
|
task_spec: Specification for a task.
|
|
359
383
|
|
|
360
|
-
|
|
361
|
-
|
|
384
|
+
Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
385
|
+
Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
386
|
+
|
|
387
|
+
For convenience bare strings are also accepted as input or output schemas.
|
|
362
388
|
|
|
363
389
|
extra_headers: Send extra headers
|
|
364
390
|
|
|
@@ -375,6 +401,7 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
375
401
|
"input": input,
|
|
376
402
|
"processor": processor,
|
|
377
403
|
"metadata": metadata,
|
|
404
|
+
"source_policy": source_policy,
|
|
378
405
|
"task_spec": task_spec,
|
|
379
406
|
},
|
|
380
407
|
task_run_create_params.TaskRunCreateParams,
|
|
@@ -397,7 +424,9 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
397
424
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
398
425
|
) -> TaskRun:
|
|
399
426
|
"""
|
|
400
|
-
Retrieves
|
|
427
|
+
Retrieves run status by run_id.
|
|
428
|
+
|
|
429
|
+
The run result is available from the `/result` endpoint.
|
|
401
430
|
|
|
402
431
|
Args:
|
|
403
432
|
extra_headers: Send extra headers
|
|
@@ -431,7 +460,7 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
431
460
|
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
432
461
|
) -> TaskRunResult:
|
|
433
462
|
"""
|
|
434
|
-
Retrieves a run by run_id, blocking until the run is completed.
|
|
463
|
+
Retrieves a run result by run_id, blocking until the run is completed.
|
|
435
464
|
|
|
436
465
|
Args:
|
|
437
466
|
extra_headers: Send extra headers
|
|
@@ -489,7 +518,7 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
489
518
|
async def execute(
|
|
490
519
|
self,
|
|
491
520
|
*,
|
|
492
|
-
input: Union[str, object],
|
|
521
|
+
input: Union[str, Dict[str, object]],
|
|
493
522
|
processor: str,
|
|
494
523
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
495
524
|
output: Optional[OutputSchema] | NotGiven = NOT_GIVEN,
|
|
@@ -502,7 +531,7 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
502
531
|
async def execute(
|
|
503
532
|
self,
|
|
504
533
|
*,
|
|
505
|
-
input: Union[str, object],
|
|
534
|
+
input: Union[str, Dict[str, object]],
|
|
506
535
|
processor: str,
|
|
507
536
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
508
537
|
output: Type[OutputT],
|
|
@@ -514,7 +543,7 @@ class AsyncTaskRunResource(AsyncAPIResource):
|
|
|
514
543
|
async def execute(
|
|
515
544
|
self,
|
|
516
545
|
*,
|
|
517
|
-
input: Union[str, object],
|
|
546
|
+
input: Union[str, Dict[str, object]],
|
|
518
547
|
processor: str,
|
|
519
548
|
metadata: Optional[Dict[str, Union[str, float, bool]]] | NotGiven = NOT_GIVEN,
|
|
520
549
|
output: Optional[OutputSchema] | Type[OutputT] | NotGiven = NOT_GIVEN,
|
parallel/types/__init__.py
CHANGED
|
@@ -2,11 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
5
|
+
from .shared import (
|
|
6
|
+
Warning as Warning,
|
|
7
|
+
ErrorObject as ErrorObject,
|
|
8
|
+
SourcePolicy as SourcePolicy,
|
|
9
|
+
ErrorResponse as ErrorResponse,
|
|
10
|
+
)
|
|
11
|
+
from .citation import Citation as Citation
|
|
5
12
|
from .task_run import TaskRun as TaskRun
|
|
13
|
+
from .task_spec import TaskSpec as TaskSpec
|
|
14
|
+
from .auto_schema import AutoSchema as AutoSchema
|
|
15
|
+
from .field_basis import FieldBasis as FieldBasis
|
|
16
|
+
from .json_schema import JsonSchema as JsonSchema
|
|
17
|
+
from .text_schema import TextSchema as TextSchema
|
|
6
18
|
from .task_run_result import TaskRunResult as TaskRunResult
|
|
7
19
|
from .task_spec_param import TaskSpecParam as TaskSpecParam
|
|
20
|
+
from .auto_schema_param import AutoSchemaParam as AutoSchemaParam
|
|
8
21
|
from .json_schema_param import JsonSchemaParam as JsonSchemaParam
|
|
9
22
|
from .text_schema_param import TextSchemaParam as TextSchemaParam
|
|
23
|
+
from .task_run_json_output import TaskRunJsonOutput as TaskRunJsonOutput
|
|
24
|
+
from .task_run_text_output import TaskRunTextOutput as TaskRunTextOutput
|
|
10
25
|
from .parsed_task_run_result import ParsedTaskRunResult as ParsedTaskRunResult
|
|
11
26
|
from .task_run_create_params import TaskRunCreateParams as TaskRunCreateParams
|
|
12
27
|
from .task_run_result_params import TaskRunResultParams as TaskRunResultParams
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from .._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["AutoSchema"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AutoSchema(BaseModel):
|
|
12
|
+
type: Optional[Literal["auto"]] = None
|
|
13
|
+
"""The type of schema being defined. Always `auto`."""
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing_extensions import Literal, TypedDict
|
|
6
|
+
|
|
7
|
+
__all__ = ["AutoSchemaParam"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class AutoSchemaParam(TypedDict, total=False):
|
|
11
|
+
type: Literal["auto"]
|
|
12
|
+
"""The type of schema being defined. Always `auto`."""
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .webhook import Webhook as Webhook
|
|
6
|
+
from .mcp_server import McpServer as McpServer
|
|
7
|
+
from .task_group import TaskGroup as TaskGroup
|
|
8
|
+
from .error_event import ErrorEvent as ErrorEvent
|
|
9
|
+
from .mcp_tool_call import McpToolCall as McpToolCall
|
|
10
|
+
from .search_result import SearchResult as SearchResult
|
|
11
|
+
from .webhook_param import WebhookParam as WebhookParam
|
|
12
|
+
from .beta_run_input import BetaRunInput as BetaRunInput
|
|
13
|
+
from .task_run_event import TaskRunEvent as TaskRunEvent
|
|
14
|
+
from .mcp_server_param import McpServerParam as McpServerParam
|
|
15
|
+
from .task_group_status import TaskGroupStatus as TaskGroupStatus
|
|
16
|
+
from .web_search_result import WebSearchResult as WebSearchResult
|
|
17
|
+
from .beta_search_params import BetaSearchParams as BetaSearchParams
|
|
18
|
+
from .parallel_beta_param import ParallelBetaParam as ParallelBetaParam
|
|
19
|
+
from .beta_run_input_param import BetaRunInputParam as BetaRunInputParam
|
|
20
|
+
from .beta_task_run_result import BetaTaskRunResult as BetaTaskRunResult
|
|
21
|
+
from .task_run_create_params import TaskRunCreateParams as TaskRunCreateParams
|
|
22
|
+
from .task_run_result_params import TaskRunResultParams as TaskRunResultParams
|
|
23
|
+
from .task_group_run_response import TaskGroupRunResponse as TaskGroupRunResponse
|
|
24
|
+
from .task_group_create_params import TaskGroupCreateParams as TaskGroupCreateParams
|
|
25
|
+
from .task_group_events_params import TaskGroupEventsParams as TaskGroupEventsParams
|
|
26
|
+
from .task_run_events_response import TaskRunEventsResponse as TaskRunEventsResponse
|
|
27
|
+
from .task_group_add_runs_params import TaskGroupAddRunsParams as TaskGroupAddRunsParams
|
|
28
|
+
from .task_group_events_response import TaskGroupEventsResponse as TaskGroupEventsResponse
|
|
29
|
+
from .task_group_get_runs_params import TaskGroupGetRunsParams as TaskGroupGetRunsParams
|
|
30
|
+
from .task_group_get_runs_response import TaskGroupGetRunsResponse as TaskGroupGetRunsResponse
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Union, Optional
|
|
4
|
+
|
|
5
|
+
from .webhook import Webhook
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
from ..task_spec import TaskSpec
|
|
8
|
+
from .mcp_server import McpServer
|
|
9
|
+
from ..shared.source_policy import SourcePolicy
|
|
10
|
+
|
|
11
|
+
__all__ = ["BetaRunInput"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BetaRunInput(BaseModel):
|
|
15
|
+
input: Union[str, Dict[str, object]]
|
|
16
|
+
"""Input to the task, either text or a JSON object."""
|
|
17
|
+
|
|
18
|
+
processor: str
|
|
19
|
+
"""Processor to use for the task."""
|
|
20
|
+
|
|
21
|
+
enable_events: Optional[bool] = None
|
|
22
|
+
"""Controls tracking of task run execution progress.
|
|
23
|
+
|
|
24
|
+
When set to true, progress events are recorded and can be accessed via the
|
|
25
|
+
[Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
|
|
26
|
+
false, no progress events are tracked. Note that progress tracking cannot be
|
|
27
|
+
enabled after a run has been created. The flag is set to true by default for
|
|
28
|
+
premium processors (pro and above). This feature is not available via the Python
|
|
29
|
+
SDK. To enable this feature in your API requests, specify the `parallel-beta`
|
|
30
|
+
header with `events-sse-2025-07-24` value.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
mcp_servers: Optional[List[McpServer]] = None
|
|
34
|
+
"""
|
|
35
|
+
Optional list of MCP servers to use for the run. This feature is not available
|
|
36
|
+
via the Python SDK. To enable this feature in your API requests, specify the
|
|
37
|
+
`parallel-beta` header with `mcp-server-2025-07-17` value.
|
|
38
|
+
"""
|
|
39
|
+
|
|
40
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]] = None
|
|
41
|
+
"""User-provided metadata stored with the run.
|
|
42
|
+
|
|
43
|
+
Keys and values must be strings with a maximum length of 16 and 512 characters
|
|
44
|
+
respectively.
|
|
45
|
+
"""
|
|
46
|
+
|
|
47
|
+
source_policy: Optional[SourcePolicy] = None
|
|
48
|
+
"""Source policy for web search results.
|
|
49
|
+
|
|
50
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
51
|
+
"""
|
|
52
|
+
|
|
53
|
+
task_spec: Optional[TaskSpec] = None
|
|
54
|
+
"""Specification for a task.
|
|
55
|
+
|
|
56
|
+
Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
57
|
+
Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
58
|
+
|
|
59
|
+
For convenience bare strings are also accepted as input or output schemas.
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
webhook: Optional[Webhook] = None
|
|
63
|
+
"""Webhooks for Task Runs."""
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, Union, Iterable, Optional
|
|
6
|
+
from typing_extensions import Required, TypedDict
|
|
7
|
+
|
|
8
|
+
from .webhook_param import WebhookParam
|
|
9
|
+
from ..task_spec_param import TaskSpecParam
|
|
10
|
+
from .mcp_server_param import McpServerParam
|
|
11
|
+
from ..shared_params.source_policy import SourcePolicy
|
|
12
|
+
|
|
13
|
+
__all__ = ["BetaRunInputParam"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class BetaRunInputParam(TypedDict, total=False):
|
|
17
|
+
input: Required[Union[str, Dict[str, object]]]
|
|
18
|
+
"""Input to the task, either text or a JSON object."""
|
|
19
|
+
|
|
20
|
+
processor: Required[str]
|
|
21
|
+
"""Processor to use for the task."""
|
|
22
|
+
|
|
23
|
+
enable_events: Optional[bool]
|
|
24
|
+
"""Controls tracking of task run execution progress.
|
|
25
|
+
|
|
26
|
+
When set to true, progress events are recorded and can be accessed via the
|
|
27
|
+
[Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
|
|
28
|
+
false, no progress events are tracked. Note that progress tracking cannot be
|
|
29
|
+
enabled after a run has been created. The flag is set to true by default for
|
|
30
|
+
premium processors (pro and above). This feature is not available via the Python
|
|
31
|
+
SDK. To enable this feature in your API requests, specify the `parallel-beta`
|
|
32
|
+
header with `events-sse-2025-07-24` value.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
mcp_servers: Optional[Iterable[McpServerParam]]
|
|
36
|
+
"""
|
|
37
|
+
Optional list of MCP servers to use for the run. This feature is not available
|
|
38
|
+
via the Python SDK. To enable this feature in your API requests, specify the
|
|
39
|
+
`parallel-beta` header with `mcp-server-2025-07-17` value.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
metadata: Optional[Dict[str, Union[str, float, bool]]]
|
|
43
|
+
"""User-provided metadata stored with the run.
|
|
44
|
+
|
|
45
|
+
Keys and values must be strings with a maximum length of 16 and 512 characters
|
|
46
|
+
respectively.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
source_policy: Optional[SourcePolicy]
|
|
50
|
+
"""Source policy for web search results.
|
|
51
|
+
|
|
52
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
task_spec: Optional[TaskSpecParam]
|
|
56
|
+
"""Specification for a task.
|
|
57
|
+
|
|
58
|
+
Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
59
|
+
Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
60
|
+
|
|
61
|
+
For convenience bare strings are also accepted as input or output schemas.
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
webhook: Optional[WebhookParam]
|
|
65
|
+
"""Webhooks for Task Runs."""
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List, Optional
|
|
6
|
+
from typing_extensions import Literal, TypedDict
|
|
7
|
+
|
|
8
|
+
from ..shared_params.source_policy import SourcePolicy
|
|
9
|
+
|
|
10
|
+
__all__ = ["BetaSearchParams"]
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BetaSearchParams(TypedDict, total=False):
|
|
14
|
+
max_chars_per_result: Optional[int]
|
|
15
|
+
"""
|
|
16
|
+
Upper bound on the number of characters to include in excerpts for each search
|
|
17
|
+
result.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
max_results: Optional[int]
|
|
21
|
+
"""Upper bound on the number of results to return.
|
|
22
|
+
|
|
23
|
+
May be limited by the processor. Defaults to 10 if not provided.
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
objective: Optional[str]
|
|
27
|
+
"""Natural-language description of what the web search is trying to find.
|
|
28
|
+
|
|
29
|
+
May include guidance about preferred sources or freshness. At least one of
|
|
30
|
+
objective or search_queries must be provided.
|
|
31
|
+
"""
|
|
32
|
+
|
|
33
|
+
processor: Literal["base", "pro"]
|
|
34
|
+
"""Search processor."""
|
|
35
|
+
|
|
36
|
+
search_queries: Optional[List[str]]
|
|
37
|
+
"""Optional list of traditional keyword search queries to guide the search.
|
|
38
|
+
|
|
39
|
+
May contain search operators. At least one of objective or search_queries must
|
|
40
|
+
be provided.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
source_policy: Optional[SourcePolicy]
|
|
44
|
+
"""Source policy for web search results.
|
|
45
|
+
|
|
46
|
+
This policy governs which sources are allowed/disallowed in results.
|
|
47
|
+
"""
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Union, Optional
|
|
4
|
+
from typing_extensions import Literal, Annotated, TypeAlias
|
|
5
|
+
|
|
6
|
+
from ..._utils import PropertyInfo
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
from ..task_run import TaskRun
|
|
9
|
+
from ..field_basis import FieldBasis
|
|
10
|
+
from .mcp_tool_call import McpToolCall
|
|
11
|
+
|
|
12
|
+
__all__ = ["BetaTaskRunResult", "Output", "OutputBetaTaskRunTextOutput", "OutputBetaTaskRunJsonOutput"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class OutputBetaTaskRunTextOutput(BaseModel):
|
|
16
|
+
basis: List[FieldBasis]
|
|
17
|
+
"""Basis for the output."""
|
|
18
|
+
|
|
19
|
+
content: str
|
|
20
|
+
"""Text output from the task."""
|
|
21
|
+
|
|
22
|
+
type: Literal["text"]
|
|
23
|
+
"""
|
|
24
|
+
The type of output being returned, as determined by the output schema of the
|
|
25
|
+
task spec.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
beta_fields: Optional[Dict[str, object]] = None
|
|
29
|
+
"""Always None."""
|
|
30
|
+
|
|
31
|
+
mcp_tool_calls: Optional[List[McpToolCall]] = None
|
|
32
|
+
"""MCP tool calls made by the task."""
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class OutputBetaTaskRunJsonOutput(BaseModel):
|
|
36
|
+
basis: List[FieldBasis]
|
|
37
|
+
"""Basis for the output."""
|
|
38
|
+
|
|
39
|
+
content: Dict[str, object]
|
|
40
|
+
"""
|
|
41
|
+
Output from the task as a native JSON object, as determined by the output schema
|
|
42
|
+
of the task spec.
|
|
43
|
+
"""
|
|
44
|
+
|
|
45
|
+
type: Literal["json"]
|
|
46
|
+
"""
|
|
47
|
+
The type of output being returned, as determined by the output schema of the
|
|
48
|
+
task spec.
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
beta_fields: Optional[Dict[str, object]] = None
|
|
52
|
+
"""Always None."""
|
|
53
|
+
|
|
54
|
+
mcp_tool_calls: Optional[List[McpToolCall]] = None
|
|
55
|
+
"""MCP tool calls made by the task."""
|
|
56
|
+
|
|
57
|
+
output_schema: Optional[Dict[str, object]] = None
|
|
58
|
+
"""Output schema for the Task Run.
|
|
59
|
+
|
|
60
|
+
Populated only if the task was executed with an auto schema.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
Output: TypeAlias = Annotated[
|
|
65
|
+
Union[OutputBetaTaskRunTextOutput, OutputBetaTaskRunJsonOutput], PropertyInfo(discriminator="type")
|
|
66
|
+
]
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class BetaTaskRunResult(BaseModel):
|
|
70
|
+
output: Output
|
|
71
|
+
"""Output from the task conforming to the output schema."""
|
|
72
|
+
|
|
73
|
+
run: TaskRun
|
|
74
|
+
"""Status of a task run."""
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing_extensions import Literal
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
from ..shared.error_object import ErrorObject
|
|
7
|
+
|
|
8
|
+
__all__ = ["ErrorEvent"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ErrorEvent(BaseModel):
|
|
12
|
+
error: ErrorObject
|
|
13
|
+
"""An error message."""
|
|
14
|
+
|
|
15
|
+
type: Literal["error"]
|
|
16
|
+
"""Event type; always 'error'."""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Dict, List, Optional
|
|
4
|
+
from typing_extensions import Literal
|
|
5
|
+
|
|
6
|
+
from ..._models import BaseModel
|
|
7
|
+
|
|
8
|
+
__all__ = ["McpServer"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class McpServer(BaseModel):
|
|
12
|
+
name: str
|
|
13
|
+
"""Name of the MCP server."""
|
|
14
|
+
|
|
15
|
+
url: str
|
|
16
|
+
"""URL of the MCP server."""
|
|
17
|
+
|
|
18
|
+
allowed_tools: Optional[List[str]] = None
|
|
19
|
+
"""List of allowed tools for the MCP server."""
|
|
20
|
+
|
|
21
|
+
headers: Optional[Dict[str, str]] = None
|
|
22
|
+
"""Headers for the MCP server."""
|
|
23
|
+
|
|
24
|
+
type: Optional[Literal["url"]] = None
|
|
25
|
+
"""Type of MCP server being configured. Always `url`."""
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Dict, List, Optional
|
|
6
|
+
from typing_extensions import Literal, Required, TypedDict
|
|
7
|
+
|
|
8
|
+
__all__ = ["McpServerParam"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class McpServerParam(TypedDict, total=False):
|
|
12
|
+
name: Required[str]
|
|
13
|
+
"""Name of the MCP server."""
|
|
14
|
+
|
|
15
|
+
url: Required[str]
|
|
16
|
+
"""URL of the MCP server."""
|
|
17
|
+
|
|
18
|
+
allowed_tools: Optional[List[str]]
|
|
19
|
+
"""List of allowed tools for the MCP server."""
|
|
20
|
+
|
|
21
|
+
headers: Optional[Dict[str, str]]
|
|
22
|
+
"""Headers for the MCP server."""
|
|
23
|
+
|
|
24
|
+
type: Literal["url"]
|
|
25
|
+
"""Type of MCP server being configured. Always `url`."""
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import Optional
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
|
|
7
|
+
__all__ = ["McpToolCall"]
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class McpToolCall(BaseModel):
|
|
11
|
+
arguments: str
|
|
12
|
+
"""Arguments used to call the MCP tool."""
|
|
13
|
+
|
|
14
|
+
server_name: str
|
|
15
|
+
"""Name of the MCP server."""
|
|
16
|
+
|
|
17
|
+
tool_call_id: str
|
|
18
|
+
"""Identifier for the tool call."""
|
|
19
|
+
|
|
20
|
+
tool_name: str
|
|
21
|
+
"""Name of the tool being called."""
|
|
22
|
+
|
|
23
|
+
content: Optional[str] = None
|
|
24
|
+
"""Output received from the tool call, if successful."""
|
|
25
|
+
|
|
26
|
+
error: Optional[str] = None
|
|
27
|
+
"""Error message if the tool call failed."""
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Union
|
|
6
|
+
from typing_extensions import Literal, TypeAlias
|
|
7
|
+
|
|
8
|
+
__all__ = ["ParallelBetaParam"]
|
|
9
|
+
|
|
10
|
+
ParallelBetaParam: TypeAlias = Union[
|
|
11
|
+
Literal["mcp-server-2025-07-17", "events-sse-2025-07-24", "webhook-2025-08-12"], str
|
|
12
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List
|
|
4
|
+
|
|
5
|
+
from ..._models import BaseModel
|
|
6
|
+
from .web_search_result import WebSearchResult
|
|
7
|
+
|
|
8
|
+
__all__ = ["SearchResult"]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class SearchResult(BaseModel):
|
|
12
|
+
results: List[WebSearchResult]
|
|
13
|
+
"""A list of WebSearchResult objects, ordered by decreasing relevance."""
|
|
14
|
+
|
|
15
|
+
search_id: str
|
|
16
|
+
"""Search ID. Example: `search_cad0a6d2-dec0-46bd-95ae-900527d880e7`"""
|