parallel-web 0.3.2 → 0.4.0
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 +44 -0
- package/client.d.mts +40 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +40 -2
- package/client.d.ts.map +1 -1
- package/client.js +39 -0
- package/client.js.map +1 -1
- package/client.mjs +39 -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 +40 -61
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +40 -61
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +11 -2
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +11 -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 +86 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/beta/api.md +12 -9
- package/src/resources/beta/beta.ts +55 -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
|
@@ -2,13 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as Shared from './shared';
|
|
5
|
+
import * as BetaTaskRunAPI from './beta/task-run';
|
|
5
6
|
import { APIPromise } from '../core/api-promise';
|
|
7
|
+
import { Stream } from '../core/streaming';
|
|
8
|
+
import { buildHeaders } from '../internal/headers';
|
|
6
9
|
import { RequestOptions } from '../internal/request-options';
|
|
7
10
|
import { path } from '../internal/utils/path';
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
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.
|
|
11
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
|
|
12
22
|
*/
|
|
13
23
|
export class TaskRun extends APIResource {
|
|
14
24
|
/**
|
|
@@ -17,29 +27,85 @@ export class TaskRun extends APIResource {
|
|
|
17
27
|
* Returns immediately with a run object in status 'queued'.
|
|
18
28
|
*
|
|
19
29
|
* Beta features can be enabled by setting the 'parallel-beta' header.
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const taskRun = await client.taskRun.create({
|
|
34
|
+
* input: 'What was the GDP of France in 2023?',
|
|
35
|
+
* processor: 'base',
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise<TaskRun> {
|
|
40
|
+
const { betas, ...body } = params;
|
|
41
|
+
return this._client.post('/v1/tasks/runs', {
|
|
42
|
+
body,
|
|
43
|
+
...options,
|
|
44
|
+
headers: buildHeaders([
|
|
45
|
+
{ ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
|
|
46
|
+
options?.headers,
|
|
47
|
+
]),
|
|
48
|
+
});
|
|
23
49
|
}
|
|
24
50
|
|
|
25
51
|
/**
|
|
26
52
|
* Retrieves run status by run_id.
|
|
27
53
|
*
|
|
28
54
|
* The run result is available from the `/result` endpoint.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const taskRun = await client.taskRun.retrieve('run_id');
|
|
59
|
+
* ```
|
|
29
60
|
*/
|
|
30
61
|
retrieve(runID: string, options?: RequestOptions): APIPromise<TaskRun> {
|
|
31
62
|
return this._client.get(path`/v1/tasks/runs/${runID}`, options);
|
|
32
63
|
}
|
|
33
64
|
|
|
65
|
+
/**
|
|
66
|
+
* Streams events for a task run.
|
|
67
|
+
*
|
|
68
|
+
* Returns a stream of events showing progress updates and state changes for the
|
|
69
|
+
* task run.
|
|
70
|
+
*
|
|
71
|
+
* For task runs that did not have enable_events set to true during creation, the
|
|
72
|
+
* frequency of events will be reduced.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const response = await client.taskRun.events('run_id');
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
events(runID: string, options?: RequestOptions): APIPromise<Stream<TaskRunEventsResponse>> {
|
|
80
|
+
return this._client.get(path`/v1/tasks/runs/${runID}/events`, {
|
|
81
|
+
...options,
|
|
82
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
83
|
+
stream: true,
|
|
84
|
+
}) as APIPromise<Stream<TaskRunEventsResponse>>;
|
|
85
|
+
}
|
|
86
|
+
|
|
34
87
|
/**
|
|
35
88
|
* Retrieves a run result by run_id, blocking until the run is completed.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const taskRunResult = await client.taskRun.result('run_id');
|
|
93
|
+
* ```
|
|
36
94
|
*/
|
|
37
95
|
result(
|
|
38
96
|
runID: string,
|
|
39
|
-
|
|
97
|
+
params: TaskRunResultParams | null | undefined = {},
|
|
40
98
|
options?: RequestOptions,
|
|
41
99
|
): APIPromise<TaskRunResult> {
|
|
42
|
-
|
|
100
|
+
const { betas, ...query } = params ?? {};
|
|
101
|
+
return this._client.get(path`/v1/tasks/runs/${runID}/result`, {
|
|
102
|
+
query,
|
|
103
|
+
...options,
|
|
104
|
+
headers: buildHeaders([
|
|
105
|
+
{ ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
|
|
106
|
+
options?.headers,
|
|
107
|
+
]),
|
|
108
|
+
});
|
|
43
109
|
}
|
|
44
110
|
}
|
|
45
111
|
|
|
@@ -74,6 +140,21 @@ export interface Citation {
|
|
|
74
140
|
title?: string | null;
|
|
75
141
|
}
|
|
76
142
|
|
|
143
|
+
/**
|
|
144
|
+
* Event indicating an error.
|
|
145
|
+
*/
|
|
146
|
+
export interface ErrorEvent {
|
|
147
|
+
/**
|
|
148
|
+
* Error.
|
|
149
|
+
*/
|
|
150
|
+
error: Shared.ErrorObject;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Event type; always 'error'.
|
|
154
|
+
*/
|
|
155
|
+
type: 'error';
|
|
156
|
+
}
|
|
157
|
+
|
|
77
158
|
/**
|
|
78
159
|
* Citations and reasoning supporting one field of a task output.
|
|
79
160
|
*/
|
|
@@ -115,6 +196,71 @@ export interface JsonSchema {
|
|
|
115
196
|
type?: 'json';
|
|
116
197
|
}
|
|
117
198
|
|
|
199
|
+
/**
|
|
200
|
+
* MCP server configuration.
|
|
201
|
+
*/
|
|
202
|
+
export interface McpServer {
|
|
203
|
+
/**
|
|
204
|
+
* Name of the MCP server.
|
|
205
|
+
*/
|
|
206
|
+
name: string;
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* URL of the MCP server.
|
|
210
|
+
*/
|
|
211
|
+
url: string;
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* List of allowed tools for the MCP server.
|
|
215
|
+
*/
|
|
216
|
+
allowed_tools?: Array<string> | null;
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Headers for the MCP server.
|
|
220
|
+
*/
|
|
221
|
+
headers?: { [key: string]: string } | null;
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Type of MCP server being configured. Always `url`.
|
|
225
|
+
*/
|
|
226
|
+
type?: 'url';
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Result of an MCP tool call.
|
|
231
|
+
*/
|
|
232
|
+
export interface McpToolCall {
|
|
233
|
+
/**
|
|
234
|
+
* Arguments used to call the MCP tool.
|
|
235
|
+
*/
|
|
236
|
+
arguments: string;
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Name of the MCP server.
|
|
240
|
+
*/
|
|
241
|
+
server_name: string;
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Identifier for the tool call.
|
|
245
|
+
*/
|
|
246
|
+
tool_call_id: string;
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* Name of the tool being called.
|
|
250
|
+
*/
|
|
251
|
+
tool_name: string;
|
|
252
|
+
|
|
253
|
+
/**
|
|
254
|
+
* Output received from the tool call, if successful.
|
|
255
|
+
*/
|
|
256
|
+
content?: string | null;
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* Error message if the tool call failed.
|
|
260
|
+
*/
|
|
261
|
+
error?: string | null;
|
|
262
|
+
}
|
|
263
|
+
|
|
118
264
|
/**
|
|
119
265
|
* Request to run a task.
|
|
120
266
|
*/
|
|
@@ -129,6 +275,26 @@ export interface RunInput {
|
|
|
129
275
|
*/
|
|
130
276
|
processor: string;
|
|
131
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Advanced search configuration for a task run.
|
|
280
|
+
*/
|
|
281
|
+
advanced_settings?: RunInput.AdvancedSettings | null;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Controls tracking of task run execution progress. When set to true, progress
|
|
285
|
+
* events are recorded and can be accessed via the
|
|
286
|
+
* [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
|
|
287
|
+
* no progress events are tracked. Note that progress tracking cannot be enabled
|
|
288
|
+
* after a run has been created. The flag is set to true by default for premium
|
|
289
|
+
* processors (pro and above).
|
|
290
|
+
*/
|
|
291
|
+
enable_events?: boolean | null;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Optional list of MCP servers to use for the run.
|
|
295
|
+
*/
|
|
296
|
+
mcp_servers?: Array<McpServer> | null;
|
|
297
|
+
|
|
132
298
|
/**
|
|
133
299
|
* User-provided metadata stored with the run. Keys and values must be strings with
|
|
134
300
|
* a maximum length of 16 and 512 characters respectively.
|
|
@@ -156,6 +322,23 @@ export interface RunInput {
|
|
|
156
322
|
* For convenience bare strings are also accepted as input or output schemas.
|
|
157
323
|
*/
|
|
158
324
|
task_spec?: TaskSpec | null;
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Webhooks for Task Runs.
|
|
328
|
+
*/
|
|
329
|
+
webhook?: Webhook | null;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
export namespace RunInput {
|
|
333
|
+
/**
|
|
334
|
+
* Advanced search configuration for a task run.
|
|
335
|
+
*/
|
|
336
|
+
export interface AdvancedSettings {
|
|
337
|
+
/**
|
|
338
|
+
* ISO 3166-1 alpha-2 country code for geo-targeted search results.
|
|
339
|
+
*/
|
|
340
|
+
location?: string | null;
|
|
341
|
+
}
|
|
159
342
|
}
|
|
160
343
|
|
|
161
344
|
/**
|
|
@@ -220,6 +403,38 @@ export interface TaskRun {
|
|
|
220
403
|
warnings?: Array<Shared.Warning> | null;
|
|
221
404
|
}
|
|
222
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Event when a task run transitions to a non-active status.
|
|
408
|
+
*
|
|
409
|
+
* May indicate completion, cancellation, or failure.
|
|
410
|
+
*/
|
|
411
|
+
export interface TaskRunEvent {
|
|
412
|
+
/**
|
|
413
|
+
* Cursor to resume the event stream. Always empty for non Task Group runs.
|
|
414
|
+
*/
|
|
415
|
+
event_id: string | null;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Task run object.
|
|
419
|
+
*/
|
|
420
|
+
run: TaskRun;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Event type; always 'task_run.state'.
|
|
424
|
+
*/
|
|
425
|
+
type: 'task_run.state';
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Request to run a task.
|
|
429
|
+
*/
|
|
430
|
+
input?: RunInput | null;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Output from the run; included only if requested and if status == `completed`.
|
|
434
|
+
*/
|
|
435
|
+
output?: TaskRunTextOutput | TaskRunJsonOutput | null;
|
|
436
|
+
}
|
|
437
|
+
|
|
223
438
|
/**
|
|
224
439
|
* Output from a task that returns JSON.
|
|
225
440
|
*/
|
|
@@ -244,19 +459,16 @@ export interface TaskRunJsonOutput {
|
|
|
244
459
|
type: 'json';
|
|
245
460
|
|
|
246
461
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* will be empty and instead the relevant beta attributes will be directly included
|
|
250
|
-
* in the `BetaTaskRunJsonOutput` or corresponding output type. However, if beta
|
|
251
|
-
* features were specified during task run creation but not during result
|
|
252
|
-
* retrieval, this field will contain the dump of fields from those beta features.
|
|
253
|
-
* Each key represents the beta feature version (one amongst parallel-beta headers)
|
|
254
|
-
* and the values correspond to the beta feature attributes, if any. For now, only
|
|
255
|
-
* MCP server beta features have attributes. For example,
|
|
256
|
-
* `{mcp-server-2025-07-17: [{'server_name':'mcp_server', 'tool_call_id': 'tc_123', ...}]}}`
|
|
462
|
+
* @deprecated Deprecated. mcp-server-2025-07-17 is now included directly in the
|
|
463
|
+
* output (e.g. mcp_tool_calls).
|
|
257
464
|
*/
|
|
258
465
|
beta_fields?: { [key: string]: unknown } | null;
|
|
259
466
|
|
|
467
|
+
/**
|
|
468
|
+
* MCP tool calls made by the task.
|
|
469
|
+
*/
|
|
470
|
+
mcp_tool_calls?: Array<McpToolCall> | null;
|
|
471
|
+
|
|
260
472
|
/**
|
|
261
473
|
* Output schema for the Task Run. Populated only if the task was executed with an
|
|
262
474
|
* auto schema.
|
|
@@ -300,18 +512,15 @@ export interface TaskRunTextOutput {
|
|
|
300
512
|
type: 'text';
|
|
301
513
|
|
|
302
514
|
/**
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
* will be empty and instead the relevant beta attributes will be directly included
|
|
306
|
-
* in the `BetaTaskRunJsonOutput` or corresponding output type. However, if beta
|
|
307
|
-
* features were specified during task run creation but not during result
|
|
308
|
-
* retrieval, this field will contain the dump of fields from those beta features.
|
|
309
|
-
* Each key represents the beta feature version (one amongst parallel-beta headers)
|
|
310
|
-
* and the values correspond to the beta feature attributes, if any. For now, only
|
|
311
|
-
* MCP server beta features have attributes. For example,
|
|
312
|
-
* `{mcp-server-2025-07-17: [{'server_name':'mcp_server', 'tool_call_id': 'tc_123', ...}]}}`
|
|
515
|
+
* @deprecated Deprecated. mcp-server-2025-07-17 is now included directly in the
|
|
516
|
+
* output (e.g. mcp_tool_calls).
|
|
313
517
|
*/
|
|
314
518
|
beta_fields?: { [key: string]: unknown } | null;
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* MCP tool calls made by the task.
|
|
522
|
+
*/
|
|
523
|
+
mcp_tool_calls?: Array<McpToolCall> | null;
|
|
315
524
|
}
|
|
316
525
|
|
|
317
526
|
/**
|
|
@@ -353,37 +562,151 @@ export interface TextSchema {
|
|
|
353
562
|
type?: 'text';
|
|
354
563
|
}
|
|
355
564
|
|
|
565
|
+
/**
|
|
566
|
+
* Webhooks for Task Runs.
|
|
567
|
+
*/
|
|
568
|
+
export interface Webhook {
|
|
569
|
+
/**
|
|
570
|
+
* URL for the webhook.
|
|
571
|
+
*/
|
|
572
|
+
url: string;
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Event types to send the webhook notifications for.
|
|
576
|
+
*/
|
|
577
|
+
event_types?: Array<'task_run.status'>;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* A progress update for a task run.
|
|
582
|
+
*/
|
|
583
|
+
export type TaskRunEventsResponse =
|
|
584
|
+
| TaskRunEventsResponse.TaskRunProgressStatsEvent
|
|
585
|
+
| TaskRunEventsResponse.TaskRunProgressMessageEvent
|
|
586
|
+
| TaskRunEvent
|
|
587
|
+
| ErrorEvent;
|
|
588
|
+
|
|
589
|
+
export namespace TaskRunEventsResponse {
|
|
590
|
+
/**
|
|
591
|
+
* A progress update for a task run.
|
|
592
|
+
*/
|
|
593
|
+
export interface TaskRunProgressStatsEvent {
|
|
594
|
+
/**
|
|
595
|
+
* Completion percentage of the task run. Ranges from 0 to 100 where 0 indicates no
|
|
596
|
+
* progress and 100 indicates completion.
|
|
597
|
+
*/
|
|
598
|
+
progress_meter: number;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* Source stats describing progress so far.
|
|
602
|
+
*/
|
|
603
|
+
source_stats: TaskRunProgressStatsEvent.SourceStats;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Event type; always 'task_run.progress_stats'.
|
|
607
|
+
*/
|
|
608
|
+
type: 'task_run.progress_stats';
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
export namespace TaskRunProgressStatsEvent {
|
|
612
|
+
/**
|
|
613
|
+
* Source stats describing progress so far.
|
|
614
|
+
*/
|
|
615
|
+
export interface SourceStats {
|
|
616
|
+
/**
|
|
617
|
+
* Number of sources considered in processing the task.
|
|
618
|
+
*/
|
|
619
|
+
num_sources_considered: number | null;
|
|
620
|
+
|
|
621
|
+
/**
|
|
622
|
+
* Number of sources read in processing the task.
|
|
623
|
+
*/
|
|
624
|
+
num_sources_read: number | null;
|
|
625
|
+
|
|
626
|
+
/**
|
|
627
|
+
* A sample of URLs of sources read in processing the task.
|
|
628
|
+
*/
|
|
629
|
+
sources_read_sample: Array<string> | null;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
/**
|
|
634
|
+
* A message for a task run progress update.
|
|
635
|
+
*/
|
|
636
|
+
export interface TaskRunProgressMessageEvent {
|
|
637
|
+
/**
|
|
638
|
+
* Progress update message.
|
|
639
|
+
*/
|
|
640
|
+
message: string;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Timestamp of the message.
|
|
644
|
+
*/
|
|
645
|
+
timestamp: string | null;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Event type; always starts with 'task_run.progress_msg'.
|
|
649
|
+
*/
|
|
650
|
+
type:
|
|
651
|
+
| 'task_run.progress_msg.plan'
|
|
652
|
+
| 'task_run.progress_msg.search'
|
|
653
|
+
| 'task_run.progress_msg.result'
|
|
654
|
+
| 'task_run.progress_msg.tool_call'
|
|
655
|
+
| 'task_run.progress_msg.exec_status';
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
|
|
356
659
|
export interface TaskRunCreateParams {
|
|
357
660
|
/**
|
|
358
|
-
* Input to the task, either text or a JSON object.
|
|
661
|
+
* Body param: Input to the task, either text or a JSON object.
|
|
359
662
|
*/
|
|
360
663
|
input: string | { [key: string]: unknown };
|
|
361
664
|
|
|
362
665
|
/**
|
|
363
|
-
* Processor to use for the task.
|
|
666
|
+
* Body param: Processor to use for the task.
|
|
364
667
|
*/
|
|
365
668
|
processor: string;
|
|
366
669
|
|
|
367
670
|
/**
|
|
368
|
-
*
|
|
369
|
-
|
|
671
|
+
* Body param: Advanced search configuration for a task run.
|
|
672
|
+
*/
|
|
673
|
+
advanced_settings?: TaskRunCreateParams.AdvancedSettings | null;
|
|
674
|
+
|
|
675
|
+
/**
|
|
676
|
+
* Body param: Controls tracking of task run execution progress. When set to true,
|
|
677
|
+
* progress events are recorded and can be accessed via the
|
|
678
|
+
* [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
|
|
679
|
+
* no progress events are tracked. Note that progress tracking cannot be enabled
|
|
680
|
+
* after a run has been created. The flag is set to true by default for premium
|
|
681
|
+
* processors (pro and above).
|
|
682
|
+
*/
|
|
683
|
+
enable_events?: boolean | null;
|
|
684
|
+
|
|
685
|
+
/**
|
|
686
|
+
* Body param: Optional list of MCP servers to use for the run.
|
|
687
|
+
*/
|
|
688
|
+
mcp_servers?: Array<McpServer> | null;
|
|
689
|
+
|
|
690
|
+
/**
|
|
691
|
+
* Body param: User-provided metadata stored with the run. Keys and values must be
|
|
692
|
+
* strings with a maximum length of 16 and 512 characters respectively.
|
|
370
693
|
*/
|
|
371
694
|
metadata?: { [key: string]: string | number | boolean } | null;
|
|
372
695
|
|
|
373
696
|
/**
|
|
374
|
-
* Interaction ID to use as context for this request.
|
|
697
|
+
* Body param: Interaction ID to use as context for this request.
|
|
375
698
|
*/
|
|
376
699
|
previous_interaction_id?: string | null;
|
|
377
700
|
|
|
378
701
|
/**
|
|
379
|
-
* Source policy for web search results.
|
|
702
|
+
* Body param: Source policy for web search results.
|
|
380
703
|
*
|
|
381
704
|
* This policy governs which sources are allowed/disallowed in results.
|
|
382
705
|
*/
|
|
383
706
|
source_policy?: Shared.SourcePolicy | null;
|
|
384
707
|
|
|
385
708
|
/**
|
|
386
|
-
* Specification for a task.
|
|
709
|
+
* Body param: Specification for a task.
|
|
387
710
|
*
|
|
388
711
|
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
389
712
|
* Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
@@ -391,25 +714,61 @@ export interface TaskRunCreateParams {
|
|
|
391
714
|
* For convenience bare strings are also accepted as input or output schemas.
|
|
392
715
|
*/
|
|
393
716
|
task_spec?: TaskSpec | null;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* Body param: Webhooks for Task Runs.
|
|
720
|
+
*/
|
|
721
|
+
webhook?: Webhook | null;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Header param: Optional header to specify the beta version(s) to enable.
|
|
725
|
+
*/
|
|
726
|
+
betas?: Array<BetaTaskRunAPI.ParallelBeta>;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
export namespace TaskRunCreateParams {
|
|
730
|
+
/**
|
|
731
|
+
* Advanced search configuration for a task run.
|
|
732
|
+
*/
|
|
733
|
+
export interface AdvancedSettings {
|
|
734
|
+
/**
|
|
735
|
+
* ISO 3166-1 alpha-2 country code for geo-targeted search results.
|
|
736
|
+
*/
|
|
737
|
+
location?: string | null;
|
|
738
|
+
}
|
|
394
739
|
}
|
|
395
740
|
|
|
396
741
|
export interface TaskRunResultParams {
|
|
742
|
+
/**
|
|
743
|
+
* Query param
|
|
744
|
+
*/
|
|
397
745
|
timeout?: number;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Header param: Optional header to specify the beta version(s) to enable.
|
|
749
|
+
*/
|
|
750
|
+
betas?: Array<BetaTaskRunAPI.ParallelBeta>;
|
|
398
751
|
}
|
|
399
752
|
|
|
400
753
|
export declare namespace TaskRun {
|
|
401
754
|
export {
|
|
402
755
|
type AutoSchema as AutoSchema,
|
|
403
756
|
type Citation as Citation,
|
|
757
|
+
type ErrorEvent as ErrorEvent,
|
|
404
758
|
type FieldBasis as FieldBasis,
|
|
405
759
|
type JsonSchema as JsonSchema,
|
|
760
|
+
type McpServer as McpServer,
|
|
761
|
+
type McpToolCall as McpToolCall,
|
|
406
762
|
type RunInput as RunInput,
|
|
407
763
|
type TaskRun as TaskRun,
|
|
764
|
+
type TaskRunEvent as TaskRunEvent,
|
|
408
765
|
type TaskRunJsonOutput as TaskRunJsonOutput,
|
|
409
766
|
type TaskRunResult as TaskRunResult,
|
|
410
767
|
type TaskRunTextOutput as TaskRunTextOutput,
|
|
411
768
|
type TaskSpec as TaskSpec,
|
|
412
769
|
type TextSchema as TextSchema,
|
|
770
|
+
type Webhook as Webhook,
|
|
771
|
+
type TaskRunEventsResponse as TaskRunEventsResponse,
|
|
413
772
|
type TaskRunCreateParams as TaskRunCreateParams,
|
|
414
773
|
type TaskRunResultParams as TaskRunResultParams,
|
|
415
774
|
};
|