parallel-web 0.3.2 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +54 -0
- package/client.d.mts +44 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +44 -2
- package/client.d.ts.map +1 -1
- package/client.js +43 -0
- package/client.js.map +1 -1
- package/client.mjs +43 -0
- package/client.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +12 -1
- package/resources/beta/beta.d.mts +42 -61
- package/resources/beta/beta.d.mts.map +1 -1
- package/resources/beta/beta.d.ts +42 -61
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +3 -2
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +3 -2
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/findall.d.mts +167 -8
- package/resources/beta/findall.d.mts.map +1 -1
- package/resources/beta/findall.d.ts +167 -8
- package/resources/beta/findall.d.ts.map +1 -1
- package/resources/beta/findall.js +108 -0
- package/resources/beta/findall.js.map +1 -1
- package/resources/beta/findall.mjs +108 -0
- package/resources/beta/findall.mjs.map +1 -1
- package/resources/beta/index.d.mts +2 -2
- package/resources/beta/index.d.mts.map +1 -1
- package/resources/beta/index.d.ts +2 -2
- package/resources/beta/index.d.ts.map +1 -1
- package/resources/beta/index.js.map +1 -1
- package/resources/beta/index.mjs.map +1 -1
- package/resources/beta/task-group.d.mts +50 -5
- package/resources/beta/task-group.d.mts.map +1 -1
- package/resources/beta/task-group.d.ts +50 -5
- package/resources/beta/task-group.d.ts.map +1 -1
- package/resources/beta/task-group.js +45 -3
- package/resources/beta/task-group.js.map +1 -1
- package/resources/beta/task-group.mjs +45 -3
- package/resources/beta/task-group.mjs.map +1 -1
- package/resources/beta/task-run.d.mts +77 -270
- package/resources/beta/task-run.d.mts.map +1 -1
- package/resources/beta/task-run.d.ts +77 -270
- package/resources/beta/task-run.d.ts.map +1 -1
- package/resources/beta/task-run.js +17 -2
- package/resources/beta/task-run.js.map +1 -1
- package/resources/beta/task-run.mjs +17 -2
- package/resources/beta/task-run.mjs.map +1 -1
- package/resources/index.d.mts +2 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/shared.d.mts +4 -2
- package/resources/shared.d.mts.map +1 -1
- package/resources/shared.d.ts +4 -2
- package/resources/shared.d.ts.map +1 -1
- package/resources/task-run.d.mts +308 -30
- package/resources/task-run.d.mts.map +1 -1
- package/resources/task-run.d.ts +308 -30
- package/resources/task-run.d.ts.map +1 -1
- package/resources/task-run.js +67 -4
- package/resources/task-run.js.map +1 -1
- package/resources/task-run.mjs +67 -4
- package/resources/task-run.mjs.map +1 -1
- package/resources/top-level.d.mts +317 -0
- package/resources/top-level.d.mts.map +1 -0
- package/resources/top-level.d.ts +317 -0
- package/resources/top-level.d.ts.map +1 -0
- package/resources/top-level.js +4 -0
- package/resources/top-level.js.map +1 -0
- package/resources/top-level.mjs +3 -0
- package/resources/top-level.mjs.map +1 -0
- package/src/client.ts +90 -0
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/beta/api.md +12 -9
- package/src/resources/beta/beta.ts +59 -73
- package/src/resources/beta/findall.ts +187 -7
- package/src/resources/beta/index.ts +7 -4
- package/src/resources/beta/task-group.ts +54 -7
- package/src/resources/beta/task-run.ts +94 -305
- package/src/resources/index.ts +20 -0
- package/src/resources/shared.ts +4 -2
- package/src/resources/task-run.ts +391 -32
- package/src/resources/top-level.ts +385 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
import * as Shared from "./shared.js";
|
|
2
|
+
/**
|
|
3
|
+
* Advanced extract configuration.
|
|
4
|
+
*
|
|
5
|
+
* These settings may impact result quality and latency unless used carefully. See
|
|
6
|
+
* https://docs.parallel.ai/search/advanced-extract-settings for more info.
|
|
7
|
+
*/
|
|
8
|
+
export interface AdvancedExtractSettings {
|
|
9
|
+
/**
|
|
10
|
+
* Optional settings for returning relevant excerpts.
|
|
11
|
+
*/
|
|
12
|
+
excerpt_settings?: ExcerptSettings | null;
|
|
13
|
+
/**
|
|
14
|
+
* Policy for live fetching web results.
|
|
15
|
+
*/
|
|
16
|
+
fetch_policy?: FetchPolicy | null;
|
|
17
|
+
/**
|
|
18
|
+
* Controls full content extraction. Set to true to enable with defaults, false to
|
|
19
|
+
* disable, or provide FullContentSettings for fine-grained control.
|
|
20
|
+
*/
|
|
21
|
+
full_content?: AdvancedExtractSettings.FullContentSettings | boolean;
|
|
22
|
+
}
|
|
23
|
+
export declare namespace AdvancedExtractSettings {
|
|
24
|
+
/**
|
|
25
|
+
* Optional settings for returning full content.
|
|
26
|
+
*/
|
|
27
|
+
interface FullContentSettings {
|
|
28
|
+
/**
|
|
29
|
+
* Optional limit on the number of characters to include in the full content for
|
|
30
|
+
* each url. Full content always starts at the beginning of the page and is
|
|
31
|
+
* truncated at the limit if necessary.
|
|
32
|
+
*/
|
|
33
|
+
max_chars_per_result?: number | null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Advanced search configuration.
|
|
38
|
+
*
|
|
39
|
+
* These settings may impact result quality and latency unless used carefully. See
|
|
40
|
+
* https://docs.parallel.ai/search/advanced-search-settings for more info.
|
|
41
|
+
*/
|
|
42
|
+
export interface AdvancedSearchSettings {
|
|
43
|
+
/**
|
|
44
|
+
* Optional settings for returning relevant excerpts.
|
|
45
|
+
*/
|
|
46
|
+
excerpt_settings?: ExcerptSettings | null;
|
|
47
|
+
/**
|
|
48
|
+
* Policy for live fetching web results.
|
|
49
|
+
*/
|
|
50
|
+
fetch_policy?: FetchPolicy | null;
|
|
51
|
+
/**
|
|
52
|
+
* ISO 3166-1 alpha-2 country code for geo-targeted search results.
|
|
53
|
+
*/
|
|
54
|
+
location?: string | null;
|
|
55
|
+
/**
|
|
56
|
+
* Upper bound on the number of results to return. Defaults to 10 if not provided.
|
|
57
|
+
*/
|
|
58
|
+
max_results?: number | null;
|
|
59
|
+
/**
|
|
60
|
+
* Source policy for web search results.
|
|
61
|
+
*
|
|
62
|
+
* This policy governs which sources are allowed/disallowed in results.
|
|
63
|
+
*/
|
|
64
|
+
source_policy?: Shared.SourcePolicy | null;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Optional settings for returning relevant excerpts.
|
|
68
|
+
*/
|
|
69
|
+
export interface ExcerptSettings {
|
|
70
|
+
/**
|
|
71
|
+
* Optional upper bound on the total number of characters to include per url.
|
|
72
|
+
* Excerpts may contain fewer characters than this limit to maximize relevance and
|
|
73
|
+
* token efficiency. Values below 1000 will be automatically set to 1000.
|
|
74
|
+
*/
|
|
75
|
+
max_chars_per_result?: number | null;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Extract error details.
|
|
79
|
+
*/
|
|
80
|
+
export interface ExtractError {
|
|
81
|
+
/**
|
|
82
|
+
* Content returned for http client or server errors, if any.
|
|
83
|
+
*/
|
|
84
|
+
content: string | null;
|
|
85
|
+
/**
|
|
86
|
+
* Error type.
|
|
87
|
+
*/
|
|
88
|
+
error_type: string;
|
|
89
|
+
/**
|
|
90
|
+
* HTTP status code, if available.
|
|
91
|
+
*/
|
|
92
|
+
http_status_code: number | null;
|
|
93
|
+
url: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Extract response.
|
|
97
|
+
*/
|
|
98
|
+
export interface ExtractResponse {
|
|
99
|
+
/**
|
|
100
|
+
* Extract errors: requested URLs not in the results.
|
|
101
|
+
*/
|
|
102
|
+
errors: Array<ExtractError>;
|
|
103
|
+
/**
|
|
104
|
+
* Extract request ID, e.g. `extract_cad0a6d2dec046bd95ae900527d880e7`
|
|
105
|
+
*/
|
|
106
|
+
extract_id: string;
|
|
107
|
+
/**
|
|
108
|
+
* Successful extract results.
|
|
109
|
+
*/
|
|
110
|
+
results: Array<ExtractResult>;
|
|
111
|
+
/**
|
|
112
|
+
* Session identifier. Echoed back from the request if provided, otherwise
|
|
113
|
+
* generated by the server. Should be passed to future search and extract calls
|
|
114
|
+
* made by the agent as part of the same larger task.
|
|
115
|
+
*/
|
|
116
|
+
session_id: string;
|
|
117
|
+
/**
|
|
118
|
+
* Usage metrics for the extract request.
|
|
119
|
+
*/
|
|
120
|
+
usage?: Array<UsageItem> | null;
|
|
121
|
+
/**
|
|
122
|
+
* Warnings for the extract request, if any.
|
|
123
|
+
*/
|
|
124
|
+
warnings?: Array<Shared.Warning> | null;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Extract result for a single URL.
|
|
128
|
+
*/
|
|
129
|
+
export interface ExtractResult {
|
|
130
|
+
/**
|
|
131
|
+
* Relevant excerpted content from the URL, formatted as markdown.
|
|
132
|
+
*/
|
|
133
|
+
excerpts: Array<string>;
|
|
134
|
+
/**
|
|
135
|
+
* URL associated with the search result.
|
|
136
|
+
*/
|
|
137
|
+
url: string;
|
|
138
|
+
/**
|
|
139
|
+
* Full content from the URL formatted as markdown, if requested.
|
|
140
|
+
*/
|
|
141
|
+
full_content?: string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Publish date of the webpage in YYYY-MM-DD format, if available.
|
|
144
|
+
*/
|
|
145
|
+
publish_date?: string | null;
|
|
146
|
+
/**
|
|
147
|
+
* Title of the webpage, if available.
|
|
148
|
+
*/
|
|
149
|
+
title?: string | null;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Policy for live fetching web results.
|
|
153
|
+
*/
|
|
154
|
+
export interface FetchPolicy {
|
|
155
|
+
/**
|
|
156
|
+
* If false, fallback to cached content older than max-age if live fetch fails or
|
|
157
|
+
* times out. If true, returns an error instead.
|
|
158
|
+
*/
|
|
159
|
+
disable_cache_fallback?: boolean;
|
|
160
|
+
/**
|
|
161
|
+
* Maximum age of cached content in seconds to trigger a live fetch. Minimum value
|
|
162
|
+
* 600 seconds (10 minutes).
|
|
163
|
+
*/
|
|
164
|
+
max_age_seconds?: number | null;
|
|
165
|
+
/**
|
|
166
|
+
* Timeout in seconds for fetching live content if unavailable in cache.
|
|
167
|
+
*/
|
|
168
|
+
timeout_seconds?: number | null;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Search response.
|
|
172
|
+
*/
|
|
173
|
+
export interface SearchResult {
|
|
174
|
+
/**
|
|
175
|
+
* A list of search results, ordered by decreasing relevance.
|
|
176
|
+
*/
|
|
177
|
+
results: Array<WebSearchResult>;
|
|
178
|
+
/**
|
|
179
|
+
* Search ID. Example: `search_cad0a6d2dec046bd95ae900527d880e7`
|
|
180
|
+
*/
|
|
181
|
+
search_id: string;
|
|
182
|
+
/**
|
|
183
|
+
* Session identifier, echoed back from the request if provided, otherwise
|
|
184
|
+
* generated by the server. Should be passed to future search and extract calls
|
|
185
|
+
* made by the agent as part of the same larger task.
|
|
186
|
+
*/
|
|
187
|
+
session_id: string;
|
|
188
|
+
/**
|
|
189
|
+
* Usage metrics for the search request.
|
|
190
|
+
*/
|
|
191
|
+
usage?: Array<UsageItem> | null;
|
|
192
|
+
/**
|
|
193
|
+
* Warnings for the search request, if any.
|
|
194
|
+
*/
|
|
195
|
+
warnings?: Array<Shared.Warning> | null;
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Usage item for a single operation.
|
|
199
|
+
*/
|
|
200
|
+
export interface UsageItem {
|
|
201
|
+
/**
|
|
202
|
+
* Count of the SKU.
|
|
203
|
+
*/
|
|
204
|
+
count: number;
|
|
205
|
+
/**
|
|
206
|
+
* Name of the SKU.
|
|
207
|
+
*/
|
|
208
|
+
name: string;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* A single search result from the web search API.
|
|
212
|
+
*/
|
|
213
|
+
export interface WebSearchResult {
|
|
214
|
+
/**
|
|
215
|
+
* Relevant excerpted content from the URL, formatted as markdown.
|
|
216
|
+
*/
|
|
217
|
+
excerpts: Array<string>;
|
|
218
|
+
/**
|
|
219
|
+
* URL associated with the search result.
|
|
220
|
+
*/
|
|
221
|
+
url: string;
|
|
222
|
+
/**
|
|
223
|
+
* Publish date of the webpage in YYYY-MM-DD format, if available.
|
|
224
|
+
*/
|
|
225
|
+
publish_date?: string | null;
|
|
226
|
+
/**
|
|
227
|
+
* Title of the webpage, if available.
|
|
228
|
+
*/
|
|
229
|
+
title?: string | null;
|
|
230
|
+
}
|
|
231
|
+
export interface ExtractParams {
|
|
232
|
+
/**
|
|
233
|
+
* URLs to extract content from. Up to 20 URLs.
|
|
234
|
+
*/
|
|
235
|
+
urls: Array<string>;
|
|
236
|
+
/**
|
|
237
|
+
* Advanced extract configuration.
|
|
238
|
+
*
|
|
239
|
+
* These settings may impact result quality and latency unless used carefully. See
|
|
240
|
+
* https://docs.parallel.ai/search/advanced-extract-settings for more info.
|
|
241
|
+
*/
|
|
242
|
+
advanced_settings?: AdvancedExtractSettings | null;
|
|
243
|
+
/**
|
|
244
|
+
* The model generating this request and consuming the results. Enables
|
|
245
|
+
* optimizations and tailors default settings for the model's capabilities.
|
|
246
|
+
*/
|
|
247
|
+
client_model?: string | null;
|
|
248
|
+
/**
|
|
249
|
+
* Upper bound on total characters across excerpts from all extracted results.
|
|
250
|
+
*/
|
|
251
|
+
max_chars_total?: number | null;
|
|
252
|
+
/**
|
|
253
|
+
* As in SearchRequest, a natural-language description of the underlying question
|
|
254
|
+
* or goal driving the request. Used together with search_queries to focus excerpts
|
|
255
|
+
* on the most relevant content.
|
|
256
|
+
*/
|
|
257
|
+
objective?: string | null;
|
|
258
|
+
/**
|
|
259
|
+
* Optional keyword search queries, as in SearchRequest. Used together with
|
|
260
|
+
* objective to focus excerpts on the most relevant content.
|
|
261
|
+
*/
|
|
262
|
+
search_queries?: Array<string> | null;
|
|
263
|
+
/**
|
|
264
|
+
* Session identifier to track calls across separate search and extract calls, to
|
|
265
|
+
* be used as part of a larger task. Specifying it may give better contextual
|
|
266
|
+
* results for subsequent API calls.
|
|
267
|
+
*/
|
|
268
|
+
session_id?: string | null;
|
|
269
|
+
}
|
|
270
|
+
export interface SearchParams {
|
|
271
|
+
/**
|
|
272
|
+
* Concise keyword search queries, 3-6 words each. At least one query is required,
|
|
273
|
+
* provide 2-3 for best results. Used together with objective to focus results on
|
|
274
|
+
* the most relevant content.
|
|
275
|
+
*/
|
|
276
|
+
search_queries: Array<string>;
|
|
277
|
+
/**
|
|
278
|
+
* Advanced search configuration.
|
|
279
|
+
*
|
|
280
|
+
* These settings may impact result quality and latency unless used carefully. See
|
|
281
|
+
* https://docs.parallel.ai/search/advanced-search-settings for more info.
|
|
282
|
+
*/
|
|
283
|
+
advanced_settings?: AdvancedSearchSettings | null;
|
|
284
|
+
/**
|
|
285
|
+
* The model generating this request and consuming the results. Enables
|
|
286
|
+
* optimizations and tailors default settings for the model's capabilities.
|
|
287
|
+
*/
|
|
288
|
+
client_model?: string | null;
|
|
289
|
+
/**
|
|
290
|
+
* Upper bound on total characters across excerpts from all results.
|
|
291
|
+
*/
|
|
292
|
+
max_chars_total?: number | null;
|
|
293
|
+
/**
|
|
294
|
+
* Search mode preset: supported values are `basic` and `advanced`. Basic mode
|
|
295
|
+
* offers the lowest latency and works best with 2-3 high-quality search_queries.
|
|
296
|
+
* Advanced mode provides higher quality with more advanced retrieval and
|
|
297
|
+
* compression. Defaults to `advanced` when omitted.
|
|
298
|
+
*/
|
|
299
|
+
mode?: 'basic' | 'advanced' | null;
|
|
300
|
+
/**
|
|
301
|
+
* Natural-language description of the underlying question or goal driving the
|
|
302
|
+
* search. Used together with search_queries to focus results on the most relevant
|
|
303
|
+
* content. Should be self-contained with enough context to understand the intent
|
|
304
|
+
* of the search.
|
|
305
|
+
*/
|
|
306
|
+
objective?: string | null;
|
|
307
|
+
/**
|
|
308
|
+
* Session identifier to track calls across separate search and extract calls, to
|
|
309
|
+
* be used as part of a larger task. Specifying it may give better contextual
|
|
310
|
+
* results for subsequent API calls.
|
|
311
|
+
*/
|
|
312
|
+
session_id?: string | null;
|
|
313
|
+
}
|
|
314
|
+
export declare namespace TopLevel {
|
|
315
|
+
export { type AdvancedExtractSettings as AdvancedExtractSettings, type AdvancedSearchSettings as AdvancedSearchSettings, type ExcerptSettings as ExcerptSettings, type ExtractError as ExtractError, type ExtractResponse as ExtractResponse, type ExtractResult as ExtractResult, type FetchPolicy as FetchPolicy, type SearchResult as SearchResult, type UsageItem as UsageItem, type WebSearchResult as WebSearchResult, type ExtractParams as ExtractParams, type SearchParams as SearchParams, };
|
|
316
|
+
}
|
|
317
|
+
//# sourceMappingURL=top-level.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-level.d.ts","sourceRoot":"","sources":["../src/resources/top-level.ts"],"names":[],"mappings":"OAEO,KAAK,MAAM;AAElB;;;;;GAKG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,gBAAgB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAElC;;;OAGG;IACH,YAAY,CAAC,EAAE,uBAAuB,CAAC,mBAAmB,GAAG,OAAO,CAAC;CACtE;AAED,yBAAiB,uBAAuB,CAAC;IACvC;;OAEG;IACH,UAAiB,mBAAmB;QAClC;;;;WAIG;QACH,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KACtC;CACF;AAED;;;;;GAKG;AACH,MAAM,WAAW,sBAAsB;IACrC;;OAEG;IACH,gBAAgB,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAE1C;;OAEG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,I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-level.js","sourceRoot":"","sources":["../src/resources/top-level.ts"],"names":[],"mappings":";AAAA,sFAAsF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"top-level.mjs","sourceRoot":"","sources":["../src/resources/top-level.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
|
package/src/client.ts
CHANGED
|
@@ -16,21 +16,42 @@ import { VERSION } from './version';
|
|
|
16
16
|
import * as Errors from './core/error';
|
|
17
17
|
import * as Uploads from './core/uploads';
|
|
18
18
|
import * as API from './resources/index';
|
|
19
|
+
import * as TopLevelAPI from './resources/top-level';
|
|
20
|
+
import {
|
|
21
|
+
AdvancedExtractSettings,
|
|
22
|
+
AdvancedSearchSettings,
|
|
23
|
+
ExcerptSettings,
|
|
24
|
+
ExtractError,
|
|
25
|
+
ExtractParams,
|
|
26
|
+
ExtractResponse,
|
|
27
|
+
ExtractResult,
|
|
28
|
+
FetchPolicy,
|
|
29
|
+
SearchParams,
|
|
30
|
+
SearchResult,
|
|
31
|
+
UsageItem,
|
|
32
|
+
WebSearchResult,
|
|
33
|
+
} from './resources/top-level';
|
|
19
34
|
import { APIPromise } from './core/api-promise';
|
|
20
35
|
import {
|
|
21
36
|
AutoSchema,
|
|
22
37
|
Citation,
|
|
38
|
+
ErrorEvent,
|
|
23
39
|
FieldBasis,
|
|
24
40
|
JsonSchema,
|
|
41
|
+
McpServer,
|
|
42
|
+
McpToolCall,
|
|
25
43
|
RunInput,
|
|
26
44
|
TaskRun,
|
|
27
45
|
TaskRunCreateParams,
|
|
46
|
+
TaskRunEvent,
|
|
47
|
+
TaskRunEventsResponse,
|
|
28
48
|
TaskRunJsonOutput,
|
|
29
49
|
TaskRunResult,
|
|
30
50
|
TaskRunResultParams,
|
|
31
51
|
TaskRunTextOutput,
|
|
32
52
|
TaskSpec,
|
|
33
53
|
TextSchema,
|
|
54
|
+
Webhook,
|
|
34
55
|
} from './resources/task-run';
|
|
35
56
|
import { Beta } from './resources/beta/beta';
|
|
36
57
|
import { type Fetch } from './internal/builtin-types';
|
|
@@ -214,6 +235,47 @@ export class Parallel {
|
|
|
214
235
|
return this.baseURL !== 'https://api.parallel.ai';
|
|
215
236
|
}
|
|
216
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Extracts relevant content from specific web URLs.
|
|
240
|
+
*
|
|
241
|
+
* The legacy Extract API reference (`/v1beta/extract` endpoint) is available
|
|
242
|
+
* [here](https://docs.parallel.ai/api-reference/legacy/extract-beta/extract), and
|
|
243
|
+
* migration guide is
|
|
244
|
+
* [here](https://docs.parallel.ai/extract/extract-migration-guide).
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```ts
|
|
248
|
+
* const extractResponse = await client.extract({
|
|
249
|
+
* urls: ['string'],
|
|
250
|
+
* });
|
|
251
|
+
* ```
|
|
252
|
+
*/
|
|
253
|
+
extract(
|
|
254
|
+
body: TopLevelAPI.ExtractParams,
|
|
255
|
+
options?: RequestOptions,
|
|
256
|
+
): APIPromise<TopLevelAPI.ExtractResponse> {
|
|
257
|
+
return this.post('/v1/extract', { body, ...options });
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Searches the web.
|
|
262
|
+
*
|
|
263
|
+
* The legacy Search API reference (`/v1beta/search` endpoint) is available
|
|
264
|
+
* [here](https://docs.parallel.ai/api-reference/legacy/search-beta/search), and
|
|
265
|
+
* migration guide is
|
|
266
|
+
* [here](https://docs.parallel.ai/search/search-migration-guide).
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* ```ts
|
|
270
|
+
* const searchResult = await client.search({
|
|
271
|
+
* search_queries: ['string'],
|
|
272
|
+
* });
|
|
273
|
+
* ```
|
|
274
|
+
*/
|
|
275
|
+
search(body: TopLevelAPI.SearchParams, options?: RequestOptions): APIPromise<TopLevelAPI.SearchResult> {
|
|
276
|
+
return this.post('/v1/search', { body, ...options });
|
|
277
|
+
}
|
|
278
|
+
|
|
217
279
|
protected defaultQuery(): Record<string, string | undefined> | undefined {
|
|
218
280
|
return this._options.defaultQuery;
|
|
219
281
|
}
|
|
@@ -736,6 +798,13 @@ export class Parallel {
|
|
|
736
798
|
/**
|
|
737
799
|
* 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.
|
|
738
800
|
* - Output metadata: citations, excerpts, reasoning, and confidence per field
|
|
801
|
+
*
|
|
802
|
+
* Task Groups enable batch execution of many independent Task runs with group-level monitoring and failure handling.
|
|
803
|
+
* - Submit hundreds or thousands of Tasks as a single group
|
|
804
|
+
* - Observe group progress and receive results as they complete
|
|
805
|
+
* - Real-time updates via Server-Sent Events (SSE)
|
|
806
|
+
* - Add tasks to an existing group while it is running
|
|
807
|
+
* - Group-level retry and error aggregation
|
|
739
808
|
*/
|
|
740
809
|
taskRun: API.TaskRun = new API.TaskRun(this);
|
|
741
810
|
beta: API.Beta = new API.Beta(this);
|
|
@@ -746,18 +815,39 @@ Parallel.Beta = Beta;
|
|
|
746
815
|
export declare namespace Parallel {
|
|
747
816
|
export type RequestOptions = Opts.RequestOptions;
|
|
748
817
|
|
|
818
|
+
export {
|
|
819
|
+
type AdvancedExtractSettings as AdvancedExtractSettings,
|
|
820
|
+
type AdvancedSearchSettings as AdvancedSearchSettings,
|
|
821
|
+
type ExcerptSettings as ExcerptSettings,
|
|
822
|
+
type ExtractError as ExtractError,
|
|
823
|
+
type ExtractResponse as ExtractResponse,
|
|
824
|
+
type ExtractResult as ExtractResult,
|
|
825
|
+
type FetchPolicy as FetchPolicy,
|
|
826
|
+
type SearchResult as SearchResult,
|
|
827
|
+
type UsageItem as UsageItem,
|
|
828
|
+
type WebSearchResult as WebSearchResult,
|
|
829
|
+
type ExtractParams as ExtractParams,
|
|
830
|
+
type SearchParams as SearchParams,
|
|
831
|
+
};
|
|
832
|
+
|
|
749
833
|
export {
|
|
750
834
|
type TaskRun as TaskRun,
|
|
751
835
|
type AutoSchema as AutoSchema,
|
|
752
836
|
type Citation as Citation,
|
|
837
|
+
type ErrorEvent as ErrorEvent,
|
|
753
838
|
type FieldBasis as FieldBasis,
|
|
754
839
|
type JsonSchema as JsonSchema,
|
|
840
|
+
type McpServer as McpServer,
|
|
841
|
+
type McpToolCall as McpToolCall,
|
|
755
842
|
type RunInput as RunInput,
|
|
843
|
+
type TaskRunEvent as TaskRunEvent,
|
|
756
844
|
type TaskRunJsonOutput as TaskRunJsonOutput,
|
|
757
845
|
type TaskRunResult as TaskRunResult,
|
|
758
846
|
type TaskRunTextOutput as TaskRunTextOutput,
|
|
759
847
|
type TaskSpec as TaskSpec,
|
|
760
848
|
type TextSchema as TextSchema,
|
|
849
|
+
type Webhook as Webhook,
|
|
850
|
+
type TaskRunEventsResponse as TaskRunEventsResponse,
|
|
761
851
|
type TaskRunCreateParams as TaskRunCreateParams,
|
|
762
852
|
type TaskRunResultParams as TaskRunResultParams,
|
|
763
853
|
};
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export const readEnv = (env: string): string | undefined => {
|
|
11
11
|
if (typeof (globalThis as any).process !== 'undefined') {
|
|
12
|
-
return (globalThis as any).process.env?.[env]?.trim()
|
|
12
|
+
return (globalThis as any).process.env?.[env]?.trim() || undefined;
|
|
13
13
|
}
|
|
14
14
|
if (typeof (globalThis as any).Deno !== 'undefined') {
|
|
15
|
-
return (globalThis as any).Deno.env?.get?.(env)?.trim();
|
|
15
|
+
return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
|
|
16
16
|
}
|
|
17
17
|
return undefined;
|
|
18
18
|
};
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
Types:
|
|
4
4
|
|
|
5
5
|
- <code><a href="./src/resources/beta/beta.ts">ExcerptSettings</a></code>
|
|
6
|
-
- <code><a href="./src/resources/beta/beta.ts">ExtractError</a></code>
|
|
7
6
|
- <code><a href="./src/resources/beta/beta.ts">ExtractResponse</a></code>
|
|
8
7
|
- <code><a href="./src/resources/beta/beta.ts">ExtractResult</a></code>
|
|
9
|
-
- <code><a href="./src/resources/beta/beta.ts">FetchPolicy</a></code>
|
|
10
8
|
- <code><a href="./src/resources/beta/beta.ts">SearchResult</a></code>
|
|
11
|
-
- <code><a href="./src/resources/beta/beta.ts">UsageItem</a></code>
|
|
12
9
|
- <code><a href="./src/resources/beta/beta.ts">WebSearchResult</a></code>
|
|
10
|
+
- <code><a href="./src/resources/beta/beta.ts">ExtractError</a></code>
|
|
11
|
+
- <code><a href="./src/resources/beta/beta.ts">FetchPolicy</a></code>
|
|
12
|
+
- <code><a href="./src/resources/beta/beta.ts">UsageItem</a></code>
|
|
13
13
|
|
|
14
14
|
Methods:
|
|
15
15
|
|
|
@@ -20,21 +20,21 @@ Methods:
|
|
|
20
20
|
|
|
21
21
|
Types:
|
|
22
22
|
|
|
23
|
+
- <code><a href="./src/resources/beta/task-run.ts">ParallelBeta</a></code>
|
|
24
|
+
- <code><a href="./src/resources/beta/task-run.ts">TaskRunEventsResponse</a></code>
|
|
23
25
|
- <code><a href="./src/resources/beta/task-run.ts">BetaRunInput</a></code>
|
|
24
26
|
- <code><a href="./src/resources/beta/task-run.ts">BetaTaskRunResult</a></code>
|
|
25
|
-
- <code><a href="./src/resources/beta/task-run.ts">
|
|
27
|
+
- <code><a href="./src/resources/beta/task-run.ts">Webhook</a></code>
|
|
26
28
|
- <code><a href="./src/resources/beta/task-run.ts">McpServer</a></code>
|
|
27
29
|
- <code><a href="./src/resources/beta/task-run.ts">McpToolCall</a></code>
|
|
28
|
-
- <code><a href="./src/resources/beta/task-run.ts">ParallelBeta</a></code>
|
|
29
30
|
- <code><a href="./src/resources/beta/task-run.ts">TaskRunEvent</a></code>
|
|
30
|
-
- <code><a href="./src/resources/beta/task-run.ts">
|
|
31
|
-
- <code><a href="./src/resources/beta/task-run.ts">TaskRunEventsResponse</a></code>
|
|
31
|
+
- <code><a href="./src/resources/beta/task-run.ts">ErrorEvent</a></code>
|
|
32
32
|
|
|
33
33
|
Methods:
|
|
34
34
|
|
|
35
|
-
- <code title="post /v1/tasks/runs
|
|
35
|
+
- <code title="post /v1/tasks/runs">client.beta.taskRun.<a href="./src/resources/beta/task-run.ts">create</a>({ ...params }) -> TaskRun</code>
|
|
36
36
|
- <code title="get /v1beta/tasks/runs/{run_id}/events">client.beta.taskRun.<a href="./src/resources/beta/task-run.ts">events</a>(runID) -> TaskRunEventsResponse</code>
|
|
37
|
-
- <code title="get /v1/tasks/runs/{run_id}/result
|
|
37
|
+
- <code title="get /v1/tasks/runs/{run_id}/result">client.beta.taskRun.<a href="./src/resources/beta/task-run.ts">result</a>(runID, { ...params }) -> TaskRunResult</code>
|
|
38
38
|
|
|
39
39
|
## TaskGroup
|
|
40
40
|
|
|
@@ -59,6 +59,8 @@ Methods:
|
|
|
59
59
|
Types:
|
|
60
60
|
|
|
61
61
|
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidateMatchStatusEvent</a></code>
|
|
62
|
+
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidatesRequest</a></code>
|
|
63
|
+
- <code><a href="./src/resources/beta/findall.ts">FindAllCandidatesResponse</a></code>
|
|
62
64
|
- <code><a href="./src/resources/beta/findall.ts">FindAllEnrichInput</a></code>
|
|
63
65
|
- <code><a href="./src/resources/beta/findall.ts">FindAllExtendInput</a></code>
|
|
64
66
|
- <code><a href="./src/resources/beta/findall.ts">FindAllRun</a></code>
|
|
@@ -76,6 +78,7 @@ Methods:
|
|
|
76
78
|
- <code title="post /v1beta/findall/runs">client.beta.findall.<a href="./src/resources/beta/findall.ts">create</a>({ ...params }) -> FindAllRun</code>
|
|
77
79
|
- <code title="get /v1beta/findall/runs/{findall_id}">client.beta.findall.<a href="./src/resources/beta/findall.ts">retrieve</a>(findallID, { ...params }) -> FindAllRun</code>
|
|
78
80
|
- <code title="post /v1beta/findall/runs/{findall_id}/cancel">client.beta.findall.<a href="./src/resources/beta/findall.ts">cancel</a>(findallID, { ...params }) -> unknown</code>
|
|
81
|
+
- <code title="post /v1beta/findall/candidates">client.beta.findall.<a href="./src/resources/beta/findall.ts">candidates</a>({ ...params }) -> FindAllCandidatesResponse</code>
|
|
79
82
|
- <code title="post /v1beta/findall/runs/{findall_id}/enrich">client.beta.findall.<a href="./src/resources/beta/findall.ts">enrich</a>(findallID, { ...params }) -> FindAllSchema</code>
|
|
80
83
|
- <code title="get /v1beta/findall/runs/{findall_id}/events">client.beta.findall.<a href="./src/resources/beta/findall.ts">events</a>(findallID, { ...params }) -> FindAllEventsResponse</code>
|
|
81
84
|
- <code title="post /v1beta/findall/runs/{findall_id}/extend">client.beta.findall.<a href="./src/resources/beta/findall.ts">extend</a>(findallID, { ...params }) -> FindAllSchema</code>
|