parallel-web 0.2.2 → 0.2.4

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.
Files changed (44) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/package.json +1 -1
  3. package/resources/beta/beta.d.mts +80 -33
  4. package/resources/beta/beta.d.mts.map +1 -1
  5. package/resources/beta/beta.d.ts +80 -33
  6. package/resources/beta/beta.d.ts.map +1 -1
  7. package/resources/beta/beta.js +7 -0
  8. package/resources/beta/beta.js.map +1 -1
  9. package/resources/beta/beta.mjs +7 -0
  10. package/resources/beta/beta.mjs.map +1 -1
  11. package/resources/beta/findall.d.mts +979 -0
  12. package/resources/beta/findall.d.mts.map +1 -0
  13. package/resources/beta/findall.d.ts +979 -0
  14. package/resources/beta/findall.d.ts.map +1 -0
  15. package/resources/beta/findall.js +155 -0
  16. package/resources/beta/findall.js.map +1 -0
  17. package/resources/beta/findall.mjs +151 -0
  18. package/resources/beta/findall.mjs.map +1 -0
  19. package/resources/beta/index.d.mts +1 -0
  20. package/resources/beta/index.d.mts.map +1 -1
  21. package/resources/beta/index.d.ts +1 -0
  22. package/resources/beta/index.d.ts.map +1 -1
  23. package/resources/beta/index.js +3 -1
  24. package/resources/beta/index.js.map +1 -1
  25. package/resources/beta/index.mjs +1 -0
  26. package/resources/beta/index.mjs.map +1 -1
  27. package/resources/beta/task-run.d.mts +1 -1
  28. package/resources/beta/task-run.d.mts.map +1 -1
  29. package/resources/beta/task-run.d.ts +1 -1
  30. package/resources/beta/task-run.d.ts.map +1 -1
  31. package/resources/shared.d.mts +6 -2
  32. package/resources/shared.d.mts.map +1 -1
  33. package/resources/shared.d.ts +6 -2
  34. package/resources/shared.d.ts.map +1 -1
  35. package/src/resources/beta/beta.ts +141 -33
  36. package/src/resources/beta/findall.ts +1295 -0
  37. package/src/resources/beta/index.ts +25 -0
  38. package/src/resources/beta/task-run.ts +2 -0
  39. package/src/resources/shared.ts +6 -2
  40. package/src/version.ts +1 -1
  41. package/version.d.mts +1 -1
  42. package/version.d.ts +1 -1
  43. package/version.js +1 -1
  44. package/version.mjs +1 -1
@@ -2,6 +2,32 @@
2
2
 
3
3
  import { APIResource } from '../../core/resource';
4
4
  import * as Shared from '../shared';
5
+ import * as FindallAPI from './findall';
6
+ import {
7
+ Findall,
8
+ FindallCancelParams,
9
+ FindallCancelResponse,
10
+ FindallCandidateMatchStatusEvent,
11
+ FindallCreateParams,
12
+ FindallEnrichInput,
13
+ FindallEnrichParams,
14
+ FindallEventsParams,
15
+ FindallEventsResponse,
16
+ FindallExtendInput,
17
+ FindallExtendParams,
18
+ FindallIngestParams,
19
+ FindallResultParams,
20
+ FindallRetrieveParams,
21
+ FindallRetrieveResponse,
22
+ FindallRun,
23
+ FindallRunInput,
24
+ FindallRunResult,
25
+ FindallRunStatusEvent,
26
+ FindallSchema,
27
+ FindallSchemaParams,
28
+ FindallSchemaUpdatedEvent,
29
+ IngestInput,
30
+ } from './findall';
5
31
  import * as TaskGroupAPI from './task-group';
