parallel-web 0.3.2 → 0.4.1
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.
- package/CHANGELOG.md +54 -0
- package/client.d.mts +44 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +44 -2
- package/client.d.ts.map +1 -1
- package/client.js +43 -0
- package/client.js.map +1 -1
- package/client.mjs +43 -0
- package/client.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +12 -1
- package/resources/beta/beta.d.mts +42 -61
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +42 -61
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +3 -2
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +3 -2
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/findall.d.mts +167 -8
- package/resources/beta/findall.d.mts.map +1 -1
- package/resources/beta/findall.d.ts +167 -8
- package/resources/beta/findall.d.ts.map +1 -1
- package/resources/beta/findall.js +108 -0
- package/resources/beta/findall.js.map +1 -1
- package/resources/beta/findall.mjs +108 -0
- package/resources/beta/findall.mjs.map +1 -1
- package/resources/beta/index.d.mts +2 -2
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/task-group.d.mts +50 -5
- package/resources/beta/task-group.d.mts.map +1 -1
- package/resources/beta/task-group.d.ts +50 -5
- package/resources/beta/task-group.d.ts.map +1 -1
- package/resources/beta/task-group.js +45 -3
- package/resources/beta/task-group.js.map +1 -1
- package/resources/beta/task-group.mjs +45 -3
- package/resources/beta/task-group.mjs.map +1 -1
- package/resources/beta/task-run.d.mts +77 -270
- package/resources/beta/task-run.d.mts.map +1 -1
- package/resources/beta/task-run.d.ts +77 -270
- package/resources/beta/task-run.d.ts.map +1 -1
- package/resources/beta/task-run.js +17 -2
- package/resources/beta/task-run.js.map +1 -1
- package/resources/beta/task-run.mjs +17 -2
- package/resources/beta/task-run.mjs.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.mts +4 -2
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +4 -2
- package/resources/shared.d.ts.map +1 -1
- package/resources/task-run.d.mts +308 -30
- package/resources/task-run.d.mts.map +1 -1
- package/resources/task-run.d.ts +308 -30
- package/resources/task-run.d.ts.map +1 -1
- package/resources/task-run.js +67 -4
- package/resources/task-run.js.map +1 -1
- package/resources/task-run.mjs +67 -4
- package/resources/task-run.mjs.map +1 -1
- package/resources/top-level.d.mts +317 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts +317 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/src/client.ts +90 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/beta/api.md +12 -9
- package/src/resources/beta/beta.ts +59 -73
- package/src/resources/beta/findall.ts +187 -7
- package/src/resources/beta/index.ts +7 -4
- package/src/resources/beta/task-group.ts +54 -7
- package/src/resources/beta/task-run.ts +94 -305
- package/src/resources/index.ts +20 -0
- package/src/resources/shared.ts +4 -2
- package/src/resources/task-run.ts +391 -32
- package/src/resources/top-level.ts +385 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -11,17 +11,24 @@ import { RequestOptions } from '../../internal/request-options';
|
|
|
11
11
|
import { path } from '../../internal/utils/path';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* The Task
|
|
14
|
+
* The Task API executes web research and extraction tasks. Clients submit a natural-language objective with an optional input schema; the service plans retrieval, fetches relevant URLs, and returns outputs that conform to a provided or inferred JSON schema. Supports deep research style queries and can return rich structured JSON outputs. Processors trade-off between cost, latency, and quality. Each processor supports calibrated confidences.
|
|
15
|
+
* - Output metadata: citations, excerpts, reasoning, and confidence per field
|
|
16
|
+
*
|
|
17
|
+
* Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
|
|
15
18
|
* - Submit hundreds or thousands of Tasks as a single group
|
|
16
19
|
* - Observe group progress and receive results as they complete
|
|
17
20
|
* - Real-time updates via Server-Sent Events (SSE)
|
|
18
21
|
* - Add tasks to an existing group while it is running
|
|
19
22
|
* - Group-level retry and error aggregation
|
|
20
|
-
* Status: beta and subject to change.
|
|
21
23
|
*/
|
|
22
24
|
export class TaskGroup extends APIResource {
|
|
23
25
|
/**
|
|
24
26
|
* Initiates a TaskGroup to group and track multiple runs.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const taskGroup = await client.beta.taskGroup.create();
|
|
31
|
+
* ```
|
|
25
32
|
*/
|
|
26
33
|
create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroup> {
|
|
27
34
|
return this._client.post('/v1beta/tasks/groups', {
|
|
@@ -33,6 +40,13 @@ export class TaskGroup extends APIResource {
|
|
|
33
40
|
|
|
34
41
|
/**
|
|
35
42
|
* Retrieves aggregated status across runs in a TaskGroup.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const taskGroup = await client.beta.taskGroup.retrieve(
|
|
47
|
+
* 'taskgroup_id',
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
36
50
|
*/
|
|
37
51
|
retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroup> {
|
|
38
52
|
return this._client.get(path`/v1beta/tasks/groups/${taskGroupID}`, {
|
|
@@ -43,14 +57,28 @@ export class TaskGroup extends APIResource {
|
|
|
43
57
|
|
|
44
58
|
/**
|
|
45
59
|
* Initiates multiple task runs within a TaskGroup.
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```ts
|
|
63
|
+
* const taskGroupRunResponse =
|
|
64
|
+
* await client.beta.taskGroup.addRuns('taskgroup_id', {
|
|
65
|
+
* inputs: [
|
|
66
|
+
* {
|
|
67
|
+
* input: 'What was the GDP of France in 2023?',
|
|
68
|
+
* processor: 'base',
|
|
69
|
+
* },
|
|
70
|
+
* ],
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
46
73
|
*/
|
|
47
74
|
addRuns(
|
|
48
75
|
taskGroupID: string,
|
|
49
76
|
params: TaskGroupAddRunsParams,
|
|
50
77
|
options?: RequestOptions,
|
|
51
78
|
): APIPromise<TaskGroupRunResponse> {
|
|
52
|
-
const { betas, ...body } = params;
|
|
79
|
+
const { refresh_status, betas, ...body } = params;
|
|
53
80
|
return this._client.post(path`/v1beta/tasks/groups/${taskGroupID}/runs`, {
|
|
81
|
+
query: { refresh_status },
|
|
54
82
|
body,
|
|
55
83
|
...options,
|
|
56
84
|
headers: buildHeaders([
|
|
@@ -65,6 +93,13 @@ export class TaskGroup extends APIResource {
|
|
|
65
93
|
*
|
|
66
94
|
* The connection will remain open for up to an hour as long as at least one run in
|
|
67
95
|
* the group is still active.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const response = await client.beta.taskGroup.events(
|
|
100
|
+
* 'taskgroup_id',
|
|
101
|
+
* );
|
|
102
|
+
* ```
|
|
68
103
|
*/
|
|
69
104
|
events(
|
|
70
105
|
taskGroupID: string,
|
|
@@ -93,6 +128,13 @@ export class TaskGroup extends APIResource {
|
|
|
93
128
|
* specify the `last_event_id` parameter with the `event_id` of the last event in
|
|
94
129
|
* the stream. The stream will resume from the next event after the
|
|
95
130
|
* `last_event_id`.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* const response = await client.beta.taskGroup.getRuns(
|
|
135
|
+
* 'taskgroup_id',
|
|
136
|
+
* );
|
|
137
|
+
* ```
|
|
96
138
|
*/
|
|
97
139
|
getRuns(
|
|
98
140
|
taskGroupID: string,
|
|
@@ -201,8 +243,8 @@ export interface TaskGroupStatus {
|
|
|
201
243
|
*/
|
|
202
244
|
export type TaskGroupEventsResponse =
|
|
203
245
|
| TaskGroupEventsResponse.TaskGroupStatusEvent
|
|
204
|
-
|
|
|
205
|
-
|
|
|
246
|
+
| TaskRunAPI.TaskRunEvent
|
|
247
|
+
| TaskRunAPI.ErrorEvent;
|
|
206
248
|
|
|
207
249
|
export namespace TaskGroupEventsResponse {
|
|
208
250
|
/**
|
|
@@ -231,7 +273,7 @@ export namespace TaskGroupEventsResponse {
|
|
|
231
273
|
*
|
|
232
274
|
* May indicate completion, cancellation, or failure.
|
|
233
275
|
*/
|
|
234
|
-
export type TaskGroupGetRunsResponse =
|
|
276
|
+
export type TaskGroupGetRunsResponse = TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
|
|
235
277
|
|
|
236
278
|
export interface TaskGroupCreateParams {
|
|
237
279
|
/**
|
|
@@ -246,7 +288,12 @@ export interface TaskGroupAddRunsParams {
|
|
|
246
288
|
* request. If you'd like to add more runs, split them across multiple TaskGroup
|
|
247
289
|
* POST requests.
|
|
248
290
|
*/
|
|
249
|
-
inputs: Array<
|
|
291
|
+
inputs: Array<TaskRunAPI.RunInput>;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Query param
|
|
295
|
+
*/
|
|
296
|
+
refresh_status?: boolean;
|
|
250
297
|
|
|
251
298
|
/**
|
|
252
299
|
* Body param: Specification for a task.
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as BetaTaskRunAPI from './task-run';
|
|
5
4
|
import * as Shared from '../shared';
|
|
6
5
|
import * as TaskRunAPI from '../task-run';
|
|
7
6
|
import { APIPromise } from '../../core/api-promise';
|
|
@@ -13,6 +12,15 @@ import { path } from '../../internal/utils/path';
|
|
|
13
12
|
/**
|
|
14
13
|
* The Task API executes web research and extraction tasks. Clients submit a natural-language objective with an optional input schema; the service plans retrieval, fetches relevant URLs, and returns outputs that conform to a provided or inferred JSON schema. Supports deep research style queries and can return rich structured JSON outputs. Processors trade-off between cost, latency, and quality. Each processor supports calibrated confidences.
|
|
15
14
|
* - Output metadata: citations, excerpts, reasoning, and confidence per field
|
|
15
|
+
*
|
|
16
|
+
* Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
|
|
17
|
+
* - Submit hundreds or thousands of Tasks as a single group
|
|
18
|
+
* - Observe group progress and receive results as they complete
|
|
19
|
+
* - Real-time updates via Server-Sent Events (SSE)
|
|
20
|
+
* - Add tasks to an existing group while it is running
|
|
21
|
+
* - Group-level retry and error aggregation
|
|
22
|
+
*
|
|
23
|
+
* @deprecated Use GA Task Run instead
|
|
16
24
|
*/
|
|
17
25
|
export class TaskRun extends APIResource {
|
|
18
26
|
/**
|
|
@@ -21,10 +29,12 @@ export class TaskRun extends APIResource {
|
|
|
21
29
|
* Returns immediately with a run object in status 'queued'.
|
|
22
30
|
*
|
|
23
31
|
* Beta features can be enabled by setting the 'parallel-beta' header.
|
|
32
|
+
*
|
|
33
|
+
* @deprecated Use GA Task Run instead
|
|
24
34
|
*/
|
|
25
35
|
create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise<TaskRunAPI.TaskRun> {
|
|
26
36
|
const { betas, ...body } = params;
|
|
27
|
-
return this._client.post('/v1/tasks/runs
|
|
37
|
+
return this._client.post('/v1/tasks/runs', {
|
|
28
38
|
body,
|
|
29
39
|
...options,
|
|
30
40
|
headers: buildHeaders([
|
|
@@ -42,6 +52,8 @@ export class TaskRun extends APIResource {
|
|
|
42
52
|
*
|
|
43
53
|
* For task runs that did not have enable_events set to true during creation, the
|
|
44
54
|
* frequency of events will be reduced.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Use GA Task Run instead
|
|
45
57
|
*/
|
|
46
58
|
events(runID: string, options?: RequestOptions): APIPromise<Stream<TaskRunEventsResponse>> {
|
|
47
59
|
return this._client.get(path`/v1beta/tasks/runs/${runID}/events`, {
|
|
@@ -56,14 +68,16 @@ export class TaskRun extends APIResource {
|
|
|
56
68
|
|
|
57
69
|
/**
|
|
58
70
|
* Retrieves a run result by run_id, blocking until the run is completed.
|
|
71
|
+
*
|
|
72
|
+
* @deprecated Use GA Task Run instead
|
|
59
73
|
*/
|
|
60
74
|
result(
|
|
61
75
|
runID: string,
|
|
62
76
|
params: TaskRunResultParams | null | undefined = {},
|
|
63
77
|
options?: RequestOptions,
|
|
64
|
-
): APIPromise<
|
|
78
|
+
): APIPromise<TaskRunAPI.TaskRunResult> {
|
|
65
79
|
const { betas, ...query } = params ?? {};
|
|
66
|
-
return this._client.get(path`/v1/tasks/runs/${runID}/result
|
|
80
|
+
return this._client.get(path`/v1/tasks/runs/${runID}/result`, {
|
|
67
81
|
query,
|
|
68
82
|
...options,
|
|
69
83
|
headers: buildHeaders([
|
|
@@ -74,243 +88,6 @@ export class TaskRun extends APIResource {
|
|
|
74
88
|
}
|
|
75
89
|
}
|
|
76
90
|
|
|
77
|
-
/**
|
|
78
|
-
* Task run input with additional beta fields.
|
|
79
|
-
*/
|
|
80
|
-
export interface BetaRunInput {
|
|
81
|
-
/**
|
|
82
|
-
* Input to the task, either text or a JSON object.
|
|
83
|
-
*/
|
|
84
|
-
input: string | { [key: string]: unknown };
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Processor to use for the task.
|
|
88
|
-
*/
|
|
89
|
-
processor: string;
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Controls tracking of task run execution progress. When set to true, progress
|
|
93
|
-
* events are recorded and can be accessed via the
|
|
94
|
-
* [Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
|
|
95
|
-
* false, no progress events are tracked. Note that progress tracking cannot be
|
|
96
|
-
* enabled after a run has been created. The flag is set to true by default for
|
|
97
|
-
* premium processors (pro and above). To enable this feature in your requests,
|
|
98
|
-
* specify `events-sse-2025-07-24` as one of the values in `parallel-beta` header
|
|
99
|
-
* (for API calls) or `betas` param (for the SDKs).
|
|
100
|
-
*/
|
|
101
|
-
enable_events?: boolean | null;
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* Optional list of MCP servers to use for the run. To enable this feature in your
|
|
105
|
-
* requests, specify `mcp-server-2025-07-17` as one of the values in
|
|
106
|
-
* `parallel-beta` header (for API calls) or `betas` param (for the SDKs).
|
|
107
|
-
*/
|
|
108
|
-
mcp_servers?: Array<McpServer> | null;
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* User-provided metadata stored with the run. Keys and values must be strings with
|
|
112
|
-
* a maximum length of 16 and 512 characters respectively.
|
|
113
|
-
*/
|
|
114
|
-
metadata?: { [key: string]: string | number | boolean } | null;
|
|
115
|
-
|
|
116
|
-
/**
|
|
117
|
-
* Interaction ID to use as context for this request.
|
|
118
|
-
*/
|
|
119
|
-
previous_interaction_id?: string | null;
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Source policy for web search results.
|
|
123
|
-
*
|
|
124
|
-
* This policy governs which sources are allowed/disallowed in results.
|
|
125
|
-
*/
|
|
126
|
-
source_policy?: Shared.SourcePolicy | null;
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Specification for a task.
|
|
130
|
-
*
|
|
131
|
-
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
132
|
-
* Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
133
|
-
*
|
|
134
|
-
* For convenience bare strings are also accepted as input or output schemas.
|
|
135
|
-
*/
|
|
136
|
-
task_spec?: TaskRunAPI.TaskSpec | null;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Webhooks for Task Runs.
|
|
140
|
-
*/
|
|
141
|
-
webhook?: Webhook | null;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Result of a beta task run. Available only if beta headers are specified.
|
|
146
|
-
*/
|
|
147
|
-
export interface BetaTaskRunResult {
|
|
148
|
-
/**
|
|
149
|
-
* Output from the task conforming to the output schema.
|
|
150
|
-
*/
|
|
151
|
-
output: BetaTaskRunResult.BetaTaskRunTextOutput | BetaTaskRunResult.BetaTaskRunJsonOutput;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* Beta task run object with status 'completed'.
|
|
155
|
-
*/
|
|
156
|
-
run: TaskRunAPI.TaskRun;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
export namespace BetaTaskRunResult {
|
|
160
|
-
/**
|
|
161
|
-
* Output from a task that returns text.
|
|
162
|
-
*/
|
|
163
|
-
export interface BetaTaskRunTextOutput {
|
|
164
|
-
/**
|
|
165
|
-
* Basis for the output. To include per-list-element basis entries, send the
|
|
166
|
-
* `parallel-beta` header with the value `field-basis-2025-11-25` when creating the
|
|
167
|
-
* run.
|
|
168
|
-
*/
|
|
169
|
-
basis: Array<TaskRunAPI.FieldBasis>;
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Text output from the task.
|
|
173
|
-
*/
|
|
174
|
-
content: string;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* The type of output being returned, as determined by the output schema of the
|
|
178
|
-
* task spec.
|
|
179
|
-
*/
|
|
180
|
-
type: 'text';
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Always None.
|
|
184
|
-
*/
|
|
185
|
-
beta_fields?: { [key: string]: unknown } | null;
|
|
186
|
-
|
|
187
|
-
/**
|
|
188
|
-
* MCP tool calls made by the task.
|
|
189
|
-
*/
|
|
190
|
-
mcp_tool_calls?: Array<BetaTaskRunAPI.McpToolCall> | null;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
/**
|
|
194
|
-
* Output from a task that returns JSON.
|
|
195
|
-
*/
|
|
196
|
-
export interface BetaTaskRunJsonOutput {
|
|
197
|
-
/**
|
|
198
|
-
* Basis for the output. To include per-list-element basis entries, send the
|
|
199
|
-
* `parallel-beta` header with the value `field-basis-2025-11-25` when creating the
|
|
200
|
-
* run.
|
|
201
|
-
*/
|
|
202
|
-
basis: Array<TaskRunAPI.FieldBasis>;
|
|
203
|
-
|
|
204
|
-
/**
|
|
205
|
-
* Output from the task as a native JSON object, as determined by the output schema
|
|
206
|
-
* of the task spec.
|
|
207
|
-
*/
|
|
208
|
-
content: { [key: string]: unknown };
|
|
209
|
-
|
|
210
|
-
/**
|
|
211
|
-
* The type of output being returned, as determined by the output schema of the
|
|
212
|
-
* task spec.
|
|
213
|
-
*/
|
|
214
|
-
type: 'json';
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Always None.
|
|
218
|
-
*/
|
|
219
|
-
beta_fields?: { [key: string]: unknown } | null;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* MCP tool calls made by the task.
|
|
223
|
-
*/
|
|
224
|
-
mcp_tool_calls?: Array<BetaTaskRunAPI.McpToolCall> | null;
|
|
225
|
-
|
|
226
|
-
/**
|
|
227
|
-
* Output schema for the Task Run. Populated only if the task was executed with an
|
|
228
|
-
* auto schema.
|
|
229
|
-
*/
|
|
230
|
-
output_schema?: { [key: string]: unknown } | null;
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Event indicating an error.
|
|
236
|
-
*/
|
|
237
|
-
export interface ErrorEvent {
|
|
238
|
-
/**
|
|
239
|
-
* Error.
|
|
240
|
-
*/
|
|
241
|
-
error: Shared.ErrorObject;
|
|
242
|
-
|
|
243
|
-
/**
|
|
244
|
-
* Event type; always 'error'.
|
|
245
|
-
*/
|
|
246
|
-
type: 'error';
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* MCP server configuration.
|
|
251
|
-
*/
|
|
252
|
-
export interface McpServer {
|
|
253
|
-
/**
|
|
254
|
-
* Name of the MCP server.
|
|
255
|
-
*/
|
|
256
|
-
name: string;
|
|
257
|
-
|
|
258
|
-
/**
|
|
259
|
-
* URL of the MCP server.
|
|
260
|
-
*/
|
|
261
|
-
url: string;
|
|
262
|
-
|
|
263
|
-
/**
|
|
264
|
-
* List of allowed tools for the MCP server.
|
|
265
|
-
*/
|
|
266
|
-
allowed_tools?: Array<string> | null;
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Headers for the MCP server.
|
|
270
|
-
*/
|
|
271
|
-
headers?: { [key: string]: string } | null;
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* Type of MCP server being configured. Always `url`.
|
|
275
|
-
*/
|
|
276
|
-
type?: 'url';
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Result of an MCP tool call.
|
|
281
|
-
*/
|
|
282
|
-
export interface McpToolCall {
|
|
283
|
-
/**
|
|
284
|
-
* Arguments used to call the MCP tool.
|
|
285
|
-
*/
|
|
286
|
-
arguments: string;
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Name of the MCP server.
|
|
290
|
-
*/
|
|
291
|
-
server_name: string;
|
|
292
|
-
|
|
293
|
-
/**
|
|
294
|
-
* Identifier for the tool call.
|
|
295
|
-
*/
|
|
296
|
-
tool_call_id: string;
|
|
297
|
-
|
|
298
|
-
/**
|
|
299
|
-
* Name of the tool being called.
|
|
300
|
-
*/
|
|
301
|
-
tool_name: string;
|
|
302
|
-
|
|
303
|
-
/**
|
|
304
|
-
* Output received from the tool call, if successful.
|
|
305
|
-
*/
|
|
306
|
-
content?: string | null;
|
|
307
|
-
|
|
308
|
-
/**
|
|
309
|
-
* Error message if the tool call failed.
|
|
310
|
-
*/
|
|
311
|
-
error?: string | null;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
91
|
/**
|
|
315
92
|
* Model for the parallel-beta header.
|
|
316
93
|
*/
|
|
@@ -323,61 +100,14 @@ export type ParallelBeta =
|
|
|
323
100
|
| 'field-basis-2025-11-25'
|
|
324
101
|
| (string & {});
|
|
325
102
|
|
|
326
|
-
/**
|
|
327
|
-
* Event when a task run transitions to a non-active status.
|
|
328
|
-
*
|
|
329
|
-
* May indicate completion, cancellation, or failure.
|
|
330
|
-
*/
|
|
331
|
-
export interface TaskRunEvent {
|
|
332
|
-
/**
|
|
333
|
-
* Cursor to resume the event stream. Always empty for non Task Group runs.
|
|
334
|
-
*/
|
|
335
|
-
event_id: string | null;
|
|
336
|
-
|
|
337
|
-
/**
|
|
338
|
-
* Task run object.
|
|
339
|
-
*/
|
|
340
|
-
run: TaskRunAPI.TaskRun;
|
|
341
|
-
|
|
342
|
-
/**
|
|
343
|
-
* Event type; always 'task_run.state'.
|
|
344
|
-
*/
|
|
345
|
-
type: 'task_run.state';
|
|
346
|
-
|
|
347
|
-
/**
|
|
348
|
-
* Task run input with additional beta fields.
|
|
349
|
-
*/
|
|
350
|
-
input?: BetaRunInput | null;
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Output from the run; included only if requested and if status == `completed`.
|
|
354
|
-
*/
|
|
355
|
-
output?: TaskRunAPI.TaskRunTextOutput | TaskRunAPI.TaskRunJsonOutput | null;
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
/**
|
|
359
|
-
* Webhooks for Task Runs.
|
|
360
|
-
*/
|
|
361
|
-
export interface Webhook {
|
|
362
|
-
/**
|
|
363
|
-
* URL for the webhook.
|
|
364
|
-
*/
|
|
365
|
-
url: string;
|
|
366
|
-
|
|
367
|
-
/**
|
|
368
|
-
* Event types to send the webhook notifications for.
|
|
369
|
-
*/
|
|
370
|
-
event_types?: Array<'task_run.status'>;
|
|
371
|
-
}
|
|
372
|
-
|
|
373
103
|
/**
|
|
374
104
|
* A progress update for a task run.
|
|
375
105
|
*/
|
|
376
106
|
export type TaskRunEventsResponse =
|
|
377
107
|
| TaskRunEventsResponse.TaskRunProgressStatsEvent
|
|
378
108
|
| TaskRunEventsResponse.TaskRunProgressMessageEvent
|
|
379
|
-
| TaskRunEvent
|
|
380
|
-
| ErrorEvent;
|
|
109
|
+
| TaskRunAPI.TaskRunEvent
|
|
110
|
+
| TaskRunAPI.ErrorEvent;
|
|
381
111
|
|
|
382
112
|
export namespace TaskRunEventsResponse {
|
|
383
113
|
/**
|
|
@@ -449,6 +179,52 @@ export namespace TaskRunEventsResponse {
|
|
|
449
179
|
}
|
|
450
180
|
}
|
|
451
181
|
|
|
182
|
+
/**
|
|
183
|
+
* @deprecated Use parallel.types.task_run.TaskRunInput instead
|
|
184
|
+
*/
|
|
185
|
+
export type BetaRunInput = TaskRunAPI.RunInput;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @deprecated Use parallel.types.task_run.TaskRunResult instead
|
|
189
|
+
*/
|
|
190
|
+
export type BetaTaskRunResult = TaskRunAPI.TaskRunResult;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Backwards-compatible namespace for `BetaTaskRunResult`.
|
|
194
|
+
* @deprecated Use `TaskRunJsonOutput` and `TaskRunTextOutput` from `task-run` instead.
|
|
195
|
+
*/
|
|
196
|
+
export namespace BetaTaskRunResult {
|
|
197
|
+
/** @deprecated Use `TaskRunAPI.TaskRunTextOutput` instead */
|
|
198
|
+
export type BetaTaskRunTextOutput = TaskRunAPI.TaskRunTextOutput;
|
|
199
|
+
/** @deprecated Use `TaskRunAPI.TaskRunJsonOutput` instead */
|
|
200
|
+
export type BetaTaskRunJsonOutput = TaskRunAPI.TaskRunJsonOutput;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* @deprecated Use parallel.types.task_run.Webhook instead
|
|
205
|
+
*/
|
|
206
|
+
export type Webhook = TaskRunAPI.Webhook;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* @deprecated Use parallel.types.task_run.McpServer instead
|
|
210
|
+
*/
|
|
211
|
+
export type McpServer = TaskRunAPI.McpServer;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* @deprecated Use parallel.types.task_run.McpToolCall instead
|
|
215
|
+
*/
|
|
216
|
+
export type McpToolCall = TaskRunAPI.McpToolCall;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* @deprecated Use parallel.types.task_run.TaskRunEvent instead
|
|
220
|
+
*/
|
|
221
|
+
export type TaskRunEvent = TaskRunAPI.TaskRunEvent;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* @deprecated Use parallel.types.task_run.ErrorEvent instead
|
|
225
|
+
*/
|
|
226
|
+
export type ErrorEvent = TaskRunAPI.ErrorEvent;
|
|
227
|
+
|
|
452
228
|
export interface TaskRunCreateParams {
|
|
453
229
|
/**
|
|
454
230
|
* Body param: Input to the task, either text or a JSON object.
|
|
@@ -460,24 +236,25 @@ export interface TaskRunCreateParams {
|
|
|
460
236
|
*/
|
|
461
237
|
processor: string;
|
|
462
238
|
|
|
239
|
+
/**
|
|
240
|
+
* Body param: Advanced search configuration for a task run.
|
|
241
|
+
*/
|
|
242
|
+
advanced_settings?: TaskRunCreateParams.AdvancedSettings | null;
|
|
243
|
+
|
|
463
244
|
/**
|
|
464
245
|
* Body param: Controls tracking of task run execution progress. When set to true,
|
|
465
246
|
* progress events are recorded and can be accessed via the
|
|
466
|
-
* [Task Run events](https://
|
|
467
|
-
*
|
|
468
|
-
*
|
|
469
|
-
*
|
|
470
|
-
* specify `events-sse-2025-07-24` as one of the values in `parallel-beta` header
|
|
471
|
-
* (for API calls) or `betas` param (for the SDKs).
|
|
247
|
+
* [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
|
|
248
|
+
* no progress events are tracked. Note that progress tracking cannot be enabled
|
|
249
|
+
* after a run has been created. The flag is set to true by default for premium
|
|
250
|
+
* processors (pro and above).
|
|
472
251
|
*/
|
|
473
252
|
enable_events?: boolean | null;
|
|
474
253
|
|
|
475
254
|
/**
|
|
476
|
-
* Body param: Optional list of MCP servers to use for the run.
|
|
477
|
-
* feature in your requests, specify `mcp-server-2025-07-17` as one of the values
|
|
478
|
-
* in `parallel-beta` header (for API calls) or `betas` param (for the SDKs).
|
|
255
|
+
* Body param: Optional list of MCP servers to use for the run.
|
|
479
256
|
*/
|
|
480
|
-
mcp_servers?: Array<McpServer> | null;
|
|
257
|
+
mcp_servers?: Array<TaskRunAPI.McpServer> | null;
|
|
481
258
|
|
|
482
259
|
/**
|
|
483
260
|
* Body param: User-provided metadata stored with the run. Keys and values must be
|
|
@@ -510,7 +287,7 @@ export interface TaskRunCreateParams {
|
|
|
510
287
|
/**
|
|
511
288
|
* Body param: Webhooks for Task Runs.
|
|
512
289
|
*/
|
|
513
|
-
webhook?: Webhook | null;
|
|
290
|
+
webhook?: TaskRunAPI.Webhook | null;
|
|
514
291
|
|
|
515
292
|
/**
|
|
516
293
|
* Header param: Optional header to specify the beta version(s) to enable.
|
|
@@ -518,6 +295,18 @@ export interface TaskRunCreateParams {
|
|
|
518
295
|
betas?: Array<ParallelBeta>;
|
|
519
296
|
}
|
|
520
297
|
|
|
298
|
+
export namespace TaskRunCreateParams {
|
|
299
|
+
/**
|
|
300
|
+
* Advanced search configuration for a task run.
|
|
301
|
+
*/
|
|
302
|
+
export interface AdvancedSettings {
|
|
303
|
+
/**
|
|
304
|
+
* ISO 3166-1 alpha-2 country code for geo-targeted search results.
|
|
305
|
+
*/
|
|
306
|
+
location?: string | null;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
521
310
|
export interface TaskRunResultParams {
|
|
522
311
|
/**
|
|
523
312
|
* Query param
|
|
@@ -532,15 +321,15 @@ export interface TaskRunResultParams {
|
|
|
532
321
|
|
|
533
322
|
export declare namespace TaskRun {
|
|
534
323
|
export {
|
|
324
|
+
type ParallelBeta as ParallelBeta,
|
|
325
|
+
type TaskRunEventsResponse as TaskRunEventsResponse,
|
|
535
326
|
type BetaRunInput as BetaRunInput,
|
|
536
327
|
type BetaTaskRunResult as BetaTaskRunResult,
|
|
537
|
-
type
|
|
328
|
+
type Webhook as Webhook,
|
|
538
329
|
type McpServer as McpServer,
|
|
539
330
|
type McpToolCall as McpToolCall,
|
|
540
|
-
type ParallelBeta as ParallelBeta,
|
|
541
331
|
type TaskRunEvent as TaskRunEvent,
|
|
542
|
-
type
|
|
543
|
-
type TaskRunEventsResponse as TaskRunEventsResponse,
|
|
332
|
+
type ErrorEvent as ErrorEvent,
|
|
544
333
|
type TaskRunCreateParams as TaskRunCreateParams,
|
|
545
334
|
type TaskRunResultParams as TaskRunResultParams,
|
|
546
335
|
};
|
package/src/resources/index.ts
CHANGED
|
@@ -6,14 +6,34 @@ export {
|
|
|
6
6
|
TaskRun,
|
|
7
7
|
type AutoSchema,
|
|
8
8
|
type Citation,
|
|
9
|
+
type ErrorEvent,
|
|
9
10
|
type FieldBasis,
|
|
10
11
|
type JsonSchema,
|
|
12
|
+
type McpServer,
|
|
13
|
+
type McpToolCall,
|
|
11
14
|
type RunInput,
|
|
15
|
+
type TaskRunEvent,
|
|
12
16
|
type TaskRunJsonOutput,
|
|
13
17
|
type TaskRunResult,
|
|
14
18
|
type TaskRunTextOutput,
|
|
15
19
|
type TaskSpec,
|
|
16
20
|
type TextSchema,
|
|
21
|
+
type Webhook,
|
|
22
|
+
type TaskRunEventsResponse,
|
|
17
23
|
type TaskRunCreateParams,
|
|
18
24
|
type TaskRunResultParams,
|
|
19
25
|
} from './task-run';
|
|
26
|
+
export {
|
|
27
|
+
type AdvancedExtractSettings,
|
|
28
|
+
type AdvancedSearchSettings,
|
|
29
|
+
type ExcerptSettings,
|
|
30
|
+
type ExtractError,
|
|
31
|
+
type ExtractResponse,
|
|
32
|
+
type ExtractResult,
|
|
33
|
+
type FetchPolicy,
|
|
34
|
+
type SearchResult,
|
|
35
|
+
type UsageItem,
|
|
36
|
+
type WebSearchResult,
|
|
37
|
+
type ExtractParams,
|
|
38
|
+
type SearchParams,
|
|
39
|
+
} from './top-level';
|
package/src/resources/shared.ts
CHANGED
|
@@ -52,7 +52,8 @@ export interface SourcePolicy {
|
|
|
52
52
|
* List of domains to exclude from results. If specified, sources from these
|
|
53
53
|
* domains will be excluded. Accepts plain domains (e.g., example.com,
|
|
54
54
|
* subdomain.example.gov) or bare domain extension starting with a period (e.g.,
|
|
55
|
-
* .gov, .edu, .co.uk).
|
|
55
|
+
* .gov, .edu, .co.uk). The combined number of domains in include_domains and
|
|
56
|
+
* exclude_domains cannot exceed 200.
|
|
56
57
|
*/
|
|
57
58
|
exclude_domains?: Array<string>;
|
|
58
59
|
|
|
@@ -60,7 +61,8 @@ export interface SourcePolicy {
|
|
|
60
61
|
* List of domains to restrict the results to. If specified, only sources from
|
|
61
62
|
* these domains will be included. Accepts plain domains (e.g., example.com,
|
|
62
63
|
* subdomain.example.gov) or bare domain extension starting with a period (e.g.,
|
|
63
|
-
* .gov, .edu, .co.uk).
|
|
64
|
+
* .gov, .edu, .co.uk). The combined number of domains in include_domains and
|
|
65
|
+
* exclude_domains cannot exceed 200.
|
|
64
66
|
*/
|
|
65
67
|
include_domains?: Array<string>;
|
|
66
68
|
}
|