parallel-web 0.1.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 +65 -0
- package/LICENSE +7 -0
- package/README.md +371 -0
- package/api-promise.d.mts +2 -0
- package/api-promise.d.mts.map +1 -0
- package/api-promise.d.ts +2 -0
- package/api-promise.d.ts.map +1 -0
- package/api-promise.js +6 -0
- package/api-promise.js.map +1 -0
- package/api-promise.mjs +2 -0
- package/api-promise.mjs.map +1 -0
- package/client.d.mts +187 -0
- package/client.d.mts.map +1 -0
- package/client.d.ts +187 -0
- package/client.d.ts.map +1 -0
- package/client.js +462 -0
- package/client.js.map +1 -0
- package/client.mjs +458 -0
- package/client.mjs.map +1 -0
- package/core/api-promise.d.mts +46 -0
- package/core/api-promise.d.mts.map +1 -0
- package/core/api-promise.d.ts +46 -0
- package/core/api-promise.d.ts.map +1 -0
- package/core/api-promise.js +74 -0
- package/core/api-promise.js.map +1 -0
- package/core/api-promise.mjs +70 -0
- package/core/api-promise.mjs.map +1 -0
- package/core/error.d.mts +46 -0
- package/core/error.d.mts.map +1 -0
- package/core/error.d.ts +46 -0
- package/core/error.d.ts.map +1 -0
- package/core/error.js +113 -0
- package/core/error.js.map +1 -0
- package/core/error.mjs +97 -0
- package/core/error.mjs.map +1 -0
- package/core/resource.d.mts +6 -0
- package/core/resource.d.mts.map +1 -0
- package/core/resource.d.ts +6 -0
- package/core/resource.d.ts.map +1 -0
- package/core/resource.js +11 -0
- package/core/resource.js.map +1 -0
- package/core/resource.mjs +7 -0
- package/core/resource.mjs.map +1 -0
- package/core/streaming.d.mts +33 -0
- package/core/streaming.d.mts.map +1 -0
- package/core/streaming.d.ts +33 -0
- package/core/streaming.d.ts.map +1 -0
- package/core/streaming.js +263 -0
- package/core/streaming.js.map +1 -0
- package/core/streaming.mjs +258 -0
- package/core/streaming.mjs.map +1 -0
- package/core/uploads.d.mts +3 -0
- package/core/uploads.d.mts.map +1 -0
- package/core/uploads.d.ts +3 -0
- package/core/uploads.d.ts.map +1 -0
- package/core/uploads.js +6 -0
- package/core/uploads.js.map +1 -0
- package/core/uploads.mjs +2 -0
- package/core/uploads.mjs.map +1 -0
- package/error.d.mts +2 -0
- package/error.d.mts.map +1 -0
- package/error.d.ts +2 -0
- package/error.d.ts.map +1 -0
- package/error.js +6 -0
- package/error.js.map +1 -0
- package/error.mjs +2 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +6 -0
- package/index.d.mts.map +1 -0
- package/index.d.ts +6 -0
- package/index.d.ts.map +1 -0
- package/index.js +30 -0
- package/index.js.map +1 -0
- package/index.mjs +7 -0
- package/index.mjs.map +1 -0
- package/internal/builtin-types.d.mts +73 -0
- package/internal/builtin-types.d.mts.map +1 -0
- package/internal/builtin-types.d.ts +73 -0
- package/internal/builtin-types.d.ts.map +1 -0
- package/internal/builtin-types.js +4 -0
- package/internal/builtin-types.js.map +1 -0
- package/internal/builtin-types.mjs +3 -0
- package/internal/builtin-types.mjs.map +1 -0
- package/internal/decoders/line.d.mts +17 -0
- package/internal/decoders/line.d.mts.map +1 -0
- package/internal/decoders/line.d.ts +17 -0
- package/internal/decoders/line.d.ts.map +1 -0
- package/internal/decoders/line.js +113 -0
- package/internal/decoders/line.js.map +1 -0
- package/internal/decoders/line.mjs +108 -0
- package/internal/decoders/line.mjs.map +1 -0
- package/internal/detect-platform.d.mts +15 -0
- package/internal/detect-platform.d.mts.map +1 -0
- package/internal/detect-platform.d.ts +15 -0
- package/internal/detect-platform.d.ts.map +1 -0
- package/internal/detect-platform.js +162 -0
- package/internal/detect-platform.js.map +1 -0
- package/internal/detect-platform.mjs +157 -0
- package/internal/detect-platform.mjs.map +1 -0
- package/internal/errors.d.mts +3 -0
- package/internal/errors.d.mts.map +1 -0
- package/internal/errors.d.ts +3 -0
- package/internal/errors.d.ts.map +1 -0
- package/internal/errors.js +41 -0
- package/internal/errors.js.map +1 -0
- package/internal/errors.mjs +36 -0
- package/internal/errors.mjs.map +1 -0
- package/internal/headers.d.mts +20 -0
- package/internal/headers.d.mts.map +1 -0
- package/internal/headers.d.ts +20 -0
- package/internal/headers.d.ts.map +1 -0
- package/internal/headers.js +79 -0
- package/internal/headers.js.map +1 -0
- package/internal/headers.mjs +74 -0
- package/internal/headers.mjs.map +1 -0
- package/internal/parse.d.mts +12 -0
- package/internal/parse.d.mts.map +1 -0
- package/internal/parse.d.ts +12 -0
- package/internal/parse.d.ts.map +1 -0
- package/internal/parse.js +45 -0
- package/internal/parse.js.map +1 -0
- package/internal/parse.mjs +42 -0
- package/internal/parse.mjs.map +1 -0
- package/internal/request-options.d.mts +77 -0
- package/internal/request-options.d.mts.map +1 -0
- package/internal/request-options.d.ts +77 -0
- package/internal/request-options.d.ts.map +1 -0
- package/internal/request-options.js +14 -0
- package/internal/request-options.js.map +1 -0
- package/internal/request-options.mjs +10 -0
- package/internal/request-options.mjs.map +1 -0
- package/internal/shim-types.d.mts +17 -0
- package/internal/shim-types.d.mts.map +1 -0
- package/internal/shim-types.d.ts +17 -0
- package/internal/shim-types.d.ts.map +1 -0
- package/internal/shim-types.js +4 -0
- package/internal/shim-types.js.map +1 -0
- package/internal/shim-types.mjs +3 -0
- package/internal/shim-types.mjs.map +1 -0
- package/internal/shims.d.mts +20 -0
- package/internal/shims.d.mts.map +1 -0
- package/internal/shims.d.ts +20 -0
- package/internal/shims.d.ts.map +1 -0
- package/internal/shims.js +92 -0
- package/internal/shims.js.map +1 -0
- package/internal/shims.mjs +85 -0
- package/internal/shims.mjs.map +1 -0
- package/internal/to-file.d.mts +45 -0
- package/internal/to-file.d.mts.map +1 -0
- package/internal/to-file.d.ts +45 -0
- package/internal/to-file.d.ts.map +1 -0
- package/internal/to-file.js +91 -0
- package/internal/to-file.js.map +1 -0
- package/internal/to-file.mjs +88 -0
- package/internal/to-file.mjs.map +1 -0
- package/internal/tslib.js +81 -0
- package/internal/tslib.mjs +17 -0
- package/internal/types.d.mts +69 -0
- package/internal/types.d.mts.map +1 -0
- package/internal/types.d.ts +69 -0
- package/internal/types.d.ts.map +1 -0
- package/internal/types.js +4 -0
- package/internal/types.js.map +1 -0
- package/internal/types.mjs +3 -0
- package/internal/types.mjs.map +1 -0
- package/internal/uploads.d.mts +42 -0
- package/internal/uploads.d.mts.map +1 -0
- package/internal/uploads.d.ts +42 -0
- package/internal/uploads.d.ts.map +1 -0
- package/internal/uploads.js +141 -0
- package/internal/uploads.js.map +1 -0
- package/internal/uploads.mjs +131 -0
- package/internal/uploads.mjs.map +1 -0
- package/internal/utils/base64.d.mts +3 -0
- package/internal/utils/base64.d.mts.map +1 -0
- package/internal/utils/base64.d.ts +3 -0
- package/internal/utils/base64.d.ts.map +1 -0
- package/internal/utils/base64.js +38 -0
- package/internal/utils/base64.js.map +1 -0
- package/internal/utils/base64.mjs +33 -0
- package/internal/utils/base64.mjs.map +1 -0
- package/internal/utils/bytes.d.mts +4 -0
- package/internal/utils/bytes.d.mts.map +1 -0
- package/internal/utils/bytes.d.ts +4 -0
- package/internal/utils/bytes.d.ts.map +1 -0
- package/internal/utils/bytes.js +31 -0
- package/internal/utils/bytes.js.map +1 -0
- package/internal/utils/bytes.mjs +26 -0
- package/internal/utils/bytes.mjs.map +1 -0
- package/internal/utils/env.d.mts +9 -0
- package/internal/utils/env.d.mts.map +1 -0
- package/internal/utils/env.d.ts +9 -0
- package/internal/utils/env.d.ts.map +1 -0
- package/internal/utils/env.js +22 -0
- package/internal/utils/env.js.map +1 -0
- package/internal/utils/env.mjs +18 -0
- package/internal/utils/env.mjs.map +1 -0
- package/internal/utils/log.d.mts +37 -0
- package/internal/utils/log.d.mts.map +1 -0
- package/internal/utils/log.d.ts +37 -0
- package/internal/utils/log.d.ts.map +1 -0
- package/internal/utils/log.js +86 -0
- package/internal/utils/log.js.map +1 -0
- package/internal/utils/log.mjs +80 -0
- package/internal/utils/log.mjs.map +1 -0
- package/internal/utils/path.d.mts +15 -0
- package/internal/utils/path.d.mts.map +1 -0
- package/internal/utils/path.d.ts +15 -0
- package/internal/utils/path.d.ts.map +1 -0
- package/internal/utils/path.js +79 -0
- package/internal/utils/path.js.map +1 -0
- package/internal/utils/path.mjs +74 -0
- package/internal/utils/path.mjs.map +1 -0
- package/internal/utils/sleep.d.mts +2 -0
- package/internal/utils/sleep.d.mts.map +1 -0
- package/internal/utils/sleep.d.ts +2 -0
- package/internal/utils/sleep.d.ts.map +1 -0
- package/internal/utils/sleep.js +7 -0
- package/internal/utils/sleep.js.map +1 -0
- package/internal/utils/sleep.mjs +3 -0
- package/internal/utils/sleep.mjs.map +1 -0
- package/internal/utils/uuid.d.mts +5 -0
- package/internal/utils/uuid.d.mts.map +1 -0
- package/internal/utils/uuid.d.ts +5 -0
- package/internal/utils/uuid.d.ts.map +1 -0
- package/internal/utils/uuid.js +19 -0
- package/internal/utils/uuid.js.map +1 -0
- package/internal/utils/uuid.mjs +15 -0
- package/internal/utils/uuid.mjs.map +1 -0
- package/internal/utils/values.d.mts +18 -0
- package/internal/utils/values.d.mts.map +1 -0
- package/internal/utils/values.d.ts +18 -0
- package/internal/utils/values.d.ts.map +1 -0
- package/internal/utils/values.js +112 -0
- package/internal/utils/values.js.map +1 -0
- package/internal/utils/values.mjs +94 -0
- package/internal/utils/values.mjs.map +1 -0
- package/internal/utils.d.mts +7 -0
- package/internal/utils.d.mts.map +1 -0
- package/internal/utils.d.ts +7 -0
- package/internal/utils.d.ts.map +1 -0
- package/internal/utils.js +11 -0
- package/internal/utils.js.map +1 -0
- package/internal/utils.mjs +8 -0
- package/internal/utils.mjs.map +1 -0
- package/package.json +148 -0
- package/resource.d.mts +2 -0
- package/resource.d.mts.map +1 -0
- package/resource.d.ts +2 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +6 -0
- package/resource.js.map +1 -0
- package/resource.mjs +2 -0
- package/resource.mjs.map +1 -0
- package/resources/beta/beta.d.mts +86 -0
- package/resources/beta/beta.d.mts.map +1 -0
- package/resources/beta/beta.d.ts +86 -0
- package/resources/beta/beta.d.ts.map +1 -0
- package/resources/beta/beta.js +25 -0
- package/resources/beta/beta.js.map +1 -0
- package/resources/beta/beta.mjs +20 -0
- package/resources/beta/beta.mjs.map +1 -0
- package/resources/beta/index.d.mts +4 -0
- package/resources/beta/index.d.mts.map +1 -0
- package/resources/beta/index.d.ts +4 -0
- package/resources/beta/index.d.ts.map +1 -0
- package/resources/beta/index.js +11 -0
- package/resources/beta/index.js.map +1 -0
- package/resources/beta/index.mjs +5 -0
- package/resources/beta/index.mjs.map +1 -0
- package/resources/beta/task-group.d.mts +178 -0
- package/resources/beta/task-group.d.mts.map +1 -0
- package/resources/beta/task-group.d.ts +178 -0
- package/resources/beta/task-group.d.ts.map +1 -0
- package/resources/beta/task-group.js +62 -0
- package/resources/beta/task-group.js.map +1 -0
- package/resources/beta/task-group.mjs +58 -0
- package/resources/beta/task-group.mjs.map +1 -0
- package/resources/beta/task-run.d.mts +411 -0
- package/resources/beta/task-run.d.mts.map +1 -0
- package/resources/beta/task-run.d.ts +411 -0
- package/resources/beta/task-run.d.ts.map +1 -0
- package/resources/beta/task-run.js +59 -0
- package/resources/beta/task-run.js.map +1 -0
- package/resources/beta/task-run.mjs +55 -0
- package/resources/beta/task-run.mjs.map +1 -0
- package/resources/beta.d.mts +2 -0
- package/resources/beta.d.mts.map +1 -0
- package/resources/beta.d.ts +2 -0
- package/resources/beta.d.ts.map +1 -0
- package/resources/beta.js +6 -0
- package/resources/beta.js.map +1 -0
- package/resources/beta.mjs +3 -0
- package/resources/beta.mjs.map +1 -0
- package/resources/index.d.mts +4 -0
- package/resources/index.d.mts.map +1 -0
- package/resources/index.d.ts +4 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +11 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +5 -0
- package/resources/index.mjs.map +1 -0
- package/resources/shared.d.mts +70 -0
- package/resources/shared.d.mts.map +1 -0
- package/resources/shared.d.ts +70 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/task-run.d.mts +338 -0
- package/resources/task-run.d.mts.map +1 -0
- package/resources/task-run.d.ts +338 -0
- package/resources/task-run.d.ts.map +1 -0
- package/resources/task-run.js +34 -0
- package/resources/task-run.js.map +1 -0
- package/resources/task-run.mjs +30 -0
- package/resources/task-run.mjs.map +1 -0
- package/resources.d.mts +2 -0
- package/resources.d.mts.map +1 -0
- package/resources.d.ts +2 -0
- package/resources.d.ts.map +1 -0
- package/resources.js +5 -0
- package/resources.js.map +1 -0
- package/resources.mjs +2 -0
- package/resources.mjs.map +1 -0
- package/src/api-promise.ts +2 -0
- package/src/client.ts +763 -0
- package/src/core/README.md +3 -0
- package/src/core/api-promise.ts +92 -0
- package/src/core/error.ts +130 -0
- package/src/core/resource.ts +11 -0
- package/src/core/streaming.ts +315 -0
- package/src/core/uploads.ts +2 -0
- package/src/error.ts +2 -0
- package/src/index.ts +22 -0
- package/src/internal/README.md +3 -0
- package/src/internal/builtin-types.ts +93 -0
- package/src/internal/decoders/line.ts +135 -0
- package/src/internal/detect-platform.ts +196 -0
- package/src/internal/errors.ts +33 -0
- package/src/internal/headers.ts +97 -0
- package/src/internal/parse.ts +64 -0
- package/src/internal/request-options.ts +93 -0
- package/src/internal/shim-types.ts +26 -0
- package/src/internal/shims.ts +107 -0
- package/src/internal/to-file.ts +154 -0
- package/src/internal/types.ts +95 -0
- package/src/internal/uploads.ts +187 -0
- package/src/internal/utils/base64.ts +40 -0
- package/src/internal/utils/bytes.ts +32 -0
- package/src/internal/utils/env.ts +18 -0
- package/src/internal/utils/log.ts +127 -0
- package/src/internal/utils/path.ts +88 -0
- package/src/internal/utils/sleep.ts +3 -0
- package/src/internal/utils/uuid.ts +17 -0
- package/src/internal/utils/values.ts +105 -0
- package/src/internal/utils.ts +8 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +2 -0
- package/src/resources/beta/beta.ts +157 -0
- package/src/resources/beta/index.ts +28 -0
- package/src/resources/beta/task-group.ts +270 -0
- package/src/resources/beta/task-run.ts +517 -0
- package/src/resources/beta.ts +3 -0
- package/src/resources/index.ts +19 -0
- package/src/resources/shared.ts +76 -0
- package/src/resources/task-run.ts +394 -0
- package/src/resources.ts +1 -0
- package/src/streaming.ts +2 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +2 -0
- package/src/version.ts +1 -0
- package/streaming.d.mts +2 -0
- package/streaming.d.mts.map +1 -0
- package/streaming.d.ts +2 -0
- package/streaming.d.ts.map +1 -0
- package/streaming.js +6 -0
- package/streaming.js.map +1 -0
- package/streaming.mjs +2 -0
- package/streaming.mjs.map +1 -0
- package/uploads.d.mts +2 -0
- package/uploads.d.mts.map +1 -0
- package/uploads.d.ts +2 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +6 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +2 -0
- package/uploads.mjs.map +1 -0
- package/version.d.mts +2 -0
- package/version.d.mts.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,517 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as BetaTaskRunAPI from './task-run';
|
|
5
|
+
import * as Shared from '../shared';
|
|
6
|
+
import * as TaskRunAPI 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
|
+
export class TaskRun extends APIResource {
|
|
14
|
+
/**
|
|
15
|
+
* Initiates a task run.
|
|
16
|
+
*
|
|
17
|
+
* Returns immediately with a run object in status 'queued'.
|
|
18
|
+
*
|
|
19
|
+
* Beta features can be enabled by setting the 'parallel-beta' header.
|
|
20
|
+
*/
|
|
21
|
+
create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise<TaskRunAPI.TaskRun> {
|
|
22
|
+
const { betas, ...body } = params;
|
|
23
|
+
return this._client.post('/v1/tasks/runs?beta=true', {
|
|
24
|
+
body,
|
|
25
|
+
...options,
|
|
26
|
+
headers: buildHeaders([
|
|
27
|
+
{ ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
|
|
28
|
+
options?.headers,
|
|
29
|
+
]),
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Streams events for a task run.
|
|
35
|
+
*
|
|
36
|
+
* Returns a stream of events showing progress updates and state changes for the
|
|
37
|
+
* task run.
|
|
38
|
+
*
|
|
39
|
+
* For task runs that did not have enable_events set to true during creation, the
|
|
40
|
+
* frequency of events will be reduced.
|
|
41
|
+
*/
|
|
42
|
+
events(runID: string, options?: RequestOptions): APIPromise<Stream<TaskRunEventsResponse>> {
|
|
43
|
+
return this._client.get(path`/v1beta/tasks/runs/${runID}/events`, {
|
|
44
|
+
...options,
|
|
45
|
+
headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
|
|
46
|
+
stream: true,
|
|
47
|
+
}) as APIPromise<Stream<TaskRunEventsResponse>>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Retrieves a run result by run_id, blocking until the run is completed.
|
|
52
|
+
*/
|
|
53
|
+
result(
|
|
54
|
+
runID: string,
|
|
55
|
+
params: TaskRunResultParams | null | undefined = {},
|
|
56
|
+
options?: RequestOptions,
|
|
57
|
+
): APIPromise<BetaTaskRunResult> {
|
|
58
|
+
const { betas, ...query } = params ?? {};
|
|
59
|
+
return this._client.get(path`/v1/tasks/runs/${runID}/result?beta=true`, {
|
|
60
|
+
query,
|
|
61
|
+
...options,
|
|
62
|
+
headers: buildHeaders([
|
|
63
|
+
{ ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
|
|
64
|
+
options?.headers,
|
|
65
|
+
]),
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Task run input with additional beta fields.
|
|
72
|
+
*/
|
|
73
|
+
export interface BetaRunInput {
|
|
74
|
+
/**
|
|
75
|
+
* Input to the task, either text or a JSON object.
|
|
76
|
+
*/
|
|
77
|
+
input: string | { [key: string]: unknown };
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Processor to use for the task.
|
|
81
|
+
*/
|
|
82
|
+
processor: string;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Controls tracking of task run execution progress. When set to true, progress
|
|
86
|
+
* events are recorded and can be accessed via the
|
|
87
|
+
* [Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
|
|
88
|
+
* false, no progress events are tracked. Note that progress tracking cannot be
|
|
89
|
+
* enabled after a run has been created. The flag is set to true by default for
|
|
90
|
+
* premium processors (pro and above). This feature is not available via the Python
|
|
91
|
+
* SDK. To enable this feature in your API requests, specify the `parallel-beta`
|
|
92
|
+
* header with `events-sse-2025-07-24` value.
|
|
93
|
+
*/
|
|
94
|
+
enable_events?: boolean | null;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Optional list of MCP servers to use for the run. This feature is not available
|
|
98
|
+
* via the Python SDK. To enable this feature in your API requests, specify the
|
|
99
|
+
* `parallel-beta` header with `mcp-server-2025-07-17` value.
|
|
100
|
+
*/
|
|
101
|
+
mcp_servers?: Array<McpServer> | null;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* User-provided metadata stored with the run. Keys and values must be strings with
|
|
105
|
+
* a maximum length of 16 and 512 characters respectively.
|
|
106
|
+
*/
|
|
107
|
+
metadata?: { [key: string]: string | number | boolean } | null;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Source policy for web search results.
|
|
111
|
+
*
|
|
112
|
+
* This policy governs which sources are allowed/disallowed in results.
|
|
113
|
+
*/
|
|
114
|
+
source_policy?: Shared.SourcePolicy | null;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Specification for a task.
|
|
118
|
+
*
|
|
119
|
+
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
120
|
+
* Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
121
|
+
*
|
|
122
|
+
* For convenience bare strings are also accepted as input or output schemas.
|
|
123
|
+
*/
|
|
124
|
+
task_spec?: TaskRunAPI.TaskSpec | null;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Webhooks for Task Runs.
|
|
128
|
+
*/
|
|
129
|
+
webhook?: Webhook | null;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Result of a beta task run. Available only if beta headers are specified.
|
|
134
|
+
*/
|
|
135
|
+
export interface BetaTaskRunResult {
|
|
136
|
+
/**
|
|
137
|
+
* Output from the task conforming to the output schema.
|
|
138
|
+
*/
|
|
139
|
+
output: BetaTaskRunResult.BetaTaskRunTextOutput | BetaTaskRunResult.BetaTaskRunJsonOutput;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Status of a task run.
|
|
143
|
+
*/
|
|
144
|
+
run: TaskRunAPI.TaskRun;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
export namespace BetaTaskRunResult {
|
|
148
|
+
/**
|
|
149
|
+
* Output from a task that returns text.
|
|
150
|
+
*/
|
|
151
|
+
export interface BetaTaskRunTextOutput {
|
|
152
|
+
/**
|
|
153
|
+
* Basis for the output.
|
|
154
|
+
*/
|
|
155
|
+
basis: Array<TaskRunAPI.FieldBasis>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Text output from the task.
|
|
159
|
+
*/
|
|
160
|
+
content: string;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The type of output being returned, as determined by the output schema of the
|
|
164
|
+
* task spec.
|
|
165
|
+
*/
|
|
166
|
+
type: 'text';
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Always None.
|
|
170
|
+
*/
|
|
171
|
+
beta_fields?: { [key: string]: unknown } | null;
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* MCP tool calls made by the task.
|
|
175
|
+
*/
|
|
176
|
+
mcp_tool_calls?: Array<BetaTaskRunAPI.McpToolCall> | null;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Output from a task that returns JSON.
|
|
181
|
+
*/
|
|
182
|
+
export interface BetaTaskRunJsonOutput {
|
|
183
|
+
/**
|
|
184
|
+
* Basis for the output.
|
|
185
|
+
*/
|
|
186
|
+
basis: Array<TaskRunAPI.FieldBasis>;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Output from the task as a native JSON object, as determined by the output schema
|
|
190
|
+
* of the task spec.
|
|
191
|
+
*/
|
|
192
|
+
content: { [key: string]: unknown };
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* The type of output being returned, as determined by the output schema of the
|
|
196
|
+
* task spec.
|
|
197
|
+
*/
|
|
198
|
+
type: 'json';
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Always None.
|
|
202
|
+
*/
|
|
203
|
+
beta_fields?: { [key: string]: unknown } | null;
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* MCP tool calls made by the task.
|
|
207
|
+
*/
|
|
208
|
+
mcp_tool_calls?: Array<BetaTaskRunAPI.McpToolCall> | null;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Output schema for the Task Run. Populated only if the task was executed with an
|
|
212
|
+
* auto schema.
|
|
213
|
+
*/
|
|
214
|
+
output_schema?: { [key: string]: unknown } | null;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/**
|
|
219
|
+
* Event indicating an error.
|
|
220
|
+
*/
|
|
221
|
+
export interface ErrorEvent {
|
|
222
|
+
/**
|
|
223
|
+
* An error message.
|
|
224
|
+
*/
|
|
225
|
+
error: Shared.ErrorObject;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Event type; always 'error'.
|
|
229
|
+
*/
|
|
230
|
+
type: 'error';
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/**
|
|
234
|
+
* MCP server configuration.
|
|
235
|
+
*/
|
|
236
|
+
export interface McpServer {
|
|
237
|
+
/**
|
|
238
|
+
* Name of the MCP server.
|
|
239
|
+
*/
|
|
240
|
+
name: string;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* URL of the MCP server.
|
|
244
|
+
*/
|
|
245
|
+
url: string;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* List of allowed tools for the MCP server.
|
|
249
|
+
*/
|
|
250
|
+
allowed_tools?: Array<string> | null;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Headers for the MCP server.
|
|
254
|
+
*/
|
|
255
|
+
headers?: { [key: string]: string } | null;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Type of MCP server being configured. Always `url`.
|
|
259
|
+
*/
|
|
260
|
+
type?: 'url';
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* Result of an MCP tool call.
|
|
265
|
+
*/
|
|
266
|
+
export interface McpToolCall {
|
|
267
|
+
/**
|
|
268
|
+
* Arguments used to call the MCP tool.
|
|
269
|
+
*/
|
|
270
|
+
arguments: string;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Name of the MCP server.
|
|
274
|
+
*/
|
|
275
|
+
server_name: string;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Identifier for the tool call.
|
|
279
|
+
*/
|
|
280
|
+
tool_call_id: string;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Name of the tool being called.
|
|
284
|
+
*/
|
|
285
|
+
tool_name: string;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Output received from the tool call, if successful.
|
|
289
|
+
*/
|
|
290
|
+
content?: string | null;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Error message if the tool call failed.
|
|
294
|
+
*/
|
|
295
|
+
error?: string | null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Model for the parallel-beta header.
|
|
300
|
+
*/
|
|
301
|
+
export type ParallelBeta =
|
|
302
|
+
| 'mcp-server-2025-07-17'
|
|
303
|
+
| 'events-sse-2025-07-24'
|
|
304
|
+
| 'webhook-2025-08-12'
|
|
305
|
+
| (string & {});
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Event when a task run transitions to a non-active status.
|
|
309
|
+
*
|
|
310
|
+
* May indicate completion, cancellation, or failure.
|
|
311
|
+
*/
|
|
312
|
+
export interface TaskRunEvent {
|
|
313
|
+
/**
|
|
314
|
+
* Cursor to resume the event stream. Always empty for non Task Group runs.
|
|
315
|
+
*/
|
|
316
|
+
event_id: string | null;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Status of a task run.
|
|
320
|
+
*/
|
|
321
|
+
run: TaskRunAPI.TaskRun;
|
|
322
|
+
|
|
323
|
+
/**
|
|
324
|
+
* Event type; always 'task_run.state'.
|
|
325
|
+
*/
|
|
326
|
+
type: 'task_run.state';
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Task run input with additional beta fields.
|
|
330
|
+
*/
|
|
331
|
+
input?: BetaRunInput | null;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Output from the run; included only if requested and if status == `completed`.
|
|
335
|
+
*/
|
|
336
|
+
output?: TaskRunAPI.TaskRunTextOutput | TaskRunAPI.TaskRunJsonOutput | null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Webhooks for Task Runs.
|
|
341
|
+
*/
|
|
342
|
+
export interface Webhook {
|
|
343
|
+
/**
|
|
344
|
+
* URL for the webhook.
|
|
345
|
+
*/
|
|
346
|
+
url: string;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Event types to send the webhook notifications for.
|
|
350
|
+
*/
|
|
351
|
+
event_types?: Array<'task_run.status'>;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* A progress update for a task run.
|
|
356
|
+
*/
|
|
357
|
+
export type TaskRunEventsResponse =
|
|
358
|
+
| TaskRunEventsResponse.TaskRunProgressStatsEvent
|
|
359
|
+
| TaskRunEventsResponse.TaskRunProgressMessageEvent
|
|
360
|
+
| TaskRunEvent
|
|
361
|
+
| ErrorEvent;
|
|
362
|
+
|
|
363
|
+
export namespace TaskRunEventsResponse {
|
|
364
|
+
/**
|
|
365
|
+
* A progress update for a task run.
|
|
366
|
+
*/
|
|
367
|
+
export interface TaskRunProgressStatsEvent {
|
|
368
|
+
/**
|
|
369
|
+
* Source stats for a task run.
|
|
370
|
+
*/
|
|
371
|
+
source_stats: TaskRunProgressStatsEvent.SourceStats;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Event type; always 'task_run.progress_stats'.
|
|
375
|
+
*/
|
|
376
|
+
type: 'task_run.progress_stats';
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
export namespace TaskRunProgressStatsEvent {
|
|
380
|
+
/**
|
|
381
|
+
* Source stats for a task run.
|
|
382
|
+
*/
|
|
383
|
+
export interface SourceStats {
|
|
384
|
+
/**
|
|
385
|
+
* Number of sources considered in processing the task.
|
|
386
|
+
*/
|
|
387
|
+
num_sources_considered: number | null;
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Number of sources read in processing the task.
|
|
391
|
+
*/
|
|
392
|
+
num_sources_read: number | null;
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
|
+
* A sample of URLs of sources read in processing the task.
|
|
396
|
+
*/
|
|
397
|
+
sources_read_sample: Array<string> | null;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* A message for a task run progress update.
|
|
403
|
+
*/
|
|
404
|
+
export interface TaskRunProgressMessageEvent {
|
|
405
|
+
/**
|
|
406
|
+
* Progress update message.
|
|
407
|
+
*/
|
|
408
|
+
message: string;
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Timestamp of the message.
|
|
412
|
+
*/
|
|
413
|
+
timestamp: string | null;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Event type; always starts with 'task_run.progress_msg'.
|
|
417
|
+
*/
|
|
418
|
+
type:
|
|
419
|
+
| 'task_run.progress_msg.plan'
|
|
420
|
+
| 'task_run.progress_msg.search'
|
|
421
|
+
| 'task_run.progress_msg.result'
|
|
422
|
+
| 'task_run.progress_msg.tool_call'
|
|
423
|
+
| 'task_run.progress_msg.exec_status';
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
export interface TaskRunCreateParams {
|
|
428
|
+
/**
|
|
429
|
+
* Body param: Input to the task, either text or a JSON object.
|
|
430
|
+
*/
|
|
431
|
+
input: string | { [key: string]: unknown };
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Body param: Processor to use for the task.
|
|
435
|
+
*/
|
|
436
|
+
processor: string;
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Body param: Controls tracking of task run execution progress. When set to true,
|
|
440
|
+
* progress events are recorded and can be accessed via the
|
|
441
|
+
* [Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
|
|
442
|
+
* false, no progress events are tracked. Note that progress tracking cannot be
|
|
443
|
+
* enabled after a run has been created. The flag is set to true by default for
|
|
444
|
+
* premium processors (pro and above). This feature is not available via the Python
|
|
445
|
+
* SDK. To enable this feature in your API requests, specify the `parallel-beta`
|
|
446
|
+
* header with `events-sse-2025-07-24` value.
|
|
447
|
+
*/
|
|
448
|
+
enable_events?: boolean | null;
|
|
449
|
+
|
|
450
|
+
/**
|
|
451
|
+
* Body param: Optional list of MCP servers to use for the run. This feature is not
|
|
452
|
+
* available via the Python SDK. To enable this feature in your API requests,
|
|
453
|
+
* specify the `parallel-beta` header with `mcp-server-2025-07-17` value.
|
|
454
|
+
*/
|
|
455
|
+
mcp_servers?: Array<McpServer> | null;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Body param: User-provided metadata stored with the run. Keys and values must be
|
|
459
|
+
* strings with a maximum length of 16 and 512 characters respectively.
|
|
460
|
+
*/
|
|
461
|
+
metadata?: { [key: string]: string | number | boolean } | null;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Body param: Source policy for web search results.
|
|
465
|
+
*
|
|
466
|
+
* This policy governs which sources are allowed/disallowed in results.
|
|
467
|
+
*/
|
|
468
|
+
source_policy?: Shared.SourcePolicy | null;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Body param: Specification for a task.
|
|
472
|
+
*
|
|
473
|
+
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
|
|
474
|
+
* Not specifying a TaskSpec is the same as setting an auto output schema.
|
|
475
|
+
*
|
|
476
|
+
* For convenience bare strings are also accepted as input or output schemas.
|
|
477
|
+
*/
|
|
478
|
+
task_spec?: TaskRunAPI.TaskSpec | null;
|
|
479
|
+
|
|
480
|
+
/**
|
|
481
|
+
* Body param: Webhooks for Task Runs.
|
|
482
|
+
*/
|
|
483
|
+
webhook?: Webhook | null;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Header param: Optional header to specify the beta version(s) to enable.
|
|
487
|
+
*/
|
|
488
|
+
betas?: Array<ParallelBeta>;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
export interface TaskRunResultParams {
|
|
492
|
+
/**
|
|
493
|
+
* Query param:
|
|
494
|
+
*/
|
|
495
|
+
timeout?: number;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Header param: Optional header to specify the beta version(s) to enable.
|
|
499
|
+
*/
|
|
500
|
+
betas?: Array<ParallelBeta>;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
export declare namespace TaskRun {
|
|
504
|
+
export {
|
|
505
|
+
type BetaRunInput as BetaRunInput,
|
|
506
|
+
type BetaTaskRunResult as BetaTaskRunResult,
|
|
507
|
+
type ErrorEvent as ErrorEvent,
|
|
508
|
+
type McpServer as McpServer,
|
|
509
|
+
type McpToolCall as McpToolCall,
|
|
510
|
+
type ParallelBeta as ParallelBeta,
|
|
511
|
+
type TaskRunEvent as TaskRunEvent,
|
|
512
|
+
type Webhook as Webhook,
|
|
513
|
+
type TaskRunEventsResponse as TaskRunEventsResponse,
|
|
514
|
+
type TaskRunCreateParams as TaskRunCreateParams,
|
|
515
|
+
type TaskRunResultParams as TaskRunResultParams,
|
|
516
|
+
};
|
|
517
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export * from './shared';
|
|
4
|
+
export { Beta } from './beta/beta';
|
|
5
|
+
export {
|
|
6
|
+
TaskRun,
|
|
7
|
+
type AutoSchema,
|
|
8
|
+
type Citation,
|
|
9
|
+
type FieldBasis,
|
|
10
|
+
type JsonSchema,
|
|
11
|
+
type RunInput,
|
|
12
|
+
type TaskRunJsonOutput,
|
|
13
|
+
type TaskRunResult,
|
|
14
|
+
type TaskRunTextOutput,
|
|
15
|
+
type TaskSpec,
|
|
16
|
+
type TextSchema,
|
|
17
|
+
type TaskRunCreateParams,
|
|
18
|
+
type TaskRunResultParams,
|
|
19
|
+
} from './task-run';
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* An error message.
|
|
5
|
+
*/
|
|
6
|
+
export interface ErrorObject {
|
|
7
|
+
/**
|
|
8
|
+
* Human-readable message.
|
|
9
|
+
*/
|
|
10
|
+
message: string;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Reference ID for the error.
|
|
14
|
+
*/
|
|
15
|
+
ref_id: string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Optional detail supporting the error.
|
|
19
|
+
*/
|
|
20
|
+
detail?: { [key: string]: unknown } | null;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Response object used for non-200 status codes.
|
|
25
|
+
*/
|
|
26
|
+
export interface ErrorResponse {
|
|
27
|
+
/**
|
|
28
|
+
* An error message.
|
|
29
|
+
*/
|
|
30
|
+
error: ErrorObject;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Always 'error'.
|
|
34
|
+
*/
|
|
35
|
+
type: 'error';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Source policy for web search results.
|
|
40
|
+
*
|
|
41
|
+
* This policy governs which sources are allowed/disallowed in results.
|
|
42
|
+
*/
|
|
43
|
+
export interface SourcePolicy {
|
|
44
|
+
/**
|
|
45
|
+
* List of domains to exclude from results. If specified, sources from these
|
|
46
|
+
* domains will be excluded.
|
|
47
|
+
*/
|
|
48
|
+
exclude_domains?: Array<string>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* List of domains to restrict the results to. If specified, only sources from
|
|
52
|
+
* these domains will be included.
|
|
53
|
+
*/
|
|
54
|
+
include_domains?: Array<string>;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Human-readable message for a task.
|
|
59
|
+
*/
|
|
60
|
+
export interface Warning {
|
|
61
|
+
/**
|
|
62
|
+
* Human-readable message.
|
|
63
|
+
*/
|
|
64
|
+
message: string;
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Type of warning. Note that adding new warning types is considered a
|
|
68
|
+
* backward-compatible change.
|
|
69
|
+
*/
|
|
70
|
+
type: 'spec_validation_warning' | 'input_validation_warning' | 'warning';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Optional detail supporting the warning.
|
|
74
|
+
*/
|
|
75
|
+
detail?: { [key: string]: unknown } | null;
|
|
76
|
+
}
|