6
32
  import {
7
33
  TaskGroup,
@@ -36,6 +62,7 @@ import { RequestOptions } from '../../internal/request-options';
36
62
  export class Beta extends APIResource {
37
63
  taskRun: TaskRunAPI.TaskRun = new TaskRunAPI.TaskRun(this._client);
38
64
  taskGroup: TaskGroupAPI.TaskGroup = new TaskGroupAPI.TaskGroup(this._client);
65
+ findall: FindallAPI.Findall = new FindallAPI.Findall(this._client);
39
66
 
40
67
  /**
41
68
  * Extracts relevant content from specific web URLs.
@@ -57,6 +84,9 @@ export class Beta extends APIResource {
57
84
 
58
85
  /**
59
86
  * Searches the web.
87
+ *
88
+ * To access this endpoint, pass the `parallel-beta` header with the value
89
+ * `search-extract-2025-10-10`.
60
90
  */
61
91
  search(params: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult> {
62
92
  const { betas, ...body } = params;
@@ -76,9 +106,9 @@ export class Beta extends APIResource {
76
106
  */
77
107
  export interface ExcerptSettings {
78
108
  /**
79
- * Optional upper bound on the total number of characters to include across all
80
- * excerpts for each url. Excerpts may contain fewer characters than this limit to
81
- * maximize relevance and token efficiency.
109
+ * Optional upper bound on the total number of characters to include per url.
110
+ * Excerpts may contain fewer characters than this limit to maximize relevance and
111
+ * token efficiency.
82
112
  */
83
113
  max_chars_per_result?: number | null;
84
114
  }
@@ -123,40 +153,50 @@ export interface ExtractResponse {
123
153
  * Successful extract results.
124
154
  */
125
155
  results: Array<ExtractResult>;
156
+
157
+ /**
158
+ * Usage metrics for the extract request.
159
+ */
160
+ usage?: Array<UsageItem> | null;
161
+
162
+ /**
163
+ * Warnings for the extract request, if any.
164
+ */
165
+ warnings?: Array<Shared.Warning> | null;
126
166
  }
127
167
 
128
168
  /**
129
169
  * Extract result for a single URL.
130
170
  */
131
171
  export interface ExtractResult {
172
+ /**
173
+ * URL associated with the search result.
174
+ */
175
+ url: string;
176
+
132
177
  /**
133
178
  * Relevant excerpted content from the URL, formatted as markdown.
134
179
  */
135
- excerpts: Array<string> | null;
180
+ excerpts?: Array<string> | null;
136
181
 
137
182
  /**
138
183
  * Full content from the URL formatted as markdown, if requested.
139
184
  */
140
- full_content: string | null;
185
+ full_content?: string | null;
141
186
 
142
187
  /**
143
- * Publish date of the webpage, if available.
188
+ * Publish date of the webpage in YYYY-MM-DD format, if available.
144
189
  */
145
- publish_date: string | null;
190
+ publish_date?: string | null;
146
191
 
147
192
  /**
148
193
  * Title of the webpage, if available.
149
194
  */
150
- title: string | null;
151
-
152
- url: string;
195
+ title?: string | null;
153
196
  }
154
197
 
155
198
  /**
156
- * Fetch policy.
157
- *
158
- * Determines when to return content from the cache (faster) vs fetching live
159
- * content (fresher).
199
+ * Policy for live fetching web results.
160
200
  */
161
201
  export interface FetchPolicy {
162
202
  /**
@@ -167,16 +207,12 @@ export interface FetchPolicy {
167
207
 
168
208
  /**
169
209
  * Maximum age of cached content in seconds to trigger a live fetch. Minimum value
170
- * 600 seconds (10 minutes). If not provided, a dynamic age policy will be used
171
- * based on the search objective and url.
210
+ * 600 seconds (10 minutes).
172
211
  */
173
212
  max_age_seconds?: number | null;
174
213
 
175
214
  /**
176
- * Timeout in seconds for fetching live content if unavailable in cache. If
177
- * unspecified a dynamic timeout will be used based on the url, generally 15
178
- * seconds for simple pages and up to 60 seconds for complex pages requiring
179
- * javascript or PDF rendering.
215
+ * Timeout in seconds for fetching live content if unavailable in cache.
180
216
  */
181
217
  timeout_seconds?: number | null;
182
218
  }
@@ -194,26 +230,56 @@ export interface SearchResult {
194
230
  * Search ID. Example: `search_cad0a6d2dec046bd95ae900527d880e7`
195
231
  */
196
232
  search_id: string;
233
+
234
+ /**
235
+ * Usage metrics for the search request.
236
+ */
237
+ usage?: Array<UsageItem> | null;
238
+
239
+ /**
240
+ * Warnings for the search request, if any.
241
+ */
242
+ warnings?: Array<Shared.Warning> | null;
197
243
  }
198
244
 
199
245
  /**
200
- * A single search result from the web search API.
246
+ * Usage item for a single operation.
201
247
  */
202
- export interface WebSearchResult {
248
+ export interface UsageItem {
203
249
  /**
204
- * Text excerpts from the search result which are relevant to the request.
250
+ * Count of the SKU.
205
251
  */
206
- excerpts: Array<string>;
252
+ count: number;
207
253
 
208
254
  /**
209
- * Title of the search result.
255
+ * Name of the SKU.
210
256
  */
211
- title: string;
257
+ name: string;
258
+ }
212
259
 
260
+ /**
261
+ * A single search result from the web search API.
262
+ */
263
+ export interface WebSearchResult {
213
264
  /**
214
265
  * URL associated with the search result.
215
266
  */
216
267
  url: string;
268
+
269
+ /**
270
+ * Relevant excerpted content from the URL, formatted as markdown.
271
+ */
272
+ excerpts?: Array<string> | null;
273
+
274
+ /**
275
+ * Publish date of the webpage in YYYY-MM-DD format, if available.
276
+ */
277
+ publish_date?: string | null;
278
+
279
+ /**
280
+ * Title of the webpage, if available.
281
+ */
282
+ title?: string | null;
217
283
  }
218
284
 
219
285
  export interface BetaExtractParams {
@@ -230,10 +296,7 @@ export interface BetaExtractParams {
230
296
  excerpts?: boolean | ExcerptSettings;
231
297
 
232
298
  /**
233
- * Body param: Fetch policy.
234
- *
235
- * Determines when to return content from the cache (faster) vs fetching live
236
- * content (fresher).
299
+ * Body param: Policy for live fetching web results.
237
300
  */
238
301
  fetch_policy?: FetchPolicy | null;
239
302
 
@@ -277,8 +340,17 @@ export namespace BetaExtractParams {
277
340
 
278
341
  export interface BetaSearchParams {
279
342
  /**
280
- * Body param: Upper bound on the number of characters to include in excerpts for
281
- * each search result.
343
+ * Body param: Optional settings for returning relevant excerpts.
344
+ */
345
+ excerpts?: ExcerptSettings;
346
+
347
+ /**
348
+ * Body param: Policy for live fetching web results.
349
+ */
350
+ fetch_policy?: FetchPolicy | null;
351
+
352
+ /**
353
+ * @deprecated Body param: DEPRECATED: Use `excerpts.max_chars_per_result` instead.
282
354
  */
283
355
  max_chars_per_result?: number | null;
284
356
 
@@ -288,6 +360,14 @@ export interface BetaSearchParams {
288
360
  */
289
361
  max_results?: number | null;
290
362
 
363
+ /**
364
+ * Body param: Presets default values for parameters for different use cases.
365
+ * `one-shot` returns more comprehensive results and longer excerpts to answer
366
+ * questions from a single response, while `agentic` returns more concise,
367
+ * token-efficient results for use in an agentic loop.
368
+ */
369
+ mode?: 'one-shot' | 'agentic' | null;
370
+
291
371
  /**
292
372
  * Body param: Natural-language description of what the web search is trying to
293
373
  * find. May include guidance about preferred sources or freshness. At least one of
@@ -296,7 +376,7 @@ export interface BetaSearchParams {
296
376
  objective?: string | null;
297
377
 
298
378
  /**
299
- * Body param: Search processor.
379
+ * @deprecated Body param: DEPRECATED: use `mode` instead.
300
380
  */
301
381
  processor?: 'base' | 'pro' | null;
302
382
 
@@ -321,6 +401,7 @@ export interface BetaSearchParams {
321
401
  }
322
402
 
323
403
  Beta.TaskRun = TaskRun;
404
+ Beta.Findall = Findall;
324
405
 
325
406
  export declare namespace Beta {
326
407
  export {
@@ -330,6 +411,7 @@ export declare namespace Beta {
330
411
  type ExtractResult as ExtractResult,
331
412
  type FetchPolicy as FetchPolicy,
332
413
  type SearchResult as SearchResult,
414
+ type UsageItem as UsageItem,
333
415
  type WebSearchResult as WebSearchResult,
334
416
  type BetaExtractParams as BetaExtractParams,
335
417
  type BetaSearchParams as BetaSearchParams,
@@ -361,4 +443,30 @@ export declare namespace Beta {
361
443
  type TaskGroupEventsParams as TaskGroupEventsParams,
362
444
  type TaskGroupGetRunsParams as TaskGroupGetRunsParams,
363
445
  };
446
+
447
+ export {
448
+ Findall as Findall,
449
+ type FindallCandidateMatchStatusEvent as FindallCandidateMatchStatusEvent,
450
+ type FindallEnrichInput as FindallEnrichInput,
451
+ type FindallExtendInput as FindallExtendInput,
452
+ type FindallRun as FindallRun,
453
+ type FindallRunInput as FindallRunInput,
454
+ type FindallRunResult as FindallRunResult,
455
+ type FindallRunStatusEvent as FindallRunStatusEvent,
456
+ type FindallSchema as FindallSchema,
457
+ type FindallSchemaUpdatedEvent as FindallSchemaUpdatedEvent,
458
+ type IngestInput as IngestInput,
459
+ type FindallRetrieveResponse as FindallRetrieveResponse,
460
+ type FindallCancelResponse as FindallCancelResponse,
461
+ type FindallEventsResponse as FindallEventsResponse,
462
+ type FindallCreateParams as FindallCreateParams,
463
+ type FindallRetrieveParams as FindallRetrieveParams,
464
+ type FindallCancelParams as FindallCancelParams,
465
+ type FindallEnrichParams as FindallEnrichParams,
466
+ type FindallEventsParams as FindallEventsParams,
467
+ type FindallExtendParams as FindallExtendParams,
468
+ type FindallIngestParams as FindallIngestParams,
469
+ type FindallResultParams as FindallResultParams,
470
+ type FindallSchemaParams as FindallSchemaParams,
471
+ };
364
472
  }