parallel-web 0.3.1 → 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 +76 -0
- package/README.md +2 -2
- package/client.d.mts +46 -3
- package/client.d.mts.map +1 -1
- package/client.d.ts +46 -3
- package/client.d.ts.map +1 -1
- package/client.js +66 -19
- package/client.js.map +1 -1
- package/client.mjs +66 -19
- package/client.mjs.map +1 -1
- package/core/streaming.js.map +1 -1
- package/core/streaming.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.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/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +12 -1
- package/resources/beta/beta.d.mts +52 -72
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +52 -72
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +10 -4
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +10 -4
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/findall.d.mts +171 -9
- package/resources/beta/findall.d.mts.map +1 -1
- package/resources/beta/findall.d.ts +171 -9
- package/resources/beta/findall.d.ts.map +1 -1
- package/resources/beta/findall.js +111 -0
- package/resources/beta/findall.js.map +1 -1
- package/resources/beta/findall.mjs +111 -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 +60 -4
- package/resources/beta/task-group.d.mts.map +1 -1
- package/resources/beta/task-group.d.ts +60 -4
- package/resources/beta/task-group.d.ts.map +1 -1
- package/resources/beta/task-group.js +52 -1
- package/resources/beta/task-group.js.map +1 -1
- package/resources/beta/task-group.mjs +52 -1
- package/resources/beta/task-group.mjs.map +1 -1
- package/resources/beta/task-run.d.mts +85 -266
- package/resources/beta/task-run.d.mts.map +1 -1
- package/resources/beta/task-run.d.ts +85 -266
- package/resources/beta/task-run.d.ts.map +1 -1
- package/resources/beta/task-run.js +21 -2
- package/resources/beta/task-run.js.map +1 -1
- package/resources/beta/task-run.mjs +21 -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 +324 -29
- package/resources/task-run.d.mts.map +1 -1
- package/resources/task-run.d.ts +324 -29
- package/resources/task-run.d.ts.map +1 -1
- package/resources/task-run.js +71 -4
- package/resources/task-run.js.map +1 -1
- package/resources/task-run.mjs +71 -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 +118 -24
- package/src/core/streaming.ts +2 -2
- package/src/internal/parse.ts +6 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/beta/api.md +87 -0
- package/src/resources/beta/beta.ts +67 -84
- package/src/resources/beta/findall.ts +191 -7
- package/src/resources/beta/index.ts +7 -4
- package/src/resources/beta/task-group.ts +64 -6
- package/src/resources/beta/task-run.ts +103 -300
- package/src/resources/index.ts +20 -0
- package/src/resources/shared.ts +4 -2
- package/src/resources/task-run.ts +410 -31
- 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
|
@@ -9,6 +9,9 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
9
9
|
import { RequestOptions } from '../../internal/request-options';
|
|
10
10
|
import { path } from '../../internal/utils/path';
|
|
11
11
|
|
|
12
|
+
/**
|
|
13
|
+
* The FindAll API discovers and evaluates entities that match complex criteria from natural language objectives. Submit a high-level goal and the service automatically generates structured match conditions, discovers relevant candidates, and evaluates each against the criteria. Returns comprehensive results with detailed reasoning, citations, and confidence scores for each match decision. Streaming events and webhooks are supported.
|
|
14
|
+
*/
|
|
12
15
|
export class FindAll extends APIResource {
|
|
13
16
|
/**
|
|
14
17
|
* Starts a FindAll run.
|
|
@@ -23,6 +26,23 @@ export class FindAll extends APIResource {
|
|
|
23
26
|
* /v1beta/findall/runs/{findall_id}/events endpoint,
|
|
24
27
|
* - Or specifying a webhook with relevant event types during run creation to
|
|
25
28
|
* receive notifications.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```ts
|
|
32
|
+
* const findallRun = await client.beta.findall.create({
|
|
33
|
+
* entity_type: 'entity_type',
|
|
34
|
+
* generator: 'base',
|
|
35
|
+
* match_conditions: [
|
|
36
|
+
* {
|
|
37
|
+
* description:
|
|
38
|
+
* "Company must have SOC2 Type II certification (not Type I). Look for evidence in: trust centers, security/compliance pages, audit reports, or press releases specifically mentioning 'SOC2 Type II'. If no explicit SOC2 Type II mention is found, consider requirement not satisfied.",
|
|
39
|
+
* name: 'name',
|
|
40
|
+
* },
|
|
41
|
+
* ],
|
|
42
|
+
* match_limit: 0,
|
|
43
|
+
* objective: 'objective',
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
26
46
|
*/
|
|
27
47
|
create(params: FindAllCreateParams, options?: RequestOptions): APIPromise<FindAllRun> {
|
|
28
48
|
const { betas, ...body } = params;
|
|
@@ -38,6 +58,13 @@ export class FindAll extends APIResource {
|
|
|
38
58
|
|
|
39
59
|
/**
|
|
40
60
|
* Retrieve a FindAll run.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const findallRun = await client.beta.findall.retrieve(
|
|
65
|
+
* 'findall_id',
|
|
66
|
+
* );
|
|
67
|
+
* ```
|
|
41
68
|
*/
|
|
42
69
|
retrieve(
|
|
43
70
|
findallID: string,
|
|
@@ -56,6 +83,13 @@ export class FindAll extends APIResource {
|
|
|
56
83
|
|
|
57
84
|
/**
|
|
58
85
|
* Cancel a FindAll run.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const response = await client.beta.findall.cancel(
|
|
90
|
+
* 'findall_id',
|
|
91
|
+
* );
|
|
92
|
+
* ```
|
|
59
93
|
*/
|
|
60
94
|
cancel(
|
|
61
95
|
findallID: string,
|
|
@@ -72,8 +106,49 @@ export class FindAll extends APIResource {
|
|
|
72
106
|
});
|
|
73
107
|
}
|
|
74
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Return ranked entity candidates matching a natural language objective.
|
|
111
|
+
*
|
|
112
|
+
* This endpoint performs a best-effort search optimised for low latency. For
|
|
113
|
+
* comprehensive match evaluation and enrichment, use the
|
|
114
|
+
* [FindAll API](https://docs.parallel.ai/findall-api/findall-quickstart).
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ```ts
|
|
118
|
+
* const findallCandidatesResponse =
|
|
119
|
+
* await client.beta.findall.candidates({
|
|
120
|
+
* entity_type: 'company',
|
|
121
|
+
* objective: 'objective',
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
candidates(body: FindAllCandidatesParams, options?: RequestOptions): APIPromise<FindAllCandidatesResponse> {
|
|
126
|
+
return this._client.post('/v1beta/findall/candidates', {
|
|
127
|
+
body,
|
|
128
|
+
...options,
|
|
129
|
+
headers: buildHeaders([{ 'parallel-beta': 'findall-2025-09-15' }, options?.headers]),
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
|
|
75
133
|
/**
|
|
76
134
|
* Add an enrichment to a FindAll run.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* const findallSchema = await client.beta.findall.enrich(
|
|
139
|
+
* 'findall_id',
|
|
140
|
+
* {
|
|
141
|
+
* output_schema: {
|
|
142
|
+
* json_schema: {
|
|
143
|
+
* additionalProperties: 'bar',
|
|
144
|
+
* properties: 'bar',
|
|
145
|
+
* required: 'bar',
|
|
146
|
+
* type: 'bar',
|
|
147
|
+
* },
|
|
148
|
+
* },
|
|
149
|
+
* },
|
|
150
|
+
* );
|
|
151
|
+
* ```
|
|
77
152
|
*/
|
|
78
153
|
enrich(
|
|
79
154
|
findallID: string,
|
|
@@ -98,6 +173,13 @@ export class FindAll extends APIResource {
|
|
|
98
173
|
* Optional event ID to resume from. timeout: Optional timeout in seconds. If None,
|
|
99
174
|
* keep connection alive as long as the run is going. If set, stop after specified
|
|
100
175
|
* duration.
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```ts
|
|
179
|
+
* const response = await client.beta.findall.events(
|
|
180
|
+
* 'findall_id',
|
|
181
|
+
* );
|
|
182
|
+
* ```
|
|
101
183
|
*/
|
|
102
184
|
events(
|
|
103
185
|
findallID: string,
|
|
@@ -118,6 +200,14 @@ export class FindAll extends APIResource {
|
|
|
118
200
|
|
|
119
201
|
/**
|
|
120
202
|
* Extend a FindAll run by adding additional matches to the current match limit.
|
|
203
|
+
*
|
|
204
|
+
* @example
|
|
205
|
+
* ```ts
|
|
206
|
+
* const findallSchema = await client.beta.findall.extend(
|
|
207
|
+
* 'findall_id',
|
|
208
|
+
* { additional_match_limit: 0 },
|
|
209
|
+
* );
|
|
210
|
+
* ```
|
|
121
211
|
*/
|
|
122
212
|
extend(
|
|
123
213
|
findallID: string,
|
|
@@ -142,6 +232,14 @@ export class FindAll extends APIResource {
|
|
|
142
232
|
*
|
|
143
233
|
* The generated specification serves as a suggested starting point and can be
|
|
144
234
|
* further customized by the user.
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* ```ts
|
|
238
|
+
* const findallSchema = await client.beta.findall.ingest({
|
|
239
|
+
* objective:
|
|
240
|
+
* 'Find all AI companies that raised Series A funding in 2024',
|
|
241
|
+
* });
|
|
242
|
+
* ```
|
|
145
243
|
*/
|
|
146
244
|
ingest(params: FindAllIngestParams, options?: RequestOptions): APIPromise<FindAllSchema> {
|
|
147
245
|
const { betas, ...body } = params;
|
|
@@ -157,6 +255,13 @@ export class FindAll extends APIResource {
|
|
|
157
255
|
|
|
158
256
|
/**
|
|
159
257
|
* Retrieve the FindAll run result at the time of the request.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* const findallRunResult = await client.beta.findall.result(
|
|
262
|
+
* 'findall_id',
|
|
263
|
+
* );
|
|
264
|
+
* ```
|
|
160
265
|
*/
|
|
161
266
|
result(
|
|
162
267
|
findallID: string,
|
|
@@ -175,6 +280,13 @@ export class FindAll extends APIResource {
|
|
|
175
280
|
|
|
176
281
|
/**
|
|
177
282
|
* Get FindAll Run Schema
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* ```ts
|
|
286
|
+
* const findallSchema = await client.beta.findall.schema(
|
|
287
|
+
* 'findall_id',
|
|
288
|
+
* );
|
|
289
|
+
* ```
|
|
178
290
|
*/
|
|
179
291
|
schema(
|
|
180
292
|
findallID: string,
|
|
@@ -269,6 +381,56 @@ export namespace FindAllCandidateMatchStatusEvent {
|
|
|
269
381
|
}
|
|
270
382
|
}
|
|
271
383
|
|
|
384
|
+
export interface FindAllCandidatesRequest {
|
|
385
|
+
/**
|
|
386
|
+
* Type of entity to search for.
|
|
387
|
+
*/
|
|
388
|
+
entity_type: 'company' | 'people';
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* Natural language description of target entities.
|
|
392
|
+
*/
|
|
393
|
+
objective: string;
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* Maximum number of candidates to return. Must be between 5 and 1000 (inclusive).
|
|
397
|
+
* May return fewer results. Defaults to 100.
|
|
398
|
+
*/
|
|
399
|
+
match_limit?: number;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export interface FindAllCandidatesResponse {
|
|
403
|
+
/**
|
|
404
|
+
* Candidate set request ID. Example:
|
|
405
|
+
* `candidate_set_cad0a6d2dec046bd95ae900527d880e7`
|
|
406
|
+
*/
|
|
407
|
+
candidate_set_id: string;
|
|
408
|
+
|
|
409
|
+
/**
|
|
410
|
+
* Ranked list of entity candidates.
|
|
411
|
+
*/
|
|
412
|
+
candidates: Array<FindAllCandidatesResponse.Candidate>;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
export namespace FindAllCandidatesResponse {
|
|
416
|
+
export interface Candidate {
|
|
417
|
+
/**
|
|
418
|
+
* Descriptive text about the entity.
|
|
419
|
+
*/
|
|
420
|
+
description: string;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Entity name.
|
|
424
|
+
*/
|
|
425
|
+
name: string;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Canonical URL for the entity.
|
|
429
|
+
*/
|
|
430
|
+
url: string;
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
272
434
|
/**
|
|
273
435
|
* Input model for FindAll enrich.
|
|
274
436
|
*/
|
|
@@ -281,7 +443,7 @@ export interface FindAllEnrichInput {
|
|
|
281
443
|
/**
|
|
282
444
|
* List of MCP servers to use for the task.
|
|
283
445
|
*/
|
|
284
|
-
mcp_servers?: Array<
|
|
446
|
+
mcp_servers?: Array<TaskRunAPI.McpServer> | null;
|
|
285
447
|
|
|
286
448
|
/**
|
|
287
449
|
* Processor to use for the task.
|
|
@@ -367,6 +529,7 @@ export namespace FindAllRun {
|
|
|
367
529
|
| 'user_cancelled'
|
|
368
530
|
| 'error_occurred'
|
|
369
531
|
| 'timeout'
|
|
532
|
+
| 'insufficient_funds'
|
|
370
533
|
| null;
|
|
371
534
|
}
|
|
372
535
|
|
|
@@ -409,7 +572,7 @@ export interface FindAllRunInput {
|
|
|
409
572
|
|
|
410
573
|
/**
|
|
411
574
|
* Maximum number of matches to find for this FindAll run. Must be between 5 and
|
|
412
|
-
* 1000 (inclusive).
|
|
575
|
+
* 1000 (inclusive). May return fewer results.
|
|
413
576
|
*/
|
|
414
577
|
match_limit: number;
|
|
415
578
|
|
|
@@ -431,7 +594,7 @@ export interface FindAllRunInput {
|
|
|
431
594
|
/**
|
|
432
595
|
* Webhooks for Task Runs.
|
|
433
596
|
*/
|
|
434
|
-
webhook?:
|
|
597
|
+
webhook?: TaskRunAPI.Webhook | null;
|
|
435
598
|
}
|
|
436
599
|
|
|
437
600
|
export namespace FindAllRunInput {
|
|
@@ -664,7 +827,7 @@ export type FindAllEventsResponse =
|
|
|
664
827
|
| FindAllSchemaUpdatedEvent
|
|
665
828
|
| FindAllRunStatusEvent
|
|
666
829
|
| FindAllCandidateMatchStatusEvent
|
|
667
|
-
|
|
|
830
|
+
| TaskRunAPI.ErrorEvent;
|
|
668
831
|
|
|
669
832
|
export interface FindAllCreateParams {
|
|
670
833
|
/**
|
|
@@ -684,7 +847,7 @@ export interface FindAllCreateParams {
|
|
|
684
847
|
|
|
685
848
|
/**
|
|
686
849
|
* Body param: Maximum number of matches to find for this FindAll run. Must be
|
|
687
|
-
* between 5 and 1000 (inclusive).
|
|
850
|
+
* between 5 and 1000 (inclusive). May return fewer results.
|
|
688
851
|
*/
|
|
689
852
|
match_limit: number;
|
|
690
853
|
|
|
@@ -706,7 +869,7 @@ export interface FindAllCreateParams {
|
|
|
706
869
|
/**
|
|
707
870
|
* Body param: Webhooks for Task Runs.
|
|
708
871
|
*/
|
|
709
|
-
webhook?:
|
|
872
|
+
webhook?: TaskRunAPI.Webhook | null;
|
|
710
873
|
|
|
711
874
|
/**
|
|
712
875
|
* Header param: Optional header to specify the beta version(s) to enable.
|
|
@@ -762,6 +925,24 @@ export interface FindAllCancelParams {
|
|
|
762
925
|
betas?: Array<BetaTaskRunAPI.ParallelBeta>;
|
|
763
926
|
}
|
|
764
927
|
|
|
928
|
+
export interface FindAllCandidatesParams {
|
|
929
|
+
/**
|
|
930
|
+
* Type of entity to search for.
|
|
931
|
+
*/
|
|
932
|
+
entity_type: 'company' | 'people';
|
|
933
|
+
|
|
934
|
+
/**
|
|
935
|
+
* Natural language description of target entities.
|
|
936
|
+
*/
|
|
937
|
+
objective: string;
|
|
938
|
+
|
|
939
|
+
/**
|
|
940
|
+
* Maximum number of candidates to return. Must be between 5 and 1000 (inclusive).
|
|
941
|
+
* May return fewer results. Defaults to 100.
|
|
942
|
+
*/
|
|
943
|
+
match_limit?: number;
|
|
944
|
+
}
|
|
945
|
+
|
|
765
946
|
export interface FindAllEnrichParams {
|
|
766
947
|
/**
|
|
767
948
|
* Body param: JSON schema for the enrichment output schema for the FindAll run.
|
|
@@ -771,7 +952,7 @@ export interface FindAllEnrichParams {
|
|
|
771
952
|
/**
|
|
772
953
|
* Body param: List of MCP servers to use for the task.
|
|
773
954
|
*/
|
|
774
|
-
mcp_servers?: Array<
|
|
955
|
+
mcp_servers?: Array<TaskRunAPI.McpServer> | null;
|
|
775
956
|
|
|
776
957
|
/**
|
|
777
958
|
* Body param: Processor to use for the task.
|
|
@@ -844,6 +1025,8 @@ export interface FindAllSchemaParams {
|
|
|
844
1025
|
export declare namespace FindAll {
|
|
845
1026
|
export {
|
|
846
1027
|
type FindAllCandidateMatchStatusEvent as FindAllCandidateMatchStatusEvent,
|
|
1028
|
+
type FindAllCandidatesRequest as FindAllCandidatesRequest,
|
|
1029
|
+
type FindAllCandidatesResponse as FindAllCandidatesResponse,
|
|
847
1030
|
type FindAllEnrichInput as FindAllEnrichInput,
|
|
848
1031
|
type FindAllExtendInput as FindAllExtendInput,
|
|
849
1032
|
type FindAllRun as FindAllRun,
|
|
@@ -858,6 +1041,7 @@ export declare namespace FindAll {
|
|
|
858
1041
|
type FindAllCreateParams as FindAllCreateParams,
|
|
859
1042
|
type FindAllRetrieveParams as FindAllRetrieveParams,
|
|
860
1043
|
type FindAllCancelParams as FindAllCancelParams,
|
|
1044
|
+
type FindAllCandidatesParams as FindAllCandidatesParams,
|
|
861
1045
|
type FindAllEnrichParams as FindAllEnrichParams,
|
|
862
1046
|
type FindAllEventsParams as FindAllEventsParams,
|
|
863
1047
|
type FindAllExtendParams as FindAllExtendParams,
|
|
@@ -5,6 +5,8 @@ export {
|
|
|
5
5
|
FindAll,
|
|
6
6
|
Findall,
|
|
7
7
|
type FindAllCandidateMatchStatusEvent,
|
|
8
|
+
type FindAllCandidatesRequest,
|
|
9
|
+
type FindAllCandidatesResponse,
|
|
8
10
|
type FindAllEnrichInput,
|
|
9
11
|
type FindAllExtendInput,
|
|
10
12
|
type FindAllRun,
|
|
@@ -19,6 +21,7 @@ export {
|
|
|
19
21
|
type FindAllCreateParams,
|
|
20
22
|
type FindAllRetrieveParams,
|
|
21
23
|
type FindAllCancelParams,
|
|
24
|
+
type FindAllCandidatesParams,
|
|
22
25
|
type FindAllEnrichParams,
|
|
23
26
|
type FindAllEventsParams,
|
|
24
27
|
type FindAllExtendParams,
|
|
@@ -60,15 +63,15 @@ export {
|
|
|
60
63
|
} from './task-group';
|
|
61
64
|
export {
|
|
62
65
|
TaskRun,
|
|
66
|
+
type ParallelBeta,
|
|
67
|
+
type TaskRunEventsResponse,
|
|
63
68
|
type BetaRunInput,
|
|
64
69
|
type BetaTaskRunResult,
|
|
65
|
-
type
|
|
70
|
+
type Webhook,
|
|
66
71
|
type McpServer,
|
|
67
72
|
type McpToolCall,
|
|
68
|
-
type ParallelBeta,
|
|
69
73
|
type TaskRunEvent,
|
|
70
|
-
type
|
|
71
|
-
type TaskRunEventsResponse,
|
|
74
|
+
type ErrorEvent,
|
|
72
75
|
type TaskRunCreateParams,
|
|
73
76
|
type TaskRunResultParams,
|
|
74
77
|
} from './task-run';
|
|
@@ -10,9 +10,25 @@ import { buildHeaders } from '../../internal/headers';
|
|
|
10
10
|
import { RequestOptions } from '../../internal/request-options';
|
|
11
11
|
import { path } from '../../internal/utils/path';
|
|
12
12
|
|
|
13
|
+
/**
|
|
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.
|
|
18
|
+
* - Submit hundreds or thousands of Tasks as a single group
|
|
19
|
+
* - Observe group progress and receive results as they complete
|
|
20
|
+
* - Real-time updates via Server-Sent Events (SSE)
|
|
21
|
+
* - Add tasks to an existing group while it is running
|
|
22
|
+
* - Group-level retry and error aggregation
|
|
23
|
+
*/
|
|
13
24
|
export class TaskGroup extends APIResource {
|
|
14
25
|
/**
|
|
15
26
|
* Initiates a TaskGroup to group and track multiple runs.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const taskGroup = await client.beta.taskGroup.create();
|
|
31
|
+
* ```
|
|
16
32
|
*/
|
|
17
33
|
create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise<TaskGroup> {
|
|
18
34
|
return this._client.post('/v1beta/tasks/groups', {
|
|
@@ -24,6 +40,13 @@ export class TaskGroup extends APIResource {
|
|
|
24
40
|
|
|
25
41
|
/**
|
|
26
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
|
+
* ```
|
|
27
50
|
*/
|
|
28
51
|
retrieve(taskGroupID: string, options?: RequestOptions): APIPromise<TaskGroup> {
|
|
29
52
|
return this._client.get(path`/v1beta/tasks/groups/${taskGroupID}`, {
|
|
@@ -34,14 +57,28 @@ export class TaskGroup extends APIResource {
|
|
|
34
57
|
|
|
35
58
|
/**
|
|
36
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
|
+
* ```
|
|
37
73
|
*/
|
|
38
74
|
addRuns(
|
|
39
75
|
taskGroupID: string,
|
|
40
76
|
params: TaskGroupAddRunsParams,
|
|
41
77
|
options?: RequestOptions,
|
|
42
78
|
): APIPromise<TaskGroupRunResponse> {
|
|
43
|
-
const { betas, ...body } = params;
|
|
79
|
+
const { refresh_status, betas, ...body } = params;
|
|
44
80
|
return this._client.post(path`/v1beta/tasks/groups/${taskGroupID}/runs`, {
|
|
81
|
+
query: { refresh_status },
|
|
45
82
|
body,
|
|
46
83
|
...options,
|
|
47
84
|
headers: buildHeaders([
|
|
@@ -56,6 +93,13 @@ export class TaskGroup extends APIResource {
|
|
|
56
93
|
*
|
|
57
94
|
* The connection will remain open for up to an hour as long as at least one run in
|
|
58
95
|
* the group is still active.
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```ts
|
|
99
|
+
* const response = await client.beta.taskGroup.events(
|
|
100
|
+
* 'taskgroup_id',
|
|
101
|
+
* );
|
|
102
|
+
* ```
|
|
59
103
|
*/
|
|
60
104
|
events(
|
|
61
105
|
taskGroupID: string,
|
|
@@ -84,6 +128,13 @@ export class TaskGroup extends APIResource {
|
|
|
84
128
|
* specify the `last_event_id` parameter with the `event_id` of the last event in
|
|
85
129
|
* the stream. The stream will resume from the next event after the
|
|
86
130
|
* `last_event_id`.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* const response = await client.beta.taskGroup.getRuns(
|
|
135
|
+
* 'taskgroup_id',
|
|
136
|
+
* );
|
|
137
|
+
* ```
|
|
87
138
|
*/
|
|
88
139
|
getRuns(
|
|
89
140
|
taskGroupID: string,
|
|
@@ -192,8 +243,8 @@ export interface TaskGroupStatus {
|
|
|
192
243
|
*/
|
|
193
244
|
export type TaskGroupEventsResponse =
|
|
194
245
|
| TaskGroupEventsResponse.TaskGroupStatusEvent
|
|
195
|
-
|
|
|
196
|
-
|
|
|
246
|
+
| TaskRunAPI.TaskRunEvent
|
|
247
|
+
| TaskRunAPI.ErrorEvent;
|
|
197
248
|
|
|
198
249
|
export namespace TaskGroupEventsResponse {
|
|
199
250
|
/**
|
|
@@ -222,7 +273,7 @@ export namespace TaskGroupEventsResponse {
|
|
|
222
273
|
*
|
|
223
274
|
* May indicate completion, cancellation, or failure.
|
|
224
275
|
*/
|
|
225
|
-
export type TaskGroupGetRunsResponse =
|
|
276
|
+
export type TaskGroupGetRunsResponse = TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
|
|
226
277
|
|
|
227
278
|
export interface TaskGroupCreateParams {
|
|
228
279
|
/**
|
|
@@ -233,9 +284,16 @@ export interface TaskGroupCreateParams {
|
|
|
233
284
|
|
|
234
285
|
export interface TaskGroupAddRunsParams {
|
|
235
286
|
/**
|
|
236
|
-
* Body param: List of task runs to execute.
|
|
287
|
+
* Body param: List of task runs to execute. Up to 1,000 runs can be specified per
|
|
288
|
+
* request. If you'd like to add more runs, split them across multiple TaskGroup
|
|
289
|
+
* POST requests.
|
|
290
|
+
*/
|
|
291
|
+
inputs: Array<TaskRunAPI.RunInput>;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Query param
|
|
237
295
|
*/
|
|
238
|
-
|
|
296
|
+
refresh_status?: boolean;
|
|
239
297
|
|
|
240
298
|
/**
|
|
241
299
|
* Body param: Specification for a task.
|