parallel-web 0.5.0 → 1.0.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 +36 -0
- package/api-promise.d.mts +1 -0
- package/api-promise.d.mts.map +1 -1
- package/api-promise.d.ts +1 -0
- package/api-promise.d.ts.map +1 -1
- package/api-promise.mjs +1 -0
- package/api-promise.mjs.map +1 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts.map +1 -1
- package/client.mjs.map +1 -1
- package/core/api-promise.d.mts.map +1 -1
- package/core/api-promise.d.ts.map +1 -1
- package/core/api-promise.mjs.map +1 -1
- package/core/error.mjs.map +1 -1
- package/core/resource.d.mts.map +1 -1
- package/core/resource.d.ts.map +1 -1
- package/core/streaming.d.mts.map +1 -1
- package/core/streaming.d.ts.map +1 -1
- package/core/streaming.mjs.map +1 -1
- package/core/uploads.d.mts.map +1 -1
- package/core/uploads.d.ts.map +1 -1
- package/core/uploads.mjs.map +1 -1
- package/error.d.mts +1 -0
- package/error.d.mts.map +1 -1
- package/error.d.ts +1 -0
- package/error.d.ts.map +1 -1
- package/error.mjs +1 -0
- package/error.mjs.map +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.mjs.map +1 -1
- package/internal/decoders/line.mjs.map +1 -1
- package/internal/detect-platform.mjs.map +1 -1
- package/internal/headers.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.mjs.map +1 -1
- package/internal/qs/formats.d.mts.map +1 -1
- package/internal/qs/formats.d.ts.map +1 -1
- package/internal/qs/index.d.mts +2 -2
- package/internal/qs/index.d.mts.map +1 -1
- package/internal/qs/index.d.ts +2 -2
- package/internal/qs/index.d.ts.map +1 -1
- package/internal/qs/index.mjs.map +1 -1
- package/internal/qs/stringify.d.mts.map +1 -1
- package/internal/qs/stringify.d.ts.map +1 -1
- package/internal/qs/stringify.mjs.map +1 -1
- package/internal/qs/utils.d.mts.map +1 -1
- package/internal/qs/utils.d.ts.map +1 -1
- package/internal/qs/utils.mjs.map +1 -1
- package/internal/request-options.d.mts.map +1 -1
- package/internal/request-options.d.ts.map +1 -1
- package/internal/shims.d.mts +6 -0
- package/internal/shims.d.mts.map +1 -1
- package/internal/shims.d.ts +6 -0
- package/internal/shims.d.ts.map +1 -1
- package/internal/to-file.d.mts.map +1 -1
- package/internal/to-file.d.ts.map +1 -1
- package/internal/to-file.mjs.map +1 -1
- package/internal/types.d.mts +4 -4
- package/internal/types.d.mts.map +1 -1
- package/internal/types.d.ts +4 -4
- package/internal/types.d.ts.map +1 -1
- package/internal/uploads.d.mts.map +1 -1
- package/internal/uploads.d.ts.map +1 -1
- package/internal/uploads.mjs.map +1 -1
- package/internal/utils/base64.mjs.map +1 -1
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +3 -2
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +3 -2
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/path.mjs.map +1 -1
- package/internal/utils/query.mjs.map +1 -1
- package/internal/utils/values.mjs.map +1 -1
- package/internal/utils.d.mts.map +1 -1
- package/internal/utils.d.ts.map +1 -1
- package/internal/utils.mjs.map +1 -1
- package/package.json +1 -1
- package/resource.d.mts +1 -0
- package/resource.d.mts.map +1 -1
- package/resource.d.ts +1 -0
- package/resource.d.ts.map +1 -1
- package/resource.mjs +1 -0
- package/resource.mjs.map +1 -1
- package/resources/beta/beta.d.mts +2 -262
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +2 -262
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +0 -41
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +0 -41
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/findall.d.mts +76 -155
- package/resources/beta/findall.d.mts.map +1 -1
- package/resources/beta/findall.d.ts +76 -155
- package/resources/beta/findall.d.ts.map +1 -1
- package/resources/beta/findall.js +27 -33
- package/resources/beta/findall.js.map +1 -1
- package/resources/beta/findall.mjs +26 -31
- package/resources/beta/findall.mjs.map +1 -1
- package/resources/beta/index.d.mts +1 -3
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +1 -3
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js +1 -6
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs +1 -3
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta.d.mts.map +1 -1
- package/resources/beta.d.ts.map +1 -1
- package/resources/beta.mjs.map +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/monitor.d.mts.map +1 -1
- package/resources/monitor.d.ts.map +1 -1
- package/resources/monitor.mjs.map +1 -1
- package/resources/task-group.d.mts +2 -2
- package/resources/task-group.d.mts.map +1 -1
- package/resources/task-group.d.ts +2 -2
- package/resources/task-group.d.ts.map +1 -1
- package/resources/task-group.mjs.map +1 -1
- package/resources/task-run.d.mts +3 -26
- package/resources/task-run.d.mts.map +1 -1
- package/resources/task-run.d.ts +3 -26
- package/resources/task-run.d.ts.map +1 -1
- package/resources/task-run.mjs.map +1 -1
- package/resources/top-level.d.mts +1 -7
- package/resources/top-level.d.mts.map +1 -1
- package/resources/top-level.d.ts +1 -7
- package/resources/top-level.d.ts.map +1 -1
- package/resources.d.mts.map +1 -1
- package/resources.d.ts.map +1 -1
- package/resources.mjs.map +1 -1
- package/src/internal/utils/log.ts +2 -1
- package/src/resources/beta/api.md +4 -58
- package/src/resources/beta/beta.ts +8 -404
- package/src/resources/beta/findall.ts +102 -201
- package/src/resources/beta/index.ts +4 -50
- package/src/resources/task-group.ts +2 -2
- package/src/resources/task-run.ts +3 -30
- package/src/resources/top-level.ts +1 -10
- package/src/version.ts +1 -1
- package/streaming.d.mts +1 -0
- package/streaming.d.mts.map +1 -1
- package/streaming.d.ts +1 -0
- package/streaming.d.ts.map +1 -1
- package/streaming.mjs +1 -0
- package/streaming.mjs.map +1 -1
- package/uploads.d.mts +1 -0
- package/uploads.d.mts.map +1 -1
- package/uploads.d.ts +1 -0
- package/uploads.d.ts.map +1 -1
- package/uploads.mjs +1 -0
- package/uploads.mjs.map +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/beta/task-group.d.mts +0 -122
- package/resources/beta/task-group.d.mts.map +0 -1
- package/resources/beta/task-group.d.ts +0 -122
- package/resources/beta/task-group.d.ts.map +0 -1
- package/resources/beta/task-group.js +0 -100
- package/resources/beta/task-group.js.map +0 -1
- package/resources/beta/task-group.mjs +0 -96
- package/resources/beta/task-group.mjs.map +0 -1
- package/resources/beta/task-run.d.mts +0 -191
- package/resources/beta/task-run.d.mts.map +0 -1
- package/resources/beta/task-run.d.ts +0 -191
- package/resources/beta/task-run.d.ts.map +0 -1
- package/resources/beta/task-run.js +0 -81
- package/resources/beta/task-run.js.map +0 -1
- package/resources/beta/task-run.mjs +0 -77
- package/resources/beta/task-run.mjs.map +0 -1
- package/src/resources/beta/task-group.ts +0 -223
- package/src/resources/beta/task-run.ts +0 -276
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as TaskGroupAPI from '../task-group';
|
|
5
|
-
import * as TaskRunAPI from '../task-run';
|
|
6
|
-
import * as BetaTaskRunAPI from './task-run';
|
|
7
|
-
import { APIPromise } from '../../core/api-promise';
|
|
8
|
-
import { Stream } from '../../core/streaming';
|
|
9
|
-
import { buildHeaders } from '../../internal/headers';
|
|
10
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
11
|
-
import { path } from '../../internal/utils/path';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Tasks (Beta)
|
|
15
|
-
*
|
|
16
|
-
* @deprecated Use GA Task Group instead
|
|
17
|
-
*/
|
|
18
|
-
export class TaskGroup extends APIResource {
|
|
19
|
-
/**
|
|
20
|
-
* Initiates a TaskGroup to group and track multiple runs.
|
|
21
|
-
*
|
|
22
|
-
* @deprecated Use GA Task Group instead
|
|
23
|
-
*/
|
|
24
|
-
create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroupAPI.TaskGroup> {
|
|
25
|
-
return this._client.post('/v1beta/tasks/groups', {
|
|
26
|
-
body,
|
|
27
|
-
...options,
|
|
28
|
-
headers: buildHeaders([{ 'parallel-beta': 'search-extract-2025-10-10' }, options?.headers]),
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Retrieves aggregated status across runs in a TaskGroup.
|
|
34
|
-
*
|
|
35
|
-
* @deprecated Use GA Task Group instead
|
|
36
|
-
*/
|
|
37
|
-
retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroupAPI.TaskGroup> {
|
|
38
|
-
return this._client.get(path`/v1beta/tasks/groups/${taskGroupID}`, {
|
|
39
|
-
...options,
|
|
40
|
-
headers: buildHeaders([{ 'parallel-beta': 'search-extract-2025-10-10' }, options?.headers]),
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Initiates multiple task runs within a TaskGroup.
|
|
46
|
-
*
|
|
47
|
-
* @deprecated Use GA Task Group instead
|
|
48
|
-
*/
|
|
49
|
-
addRuns(
|
|
50
|
-
taskGroupID: string,
|
|
51
|
-
params: TaskGroupAddRunsParams,
|
|
52
|
-
options?: RequestOptions,
|
|
53
|
-
): APIPromise<TaskGroupAPI.TaskGroupRunResponse> {
|
|
54
|
-
const { refresh_status, betas, ...body } = params;
|
|
55
|
-
return this._client.post(path`/v1beta/tasks/groups/${taskGroupID}/runs`, {
|
|
56
|
-
query: { refresh_status },
|
|
57
|
-
body,
|
|
58
|
-
...options,
|
|
59
|
-
headers: buildHeaders([
|
|
60
|
-
{ 'parallel-beta': [...(betas ?? []), 'search-extract-2025-10-10'].toString() },
|
|
61
|
-
options?.headers,
|
|
62
|
-
]),
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Streams events from a TaskGroup: status updates and run completions.
|
|
68
|
-
*
|
|
69
|
-
* The connection will remain open for up to an hour as long as at least one run in
|
|
70
|
-
* the group is still active.
|
|
71
|
-
*
|
|
72
|
-
* @deprecated Use GA Task Group instead
|
|
73
|
-
*/
|
|
74
|
-
events(
|
|
75
|
-
taskGroupID: string,
|
|
76
|
-
query: TaskGroupEventsParams | undefined = {},
|
|
77
|
-
options?: RequestOptions,
|
|
78
|
-
): APIPromise<Stream<TaskGroupEventsResponse>> {
|
|
79
|
-
return this._client.get(path`/v1beta/tasks/groups/${taskGroupID}/events`, {
|
|
80
|
-
query,
|
|
81
|
-
...options,
|
|
82
|
-
headers: buildHeaders([
|
|
83
|
-
{ 'parallel-beta': 'search-extract-2025-10-10', Accept: 'text/event-stream' },
|
|
84
|
-
options?.headers,
|
|
85
|
-
]),
|
|
86
|
-
stream: true,
|
|
87
|
-
}) as APIPromise<Stream<TaskGroupEventsResponse>>;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/**
|
|
91
|
-
* Retrieves task runs in a TaskGroup and optionally their inputs and outputs.
|
|
92
|
-
*
|
|
93
|
-
* All runs within a TaskGroup are returned as a stream. To get the inputs and/or
|
|
94
|
-
* outputs back in the stream, set the corresponding `include_input` and
|
|
95
|
-
* `include_output` parameters to `true`.
|
|
96
|
-
*
|
|
97
|
-
* The stream is resumable using the `event_id` as the cursor. To resume a stream,
|
|
98
|
-
* specify the `last_event_id` parameter with the `event_id` of the last event in
|
|
99
|
-
* the stream. The stream will resume from the next event after the
|
|
100
|
-
* `last_event_id`.
|
|
101
|
-
*
|
|
102
|
-
* @deprecated Use GA Task Group instead
|
|
103
|
-
*/
|
|
104
|
-
getRuns(
|
|
105
|
-
taskGroupID: string,
|
|
106
|
-
query: TaskGroupGetRunsParams | undefined = {},
|
|
107
|
-
options?: RequestOptions,
|
|
108
|
-
): APIPromise<Stream<TaskGroupGetRunsResponse>> {
|
|
109
|
-
return this._client.get(path`/v1beta/tasks/groups/${taskGroupID}/runs`, {
|
|
110
|
-
query,
|
|
111
|
-
...options,
|
|
112
|
-
headers: buildHeaders([
|
|
113
|
-
{ 'parallel-beta': 'search-extract-2025-10-10', Accept: 'text/event-stream' },
|
|
114
|
-
options?.headers,
|
|
115
|
-
]),
|
|
116
|
-
stream: true,
|
|
117
|
-
}) as APIPromise<Stream<TaskGroupGetRunsResponse>>;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Event indicating an update to group status.
|
|
123
|
-
*/
|
|
124
|
-
export type TaskGroupEventsResponse =
|
|
125
|
-
| TaskGroupAPI.TaskGroupStatusEvent
|
|
126
|
-
| TaskRunAPI.TaskRunEvent
|
|
127
|
-
| TaskRunAPI.ErrorEvent;
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Event when a task run transitions to a non-active status.
|
|
131
|
-
*
|
|
132
|
-
* May indicate completion, cancellation, or failure.
|
|
133
|
-
*/
|
|
134
|
-
export type TaskGroupGetRunsResponse = TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
|
|
135
|
-
|
|
136
|
-
export type TaskGroupStatus = TaskGroupAPI.TaskGroupStatus;
|
|
137
|
-
|
|
138
|
-
export type TaskGroupStatusEvent = TaskGroupAPI.TaskGroupStatusEvent;
|
|
139
|
-
|
|
140
|
-
export type TaskGroupRunResponse = TaskGroupAPI.TaskGroupRunResponse;
|
|
141
|
-
|
|
142
|
-
export interface TaskGroupCreateParams {
|
|
143
|
-
/**
|
|
144
|
-
* User-provided metadata stored with the task group.
|
|
145
|
-
*/
|
|
146
|
-
metadata?: { [key: string]: string | number | boolean } | null;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export interface TaskGroupAddRunsParams {
|
|
150
|
-
/**
|
|
151
|
-
* Body param: List of task runs to execute. Up to 1,000 runs can be specified per
|
|
152
|
-
* request. If you'd like to add more runs, split them across multiple TaskGroup
|
|
153
|
-
* POST requests.
|
|
154
|
-
*/
|
|
155
|
-
inputs: Array<TaskRunAPI.RunInput>;
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Query param
|
|
159
|
-
*/
|
|
160
|
-
refresh_status?: boolean;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Body param: Specification for a task.
|
|
164
|
-
*
|
|
165
|
-
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
166
|
-
* Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
167
|
-
*
|
|
168
|
-
* For convenience bare strings are also accepted as input or output schemas.
|
|
169
|
-
*/
|
|
170
|
-
default_task_spec?: TaskRunAPI.TaskSpec | null;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Header param: Optional header to specify the beta version(s) to enable.
|
|
174
|
-
*/
|
|
175
|
-
betas?: Array<BetaTaskRunAPI.ParallelBeta>;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface TaskGroupEventsParams {
|
|
179
|
-
last_event_id?: string | null;
|
|
180
|
-
|
|
181
|
-
timeout?: number | null;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
export interface TaskGroupGetRunsParams {
|
|
185
|
-
include_input?: boolean;
|
|
186
|
-
|
|
187
|
-
include_output?: boolean;
|
|
188
|
-
|
|
189
|
-
last_event_id?: string | null;
|
|
190
|
-
|
|
191
|
-
status?:
|
|
192
|
-
| 'queued'
|
|
193
|
-
| 'action_required'
|
|
194
|
-
| 'running'
|
|
195
|
-
| 'completed'
|
|
196
|
-
| 'failed'
|
|
197
|
-
| 'cancelling'
|
|
198
|
-
| 'cancelled'
|
|
199
|
-
| null;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
export declare namespace TaskGroup {
|
|
203
|
-
export {
|
|
204
|
-
type TaskGroupEventsResponse as TaskGroupEventsResponse,
|
|
205
|
-
type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse,
|
|
206
|
-
type TaskGroupStatus as TaskGroupStatus,
|
|
207
|
-
type TaskGroupStatusEvent as TaskGroupStatusEvent,
|
|
208
|
-
type TaskGroupRunResponse as TaskGroupRunResponse,
|
|
209
|
-
type TaskGroupCreateParams as TaskGroupCreateParams,
|
|
210
|
-
type TaskGroupAddRunsParams as TaskGroupAddRunsParams,
|
|
211
|
-
type TaskGroupEventsParams as TaskGroupEventsParams,
|
|
212
|
-
type TaskGroupGetRunsParams as TaskGroupGetRunsParams,
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Backwards-compat namespace member (deprecated). `TaskGroupEventsResponse.TaskGroupStatusEvent`
|
|
217
|
-
// was previously a nested interface; the type now lives at the file's top
|
|
218
|
-
// level (re-exported from GA `TaskGroupAPI.TaskGroupStatusEvent`).
|
|
219
|
-
type _TaskGroupStatusEvent = TaskGroupStatusEvent;
|
|
220
|
-
export namespace TaskGroupEventsResponse {
|
|
221
|
-
/** @deprecated Use `Beta.TaskGroupStatusEvent` instead. */
|
|
222
|
-
export type TaskGroupStatusEvent = _TaskGroupStatusEvent;
|
|
223
|
-
}
|
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
|
|
3
|
-
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as Shared from '../shared';
|
|
5
|
-
import * as TaskRunAPI from '../task-run';
|
|
6
|
-
import { APIPromise } from '../../core/api-promise';
|
|
7
|
-
import { Stream } from '../../core/streaming';
|
|
8
|
-
import { buildHeaders } from '../../internal/headers';
|
|
9
|
-
import { RequestOptions } from '../../internal/request-options';
|
|
10
|
-
import { path } from '../../internal/utils/path';
|
|
11
|
-
|
|
12
|
-
/**
|
|
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.
|
|
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
|
|
24
|
-
*/
|
|
25
|
-
export class TaskRun extends APIResource {
|
|
26
|
-
/**
|
|
27
|
-
* Initiates a task run.
|
|
28
|
-
*
|
|
29
|
-
* Returns immediately with a run object in status 'queued'.
|
|
30
|
-
*
|
|
31
|
-
* Beta features can be enabled by setting the 'parallel-beta' header.
|
|
32
|
-
*
|
|
33
|
-
* @deprecated Use GA Task Run instead
|
|
34
|
-
*/
|
|
35
|
-
create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise<TaskRunAPI.TaskRun> {
|
|
36
|
-
const { betas, ...body } = params;
|
|
37
|
-
return this._client.post('/v1/tasks/runs', {
|
|
38
|
-
body,
|
|
39
|
-
...options,
|
|
40
|
-
headers: buildHeaders([
|
|
41
|
-
{ 'parallel-beta': [...(betas ?? []), 'search-extract-2025-10-10'].toString() },
|
|
42
|
-
options?.headers,
|
|
43
|
-
]),
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Streams events for a task run.
|
|
49
|
-
*
|
|
50
|
-
* Returns a stream of events showing progress updates and state changes for the
|
|
51
|
-
* task run.
|
|
52
|
-
*
|
|
53
|
-
* For task runs that did not have enable_events set to true during creation, the
|
|
54
|
-
* frequency of events will be reduced.
|
|
55
|
-
*
|
|
56
|
-
* @deprecated Use GA Task Run instead
|
|
57
|
-
*/
|
|
58
|
-
events(runID: string, options?: RequestOptions): APIPromise<Stream<TaskRunEventsResponse>> {
|
|
59
|
-
return this._client.get(path`/v1beta/tasks/runs/${runID}/events`, {
|
|
60
|
-
...options,
|
|
61
|
-
headers: buildHeaders([
|
|
62
|
-
{ 'parallel-beta': 'search-extract-2025-10-10', Accept: 'text/event-stream' },
|
|
63
|
-
options?.headers,
|
|
64
|
-
]),
|
|
65
|
-
stream: true,
|
|
66
|
-
}) as APIPromise<Stream<TaskRunEventsResponse>>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* Retrieves a run result by run_id, blocking until the run is completed.
|
|
71
|
-
*
|
|
72
|
-
* @deprecated Use GA Task Run instead
|
|
73
|
-
*/
|
|
74
|
-
result(
|
|
75
|
-
runID: string,
|
|
76
|
-
params: TaskRunResultParams | null | undefined = {},
|
|
77
|
-
options?: RequestOptions,
|
|
78
|
-
): APIPromise<TaskRunAPI.TaskRunResult> {
|
|
79
|
-
const { betas, ...query } = params ?? {};
|
|
80
|
-
return this._client.get(path`/v1/tasks/runs/${runID}/result`, {
|
|
81
|
-
query,
|
|
82
|
-
...options,
|
|
83
|
-
headers: buildHeaders([
|
|
84
|
-
{ 'parallel-beta': [...(betas ?? []), 'search-extract-2025-10-10'].toString() },
|
|
85
|
-
options?.headers,
|
|
86
|
-
]),
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Model for the parallel-beta header.
|
|
93
|
-
*/
|
|
94
|
-
export type ParallelBeta =
|
|
95
|
-
| 'mcp-server-2025-07-17'
|
|
96
|
-
| 'events-sse-2025-07-24'
|
|
97
|
-
| 'webhook-2025-08-12'
|
|
98
|
-
| 'findall-2025-09-15'
|
|
99
|
-
| 'search-extract-2025-10-10'
|
|
100
|
-
| 'field-basis-2025-11-25'
|
|
101
|
-
| (string & {});
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* A progress update for a task run.
|
|
105
|
-
*/
|
|
106
|
-
export type TaskRunEventsResponse =
|
|
107
|
-
| TaskRunAPI.TaskRunProgressStatsEvent
|
|
108
|
-
| TaskRunAPI.TaskRunProgressMessageEvent
|
|
109
|
-
| TaskRunAPI.TaskRunEvent
|
|
110
|
-
| TaskRunAPI.ErrorEvent;
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* @deprecated Use parallel.types.task_run.TaskRunInput instead
|
|
114
|
-
*/
|
|
115
|
-
export type BetaRunInput = TaskRunAPI.RunInput;
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* @deprecated Use parallel.types.task_run.TaskRunResult instead
|
|
119
|
-
*/
|
|
120
|
-
export type BetaTaskRunResult = TaskRunAPI.TaskRunResult;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Backwards-compatible namespace for `BetaTaskRunResult`.
|
|
124
|
-
* @deprecated Use `TaskRunJsonOutput` and `TaskRunTextOutput` from `task-run` instead.
|
|
125
|
-
*/
|
|
126
|
-
export namespace BetaTaskRunResult {
|
|
127
|
-
/** @deprecated Use `TaskRunAPI.TaskRunTextOutput` instead */
|
|
128
|
-
export type BetaTaskRunTextOutput = TaskRunAPI.TaskRunTextOutput;
|
|
129
|
-
/** @deprecated Use `TaskRunAPI.TaskRunJsonOutput` instead */
|
|
130
|
-
export type BetaTaskRunJsonOutput = TaskRunAPI.TaskRunJsonOutput;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* @deprecated Use parallel.types.task_run.Webhook instead
|
|
135
|
-
*/
|
|
136
|
-
export type Webhook = TaskRunAPI.Webhook;
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* @deprecated Use parallel.types.task_run.McpServer instead
|
|
140
|
-
*/
|
|
141
|
-
export type McpServer = TaskRunAPI.McpServer;
|
|
142
|
-
|
|
143
|
-
/**
|
|
144
|
-
* @deprecated Use parallel.types.task_run.McpToolCall instead
|
|
145
|
-
*/
|
|
146
|
-
export type McpToolCall = TaskRunAPI.McpToolCall;
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* @deprecated Use parallel.types.task_run.TaskRunEvent instead
|
|
150
|
-
*/
|
|
151
|
-
export type TaskRunEvent = TaskRunAPI.TaskRunEvent;
|
|
152
|
-
|
|
153
|
-
/**
|
|
154
|
-
* @deprecated Use parallel.types.task_run.ErrorEvent instead
|
|
155
|
-
*/
|
|
156
|
-
export type ErrorEvent = TaskRunAPI.ErrorEvent;
|
|
157
|
-
|
|
158
|
-
export interface TaskRunCreateParams {
|
|
159
|
-
/**
|
|
160
|
-
* Body param: Input to the task, either text or a JSON object.
|
|
161
|
-
*/
|
|
162
|
-
input: string | { [key: string]: unknown };
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Body param: Processor to use for the task.
|
|
166
|
-
*/
|
|
167
|
-
processor: string;
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Body param: Advanced search configuration for a task run.
|
|
171
|
-
*/
|
|
172
|
-
advanced_settings?: TaskRunAPI.TaskAdvancedSettings | null;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Body param: Controls tracking of task run execution progress. When set to true,
|
|
176
|
-
* progress events are recorded and can be accessed via the
|
|
177
|
-
* [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
|
|
178
|
-
* no progress events are tracked. Note that progress tracking cannot be enabled
|
|
179
|
-
* after a run has been created. The flag is set to true by default for premium
|
|
180
|
-
* processors (pro and above).
|
|
181
|
-
*/
|
|
182
|
-
enable_events?: boolean | null;
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Body param: Optional list of MCP servers to use for the run.
|
|
186
|
-
*/
|
|
187
|
-
mcp_servers?: Array<TaskRunAPI.McpServer> | null;
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Body param: User-provided metadata stored with the run. Keys and values must be
|
|
191
|
-
* strings with a maximum length of 16 and 512 characters respectively.
|
|
192
|
-
*/
|
|
193
|
-
metadata?: { [key: string]: string | number | boolean } | null;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Body param: Interaction ID to use as context for this request.
|
|
197
|
-
*/
|
|
198
|
-
previous_interaction_id?: string | null;
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Body param: Source policy for web search results.
|
|
202
|
-
*
|
|
203
|
-
* This policy governs which sources are allowed/disallowed in results.
|
|
204
|
-
*/
|
|
205
|
-
source_policy?: Shared.SourcePolicy | null;
|
|
206
|
-
|
|
207
|
-
/**
|
|
208
|
-
* Body param: Specification for a task.
|
|
209
|
-
*
|
|
210
|
-
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
211
|
-
* Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
212
|
-
*
|
|
213
|
-
* For convenience bare strings are also accepted as input or output schemas.
|
|
214
|
-
*/
|
|
215
|
-
task_spec?: TaskRunAPI.TaskSpec | null;
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Body param: Webhooks for Task Runs.
|
|
219
|
-
*/
|
|
220
|
-
webhook?: TaskRunAPI.Webhook | null;
|
|
221
|
-
|
|
222
|
-
/**
|
|
223
|
-
* Header param: Optional header to specify the beta version(s) to enable.
|
|
224
|
-
*/
|
|
225
|
-
betas?: Array<ParallelBeta>;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export interface TaskRunResultParams {
|
|
229
|
-
/**
|
|
230
|
-
* Query param
|
|
231
|
-
*/
|
|
232
|
-
timeout?: number;
|
|
233
|
-
|
|
234
|
-
/**
|
|
235
|
-
* Header param: Optional header to specify the beta version(s) to enable.
|
|
236
|
-
*/
|
|
237
|
-
betas?: Array<ParallelBeta>;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
export declare namespace TaskRun {
|
|
241
|
-
export {
|
|
242
|
-
type ParallelBeta as ParallelBeta,
|
|
243
|
-
type TaskRunEventsResponse as TaskRunEventsResponse,
|
|
244
|
-
type BetaRunInput as BetaRunInput,
|
|
245
|
-
type BetaTaskRunResult as BetaTaskRunResult,
|
|
246
|
-
type Webhook as Webhook,
|
|
247
|
-
type McpServer as McpServer,
|
|
248
|
-
type McpToolCall as McpToolCall,
|
|
249
|
-
type TaskRunEvent as TaskRunEvent,
|
|
250
|
-
type ErrorEvent as ErrorEvent,
|
|
251
|
-
type TaskRunCreateParams as TaskRunCreateParams,
|
|
252
|
-
type TaskRunResultParams as TaskRunResultParams,
|
|
253
|
-
};
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// Backwards-compat namespace members (deprecated). Previously these types
|
|
257
|
-
// existed as nested interfaces under their parent's namespace; they've since
|
|
258
|
-
// moved to top-level model types in the GA `task-run` module.
|
|
259
|
-
type _TaskAdvancedSettings = TaskRunAPI.TaskAdvancedSettings;
|
|
260
|
-
type _TaskRunProgressMessageEvent = TaskRunAPI.TaskRunProgressMessageEvent;
|
|
261
|
-
type _TaskRunProgressStatsEvent = TaskRunAPI.TaskRunProgressStatsEvent;
|
|
262
|
-
type _TaskRunSourceStats = TaskRunAPI.TaskRunSourceStats;
|
|
263
|
-
export namespace TaskRunCreateParams {
|
|
264
|
-
/** @deprecated Use `Parallel.TaskAdvancedSettings` instead. */
|
|
265
|
-
export type AdvancedSettings = _TaskAdvancedSettings;
|
|
266
|
-
}
|
|
267
|
-
export namespace TaskRunEventsResponse {
|
|
268
|
-
/** @deprecated Use `Parallel.TaskRunProgressMessageEvent` instead. */
|
|
269
|
-
export type TaskRunProgressMessageEvent = _TaskRunProgressMessageEvent;
|
|
270
|
-
/** @deprecated Use `Parallel.TaskRunProgressStatsEvent` instead. */
|
|
271
|
-
export type TaskRunProgressStatsEvent = _TaskRunProgressStatsEvent;
|
|
272
|
-
export namespace TaskRunProgressStatsEvent {
|
|
273
|
-
/** @deprecated Use `Parallel.TaskRunSourceStats` instead. */
|
|
274
|
-
export type SourceStats = _TaskRunSourceStats;
|
|
275
|
-
}
|
|
276
|
-
}
|