parallel-web 0.1.2 → 0.2.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 CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0 (2025-10-21)
4
+
5
+ Full Changelog: [v0.1.2...v0.2.0](https://github.com/parallel-web/parallel-sdk-typescript/compare/v0.1.2...v0.2.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** Add /v1beta/extract ([a709400](https://github.com/parallel-web/parallel-sdk-typescript/commit/a7094002235d15e4a5f68422b9447127b9448b4b))
10
+
3
11
  ## 0.1.2 (2025-10-07)
4
12
 
5
13
  Full Changelog: [v0.1.1...v0.1.2](https://github.com/parallel-web/parallel-sdk-typescript/compare/v0.1.1...v0.1.2)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "parallel-web",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "The official TypeScript library for the Parallel API",
5
5
  "author": "Parallel <support@parallel.ai>",
6
6
  "types": "./index.d.ts",
@@ -9,10 +9,85 @@ import { RequestOptions } from "../../internal/request-options.mjs";
9
9
  export declare class Beta extends APIResource {
10
10
  taskRun: TaskRunAPI.TaskRun;
11
11
  taskGroup: TaskGroupAPI.TaskGroup;
12
+ /**
13
+ * Extracts relevant content from specific web URLs.
14
+ *
15
+ * To access this endpoint, pass the `parallel-beta` header with the value
16
+ * `search-extract-2025-10-10`.
17
+ */
18
+ extract(params: BetaExtractParams, options?: RequestOptions): APIPromise<ExtractResponse>;
12
19
  /**
13
20
  * Searches the web.
14
21
  */
15
- search(body: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult>;
22
+ search(params: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult>;
23
+ }
24
+ /**
25
+ * Optional settings for returning relevant excerpts.
26
+ */
27
+ export interface ExcerptSettings {
28
+ /**
29
+ * Optional upper bound on the total number of characters to include across all
30
+ * excerpts for each url. Excerpts may contain fewer characters than this limit to
31
+ * maximize relevance and token efficiency.
32
+ */
33
+ max_chars_per_result?: number | null;
34
+ }
35
+ /**
36
+ * Extract error details.
37
+ */
38
+ export interface ExtractError {
39
+ /**
40
+ * Content returned for http client or server errors, if any.
41
+ */
42
+ content: string | null;
43
+ /**
44
+ * Error type.
45
+ */
46
+ error_type: string;
47
+ /**
48
+ * HTTP status code, if available.
49
+ */
50
+ http_status_code: number | null;
51
+ url: string;
52
+ }
53
+ /**
54
+ * Fetch result.
55
+ */
56
+ export interface ExtractResponse {
57
+ /**
58
+ * Extract errors: requested URLs not in the results.
59
+ */
60
+ errors: Array<ExtractError>;
61
+ /**
62
+ * Extract request ID, e.g. `extract_cad0a6d2dec046bd95ae900527d880e7`
63
+ */
64
+ extract_id: string;
65
+ /**
66
+ * Successful extract results.
67
+ */
68
+ results: Array<ExtractResult>;
69
+ }
70
+ /**
71
+ * Extract result for a single URL.
72
+ */
73
+ export interface ExtractResult {
74
+ /**
75
+ * Relevant excerpted content from the URL, formatted as markdown.
76
+ */
77
+ excerpts: Array<string> | null;
78
+ /**
79
+ * Full content from the URL formatted as markdown, if requested.
80
+ */
81
+ full_content: string | null;
82
+ /**
83
+ * Publish date of the webpage, if available.
84
+ */
85
+ publish_date: string | null;
86
+ /**
87
+ * Title of the webpage, if available.
88
+ */
89
+ title: string | null;
90
+ url: string;
16
91
  }
17
92
  /**
18
93
  * Output for the Search API.
@@ -44,42 +119,123 @@ export interface WebSearchResult {
44
119
  */
45
120
  url: string;
46
121
  }
122
+ export interface BetaExtractParams {
123
+ /**
124
+ * Body param:
125
+ */
126
+ urls: Array<string>;
127
+ /**
128
+ * Body param: Include excerpts from each URL relevant to the search objective and
129
+ * queries. Note that if neither objective nor search_queries is provided, excerpts
130
+ * are redundant with full content.
131
+ */
132
+ excerpts?: boolean | ExcerptSettings;
133
+ /**
134
+ * Body param: Fetch policy.
135
+ *
136
+ * Determines when to return content from the cache (faster) vs fetching live
137
+ * content (fresher).
138
+ */
139
+ fetch_policy?: BetaExtractParams.FetchPolicy | null;
140
+ /**
141
+ * Body param: Include full content from each URL. Note that if neither objective
142
+ * nor search_queries is provided, excerpts are redundant with full content.
143
+ */
144
+ full_content?: boolean | BetaExtractParams.FullContentSettings;
145
+ /**
146
+ * Body param: If provided, focuses extracted content on the specified search
147
+ * objective.
148
+ */
149
+ objective?: string | null;
150
+ /**
151
+ * Body param: If provided, focuses extracted content on the specified keyword
152
+ * search queries.
153
+ */
154
+ search_queries?: Array<string> | null;
155
+ /**
156
+ * Header param: Optional header to specify the beta version(s) to enable.
157
+ */
158
+ betas?: Array<TaskRunAPI.ParallelBeta>;
159
+ }
160
+ export declare namespace BetaExtractParams {
161
+ /**
162
+ * Fetch policy.
163
+ *
164
+ * Determines when to return content from the cache (faster) vs fetching live
165
+ * content (fresher).
166
+ */
167
+ interface FetchPolicy {
168
+ /**
169
+ * If false, fallback to cached content older than max-age if live fetch fails or
170
+ * times out. If true, returns an error instead.
171
+ */
172
+ disable_cache_fallback?: boolean;
173
+ /**
174
+ * Maximum age of cached content in seconds to trigger a live fetch. Minimum value
175
+ * 600 seconds (10 minutes). If not provided, a dynamic age policy will be used
176
+ * based on the search objective and url.
177
+ */
178
+ max_age_seconds?: number | null;
179
+ /**
180
+ * Timeout in seconds for fetching live content if unavailable in cache. If
181
+ * unspecified a dynamic timeout will be used based on the url, generally 15
182
+ * seconds for simple pages and up to 60 seconds for complex pages requiring
183
+ * javascript or PDF rendering.
184
+ */
185
+ timeout_seconds?: number | null;
186
+ }
187
+ /**
188
+ * Optional settings for returning full content.
189
+ */
190
+ interface FullContentSettings {
191
+ /**
192
+ * Optional limit on the number of characters to include in the full content for
193
+ * each url. Full content always starts at the beginning of the page and is
194
+ * truncated at the limit if necessary.
195
+ */
196
+ max_chars_per_result?: number | null;
197
+ }
198
+ }
47
199
  export interface BetaSearchParams {
48
200
  /**
49
- * Upper bound on the number of characters to include in excerpts for each search
50
- * result.
201
+ * Body param: Upper bound on the number of characters to include in excerpts for
202
+ * each search result.
51
203
  */
52
204
  max_chars_per_result?: number | null;
53
205
  /**
54
- * Upper bound on the number of results to return. May be limited by the processor.
55
- * Defaults to 10 if not provided.
206
+ * Body param: Upper bound on the number of results to return. May be limited by
207
+ * the processor. Defaults to 10 if not provided.
56
208
  */
57
209
  max_results?: number | null;
58
210
  /**
59
- * Natural-language description of what the web search is trying to find. May
60
- * include guidance about preferred sources or freshness. At least one of objective
61
- * or search_queries must be provided.
211
+ * Body param: Natural-language description of what the web search is trying to
212
+ * find. May include guidance about preferred sources or freshness. At least one of
213
+ * objective or search_queries must be provided.
62
214
  */
63
215
  objective?: string | null;
64
216
  /**
65
- * Search processor.
217
+ * Body param: Search processor.
66
218
  */
67
- processor?: 'base' | 'pro';
219
+ processor?: 'base' | 'pro' | null;
68
220
  /**
69
- * Optional list of traditional keyword search queries to guide the search. May
70
- * contain search operators. At least one of objective or search_queries must be
71
- * provided.
221
+ * Body param: Optional list of traditional keyword search queries to guide the
222
+ * search. May contain search operators. At least one of objective or
223
+ * search_queries must be provided.
72
224
  */
73
225
  search_queries?: Array<string> | null;
74
226
  /**
75
- * Source policy for web search results.
227
+ * Body param: Source policy for web search results.
76
228
  *
77
229
  * This policy governs which sources are allowed/disallowed in results.
78
230
  */
79
231
  source_policy?: Shared.SourcePolicy | null;
232
+ /**
233
+ * Header param: Optional header to specify the beta version(s) to enable.
234
+ */
235
+ betas?: Array<TaskRunAPI.ParallelBeta>;
80
236
  }
81
237
  export declare namespace Beta {
82
- export { type SearchResult as SearchResult, type WebSearchResult as WebSearchResult, type BetaSearchParams as BetaSearchParams, };
238
+ export { type ExcerptSettings as ExcerptSettings, type ExtractError as ExtractError, type ExtractResponse as ExtractResponse, type ExtractResult as ExtractResult, type SearchResult as SearchResult, type WebSearchResult as WebSearchResult, type BetaExtractParams as BetaExtractParams, type BetaSearchParams as BetaSearchParams, };
83
239
  export { TaskRun as TaskRun, type BetaRunInput as BetaRunInput, type BetaTaskRunResult as BetaTaskRunResult, type ErrorEvent as ErrorEvent, type McpServer as McpServer, type McpToolCall as McpToolCall, type ParallelBeta as ParallelBeta, type TaskRunEvent as TaskRunEvent, type Webhook as Webhook, type TaskRunEventsResponse as TaskRunEventsResponse, type TaskRunCreateParams as TaskRunCreateParams, type TaskRunResultParams as TaskRunResultParams, };
84
240
  export { type TaskGroup as TaskGroup, type TaskGroupRunResponse as TaskGroupRunResponse, type TaskGroupStatus as TaskGroupStatus, type TaskGroupEventsResponse as TaskGroupEventsResponse, type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse, type TaskGroupCreateParams as TaskGroupCreateParams, type TaskGroupAddRunsParams as TaskGroupAddRunsParams, type TaskGroupEventsParams as TaskGroupEventsParams, type TaskGroupGetRunsParams as TaskGroupGetRunsParams, };
85
241
  }
@@ -1 +1 @@
1
- {"version":3,"file":"beta.d.mts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;OACX,KAAK,YAAY;OACjB,EACL,SAAS,EACT,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EAChB;OACM,KAAK,UAAU;OACf,EACL,YAAY,EACZ,iBAAiB,EACjB,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,OAAO,EACP,mBAAmB,EACnB,YAAY,EACZ,qBAAqB,EACrB,mBAAmB,EACnB,OAAO,EACR;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,IAAK,SAAQ,WAAW;IACnC,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IACnE,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;IAE7E;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,gBAAgB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,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D,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
@@ -9,10 +9,85 @@ import { RequestOptions } from "../../internal/request-options.js";
9
9
  export declare class Beta extends APIResource {
10
10
  taskRun: TaskRunAPI.TaskRun;
11
11
  taskGroup: TaskGroupAPI.TaskGroup;
12
+ /**
13
+ * Extracts relevant content from specific web URLs.
14
+ *
15
+ * To access this endpoint, pass the `parallel-beta` header with the value
16
+ * `search-extract-2025-10-10`.
17
+ */
18
+ extract(params: BetaExtractParams, options?: RequestOptions): APIPromise<ExtractResponse>;
12
19
  /**
13
20
  * Searches the web.
14
21
  */
15
- search(body: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult>;
22
+ search(params: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult>;
23
+ }
24
+ /**
25
+ * Optional settings for returning relevant excerpts.
26
+ */
27
+ export interface ExcerptSettings {
28
+ /**
29
+ * Optional upper bound on the total number of characters to include across all
30
+ * excerpts for each url. Excerpts may contain fewer characters than this limit to
31
+ * maximize relevance and token efficiency.
32
+ */
33
+ max_chars_per_result?: number | null;
34
+ }
35
+ /**
36
+ * Extract error details.
37
+ */
38
+ export interface ExtractError {
39
+ /**
40
+ * Content returned for http client or server errors, if any.
41
+ */
42
+ content: string | null;
43
+ /**
44
+ * Error type.
45
+ */
46
+ error_type: string;
47
+ /**
48
+ * HTTP status code, if available.
49
+ */
50
+ http_status_code: number | null;
51
+ url: string;
52
+ }
53
+ /**
54
+ * Fetch result.
55
+ */
56
+ export interface ExtractResponse {
57
+ /**
58
+ * Extract errors: requested URLs not in the results.
59
+ */
60
+ errors: Array<ExtractError>;
61
+ /**
62
+ * Extract request ID, e.g. `extract_cad0a6d2dec046bd95ae900527d880e7`
63
+ */
64
+ extract_id: string;
65
+ /**
66
+ * Successful extract results.
67
+ */
68
+ results: Array<ExtractResult>;
69
+ }
70
+ /**
71
+ * Extract result for a single URL.
72
+ */
73
+ export interface ExtractResult {
74
+ /**
75
+ * Relevant excerpted content from the URL, formatted as markdown.
76
+ */
77
+ excerpts: Array<string> | null;
78
+ /**
79
+ * Full content from the URL formatted as markdown, if requested.
80
+ */
81
+ full_content: string | null;
82
+ /**
83
+ * Publish date of the webpage, if available.
84
+ */
85
+ publish_date: string | null;
86
+ /**
87
+ * Title of the webpage, if available.
88
+ */
89
+ title: string | null;
90
+ url: string;
16
91
  }
17
92
  /**
18
93
  * Output for the Search API.
@@ -44,42 +119,123 @@ export interface WebSearchResult {
44
119
  */
45
120
  url: string;
46
121
  }
122
+ export interface BetaExtractParams {
123
+ /**
124
+ * Body param:
125
+ */
126
+ urls: Array<string>;
127
+ /**
128
+ * Body param: Include excerpts from each URL relevant to the search objective and
129
+ * queries. Note that if neither objective nor search_queries is provided, excerpts
130
+ * are redundant with full content.
131
+ */
132
+ excerpts?: boolean | ExcerptSettings;
133
+ /**
134
+ * Body param: Fetch policy.
135
+ *
136
+ * Determines when to return content from the cache (faster) vs fetching live
137
+ * content (fresher).
138
+ */
139
+ fetch_policy?: BetaExtractParams.FetchPolicy | null;
140
+ /**
141
+ * Body param: Include full content from each URL. Note that if neither objective
142
+ * nor search_queries is provided, excerpts are redundant with full content.
143
+ */
144
+ full_content?: boolean | BetaExtractParams.FullContentSettings;
145
+ /**
146
+ * Body param: If provided, focuses extracted content on the specified search
147
+ * objective.
148
+ */
149
+ objective?: string | null;
150
+ /**
151
+ * Body param: If provided, focuses extracted content on the specified keyword
152
+ * search queries.
153
+ */
154
+ search_queries?: Array<string> | null;
155
+ /**
156
+ * Header param: Optional header to specify the beta version(s) to enable.
157
+ */
158
+ betas?: Array<TaskRunAPI.ParallelBeta>;
159
+ }
160
+ export declare namespace BetaExtractParams {
161
+ /**
162
+ * Fetch policy.
163
+ *
164
+ * Determines when to return content from the cache (faster) vs fetching live
165
+ * content (fresher).
166
+ */
167
+ interface FetchPolicy {
168
+ /**
169
+ * If false, fallback to cached content older than max-age if live fetch fails or
170
+ * times out. If true, returns an error instead.
171
+ */
172
+ disable_cache_fallback?: boolean;
173
+ /**
174
+ * Maximum age of cached content in seconds to trigger a live fetch. Minimum value
175
+ * 600 seconds (10 minutes). If not provided, a dynamic age policy will be used
176
+ * based on the search objective and url.
177
+ */
178
+ max_age_seconds?: number | null;
179
+ /**
180
+ * Timeout in seconds for fetching live content if unavailable in cache. If
181
+ * unspecified a dynamic timeout will be used based on the url, generally 15
182
+ * seconds for simple pages and up to 60 seconds for complex pages requiring
183
+ * javascript or PDF rendering.
184
+ */
185
+ timeout_seconds?: number | null;
186
+ }
187
+ /**
188
+ * Optional settings for returning full content.
189
+ */
190
+ interface FullContentSettings {
191
+ /**
192
+ * Optional limit on the number of characters to include in the full content for
193
+ * each url. Full content always starts at the beginning of the page and is
194
+ * truncated at the limit if necessary.
195
+ */
196
+ max_chars_per_result?: number | null;
197
+ }
198
+ }
47
199
  export interface BetaSearchParams {
48
200
  /**
49
- * Upper bound on the number of characters to include in excerpts for each search
50
- * result.
201
+ * Body param: Upper bound on the number of characters to include in excerpts for
202
+ * each search result.
51
203
  */
52
204
  max_chars_per_result?: number | null;
53
205
  /**
54
- * Upper bound on the number of results to return. May be limited by the processor.
55
- * Defaults to 10 if not provided.
206
+ * Body param: Upper bound on the number of results to return. May be limited by
207
+ * the processor. Defaults to 10 if not provided.
56
208
  */
57
209
  max_results?: number | null;
58
210
  /**
59
- * Natural-language description of what the web search is trying to find. May
60
- * include guidance about preferred sources or freshness. At least one of objective
61
- * or search_queries must be provided.
211
+ * Body param: Natural-language description of what the web search is trying to
212
+ * find. May include guidance about preferred sources or freshness. At least one of
213
+ * objective or search_queries must be provided.
62
214
  */
63
215
  objective?: string | null;
64
216
  /**
65
- * Search processor.
217
+ * Body param: Search processor.
66
218
  */
67
- processor?: 'base' | 'pro';
219
+ processor?: 'base' | 'pro' | null;
68
220
  /**
69
- * Optional list of traditional keyword search queries to guide the search. May
70
- * contain search operators. At least one of objective or search_queries must be
71
- * provided.
221
+ * Body param: Optional list of traditional keyword search queries to guide the
222
+ * search. May contain search operators. At least one of objective or
223
+ * search_queries must be provided.
72
224
  */
73
225
  search_queries?: Array<string> | null;
74
226
  /**
75
- * Source policy for web search results.
227
+ * Body param: Source policy for web search results.
76
228
  *
77
229
  * This policy governs which sources are allowed/disallowed in results.
78
230
  */
79
231
  source_policy?: Shared.SourcePolicy | null;
232
+ /**
233
+ * Header param: Optional header to specify the beta version(s) to enable.
234
+ */
235
+ betas?: Array<TaskRunAPI.ParallelBeta>;
80
236
  }
81
237
  export declare namespace Beta {
82
- export { type SearchResult as SearchResult, type WebSearchResult as WebSearchResult, type BetaSearchParams as BetaSearchParams, };
238
+ export { type ExcerptSettings as ExcerptSettings, type ExtractError as ExtractError, type ExtractResponse as ExtractResponse, type ExtractResult as ExtractResult, type SearchResult as SearchResult, type WebSearchResult as WebSearchResult, type BetaExtractParams as BetaExtractParams, type BetaSearchParams as BetaSearchParams, };
83
239
  export { TaskRun as TaskRun, type BetaRunInput as BetaRunInput, type BetaTaskRunResult as BetaTaskRunResult, type ErrorEvent as ErrorEvent, type McpServer as McpServer, type McpToolCall as McpToolCall, type ParallelBeta as ParallelBeta, type TaskRunEvent as TaskRunEvent, type Webhook as Webhook, type TaskRunEventsResponse as TaskRunEventsResponse, type TaskRunCreateParams as TaskRunCreateParams, type TaskRunResultParams as TaskRunResultParams, };
84
240
  export { type TaskGroup as TaskGroup, type TaskGroupRunResponse as TaskGroupRunResponse, type TaskGroupStatus as TaskGroupStatus, type TaskGroupEventsResponse as TaskGroupEventsResponse, type TaskGroupGetRunsResponse as TaskGroupGetRunsResponse, type TaskGroupCreateParams as TaskGroupCreateParams, type TaskGroupAddRunsParams as TaskGroupAddRunsParams, type TaskGroupEventsParams as TaskGroupEventsParams, type TaskGroupGetRunsParams as TaskGroupGetRunsParams, };
85
241
  }
@@ -1 +1 @@
1
- {"version":3,"file":"beta.d.ts","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,MAAM;O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3C,KAAK,UAAU,IAAI,UAAU,EAC7B,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,YAAY,IAAI,YAAY,EACjC,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;IAEF,OAAO,EACL,KAAK,SAAS,IAAI,SAAS,EAC3B,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;CACH"}
@@ -7,17 +7,43 @@ const resource_1 = require("../../core/resource.js");
7
7
  const TaskGroupAPI = tslib_1.__importStar(require("./task-group.js"));
8
8
  const TaskRunAPI = tslib_1.__importStar(require("./task-run.js"));
9
9
  const task_run_1 = require("./task-run.js");
10
+ const headers_1 = require("../../internal/headers.js");
10
11
  class Beta extends resource_1.APIResource {
11
12
  constructor() {
12
13
  super(...arguments);
13
14
  this.taskRun = new TaskRunAPI.TaskRun(this._client);
14
15
  this.taskGroup = new TaskGroupAPI.TaskGroup(this._client);
15
16
  }
17
+ /**
18
+ * Extracts relevant content from specific web URLs.
19
+ *
20
+ * To access this endpoint, pass the `parallel-beta` header with the value
21
+ * `search-extract-2025-10-10`.
22
+ */
23
+ extract(params, options) {
24
+ const { betas, ...body } = params;
25
+ return this._client.post('/v1beta/extract', {
26
+ body,
27
+ ...options,
28
+ headers: (0, headers_1.buildHeaders)([
29
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
30
+ options?.headers,
31
+ ]),
32
+ });
33
+ }
16
34
  /**
17
35
  * Searches the web.
18
36
  */
19
- search(body, options) {
20
- return this._client.post('/v1beta/search', { body, ...options });
37
+ search(params, options) {
38
+ const { betas, ...body } = params;
39
+ return this._client.post('/v1beta/search', {
40
+ body,
41
+ ...options,
42
+ headers: (0, headers_1.buildHeaders)([
43
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
44
+ options?.headers,
45
+ ]),
46
+ });
21
47
  }
22
48
  }
23
49
  exports.Beta = Beta;
@@ -1 +1 @@
1
- {"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAElD,sEAA6C;AAY7C,kEAAyC;AACzC,4CAaoB;AAIpB,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAQ/E,CAAC;IANC;;OAEG;IACH,MAAM,CAAC,IAAsB,EAAE,OAAwB;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;CACF;AAVD,oBAUC;AA6ED,IAAI,CAAC,OAAO,GAAG,kBAAO,CAAC"}
1
+ {"version":3,"file":"beta.js","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAElD,sEAA6C;AAY7C,kEAAyC;AACzC,4CAaoB;AAEpB,uDAAsD;AAGtD,MAAa,IAAK,SAAQ,sBAAW;IAArC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CA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RunAPI from "./task-run.mjs";
5
5
  import { TaskRun, } from "./task-run.mjs";
6
+ import { buildHeaders } from "../../internal/headers.mjs";
6
7
  export class Beta extends APIResource {
7
8
  constructor() {
8
9
  super(...arguments);
9
10
  this.taskRun = new TaskRunAPI.TaskRun(this._client);
10
11
  this.taskGroup = new TaskGroupAPI.TaskGroup(this._client);
11
12
  }
13
+ /**
14
+ * Extracts relevant content from specific web URLs.
15
+ *
16
+ * To access this endpoint, pass the `parallel-beta` header with the value
17
+ * `search-extract-2025-10-10`.
18
+ */
19
+ extract(params, options) {
20
+ const { betas, ...body } = params;
21
+ return this._client.post('/v1beta/extract', {
22
+ body,
23
+ ...options,
24
+ headers: buildHeaders([
25
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
26
+ options?.headers,
27
+ ]),
28
+ });
29
+ }
12
30
  /**
13
31
  * Searches the web.
14
32
  */
15
- search(body, options) {
16
- return this._client.post('/v1beta/search', { body, ...options });
33
+ search(params, options) {
34
+ const { betas, ...body } = params;
35
+ return this._client.post('/v1beta/search', {
36
+ body,
37
+ ...options,
38
+ headers: buildHeaders([
39
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
40
+ options?.headers,
41
+ ]),
42
+ });
17
43
  }
18
44
  }
19
45
  Beta.TaskRun = TaskRun;
@@ -1 +1 @@
1
- {"version":3,"file":"beta.mjs","sourceRoot":"","sources":["../../src/resources/beta/beta.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,YAAY;OAYjB,KAAK,UAAU;OACf,EAOL,OAAO,GAMR;AAID,MAAM,OAAO,IAAK,SAAQ,WAAW;IAArC;;QACE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAQ/E,CAAC;I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C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACzC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC;gBACpB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACvF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AA2PD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC"}
@@ -30,20 +30,128 @@ import {
30
30
  Webhook,
31
31
  } from './task-run';
32
32
  import { APIPromise } from '../../core/api-promise';
33
+ import { buildHeaders } from '../../internal/headers';
33
34
  import { RequestOptions } from '../../internal/request-options';
34
35
 
35
36
  export class Beta extends APIResource {
36
37
  taskRun: TaskRunAPI.TaskRun = new TaskRunAPI.TaskRun(this._client);
37
38
  taskGroup: TaskGroupAPI.TaskGroup = new TaskGroupAPI.TaskGroup(this._client);
38
39
 
40
+ /**
41
+ * Extracts relevant content from specific web URLs.
42
+ *
43
+ * To access this endpoint, pass the `parallel-beta` header with the value
44
+ * `search-extract-2025-10-10`.
45
+ */
46
+ extract(params: BetaExtractParams, options?: RequestOptions): APIPromise<ExtractResponse> {
47
+ const { betas, ...body } = params;
48
+ return this._client.post('/v1beta/extract', {
49
+ body,
50
+ ...options,
51
+ headers: buildHeaders([
52
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
53
+ options?.headers,
54
+ ]),
55
+ });
56
+ }
57
+
39
58
  /**
40
59
  * Searches the web.
41
60
  */
42
- search(body: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult> {
43
- return this._client.post('/v1beta/search', { body, ...options });
61
+ search(params: BetaSearchParams, options?: RequestOptions): APIPromise<SearchResult> {
62
+ const { betas, ...body } = params;
63
+ return this._client.post('/v1beta/search', {
64
+ body,
65
+ ...options,
66
+ headers: buildHeaders([
67
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
68
+ options?.headers,
69
+ ]),
70
+ });
44
71
  }
45
72
  }
46
73
 
74
+ /**
75
+ * Optional settings for returning relevant excerpts.
76
+ */
77
+ export interface ExcerptSettings {
78
+ /**
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.
82
+ */
83
+ max_chars_per_result?: number | null;
84
+ }
85
+
86
+ /**
87
+ * Extract error details.
88
+ */
89
+ export interface ExtractError {
90
+ /**
91
+ * Content returned for http client or server errors, if any.
92
+ */
93
+ content: string | null;
94
+
95
+ /**
96
+ * Error type.
97
+ */
98
+ error_type: string;
99
+
100
+ /**
101
+ * HTTP status code, if available.
102
+ */
103
+ http_status_code: number | null;
104
+
105
+ url: string;
106
+ }
107
+
108
+ /**
109
+ * Fetch result.
110
+ */
111
+ export interface ExtractResponse {
112
+ /**
113
+ * Extract errors: requested URLs not in the results.
114
+ */
115
+ errors: Array<ExtractError>;
116
+
117
+ /**
118
+ * Extract request ID, e.g. `extract_cad0a6d2dec046bd95ae900527d880e7`
119
+ */
120
+ extract_id: string;
121
+
122
+ /**
123
+ * Successful extract results.
124
+ */
125
+ results: Array<ExtractResult>;
126
+ }
127
+
128
+ /**
129
+ * Extract result for a single URL.
130
+ */
131
+ export interface ExtractResult {
132
+ /**
133
+ * Relevant excerpted content from the URL, formatted as markdown.
134
+ */
135
+ excerpts: Array<string> | null;
136
+
137
+ /**
138
+ * Full content from the URL formatted as markdown, if requested.
139
+ */
140
+ full_content: string | null;
141
+
142
+ /**
143
+ * Publish date of the webpage, if available.
144
+ */
145
+ publish_date: string | null;
146
+
147
+ /**
148
+ * Title of the webpage, if available.
149
+ */
150
+ title: string | null;
151
+
152
+ url: string;
153
+ }
154
+
47
155
  /**
48
156
  * Output for the Search API.
49
157
  */
@@ -79,52 +187,150 @@ export interface WebSearchResult {
79
187
  url: string;
80
188
  }
81
189
 
190
+ export interface BetaExtractParams {
191
+ /**
192
+ * Body param:
193
+ */
194
+ urls: Array<string>;
195
+
196
+ /**
197
+ * Body param: Include excerpts from each URL relevant to the search objective and
198
+ * queries. Note that if neither objective nor search_queries is provided, excerpts
199
+ * are redundant with full content.
200
+ */
201
+ excerpts?: boolean | ExcerptSettings;
202
+
203
+ /**
204
+ * Body param: Fetch policy.
205
+ *
206
+ * Determines when to return content from the cache (faster) vs fetching live
207
+ * content (fresher).
208
+ */
209
+ fetch_policy?: BetaExtractParams.FetchPolicy | null;
210
+
211
+ /**
212
+ * Body param: Include full content from each URL. Note that if neither objective
213
+ * nor search_queries is provided, excerpts are redundant with full content.
214
+ */
215
+ full_content?: boolean | BetaExtractParams.FullContentSettings;
216
+
217
+ /**
218
+ * Body param: If provided, focuses extracted content on the specified search
219
+ * objective.
220
+ */
221
+ objective?: string | null;
222
+
223
+ /**
224
+ * Body param: If provided, focuses extracted content on the specified keyword
225
+ * search queries.
226
+ */
227
+ search_queries?: Array<string> | null;
228
+
229
+ /**
230
+ * Header param: Optional header to specify the beta version(s) to enable.
231
+ */
232
+ betas?: Array<TaskRunAPI.ParallelBeta>;
233
+ }
234
+
235
+ export namespace BetaExtractParams {
236
+ /**
237
+ * Fetch policy.
238
+ *
239
+ * Determines when to return content from the cache (faster) vs fetching live
240
+ * content (fresher).
241
+ */
242
+ export interface FetchPolicy {
243
+ /**
244
+ * If false, fallback to cached content older than max-age if live fetch fails or
245
+ * times out. If true, returns an error instead.
246
+ */
247
+ disable_cache_fallback?: boolean;
248
+
249
+ /**
250
+ * Maximum age of cached content in seconds to trigger a live fetch. Minimum value
251
+ * 600 seconds (10 minutes). If not provided, a dynamic age policy will be used
252
+ * based on the search objective and url.
253
+ */
254
+ max_age_seconds?: number | null;
255
+
256
+ /**
257
+ * Timeout in seconds for fetching live content if unavailable in cache. If
258
+ * unspecified a dynamic timeout will be used based on the url, generally 15
259
+ * seconds for simple pages and up to 60 seconds for complex pages requiring
260
+ * javascript or PDF rendering.
261
+ */
262
+ timeout_seconds?: number | null;
263
+ }
264
+
265
+ /**
266
+ * Optional settings for returning full content.
267
+ */
268
+ export interface FullContentSettings {
269
+ /**
270
+ * Optional limit on the number of characters to include in the full content for
271
+ * each url. Full content always starts at the beginning of the page and is
272
+ * truncated at the limit if necessary.
273
+ */
274
+ max_chars_per_result?: number | null;
275
+ }
276
+ }
277
+
82
278
  export interface BetaSearchParams {
83
279
  /**
84
- * Upper bound on the number of characters to include in excerpts for each search
85
- * result.
280
+ * Body param: Upper bound on the number of characters to include in excerpts for
281
+ * each search result.
86
282
  */
87
283
  max_chars_per_result?: number | null;
88
284
 
89
285
  /**
90
- * Upper bound on the number of results to return. May be limited by the processor.
91
- * Defaults to 10 if not provided.
286
+ * Body param: Upper bound on the number of results to return. May be limited by
287
+ * the processor. Defaults to 10 if not provided.
92
288
  */
93
289
  max_results?: number | null;
94
290
 
95
291
  /**
96
- * Natural-language description of what the web search is trying to find. May
97
- * include guidance about preferred sources or freshness. At least one of objective
98
- * or search_queries must be provided.
292
+ * Body param: Natural-language description of what the web search is trying to
293
+ * find. May include guidance about preferred sources or freshness. At least one of
294
+ * objective or search_queries must be provided.
99
295
  */
100
296
  objective?: string | null;
101
297
 
102
298
  /**
103
- * Search processor.
299
+ * Body param: Search processor.
104
300
  */
105
- processor?: 'base' | 'pro';
301
+ processor?: 'base' | 'pro' | null;
106
302
 
107
303
  /**
108
- * Optional list of traditional keyword search queries to guide the search. May
109
- * contain search operators. At least one of objective or search_queries must be
110
- * provided.
304
+ * Body param: Optional list of traditional keyword search queries to guide the
305
+ * search. May contain search operators. At least one of objective or
306
+ * search_queries must be provided.
111
307
  */
112
308
  search_queries?: Array<string> | null;
113
309
 
114
310
  /**
115
- * Source policy for web search results.
311
+ * Body param: Source policy for web search results.
116
312
  *
117
313
  * This policy governs which sources are allowed/disallowed in results.
118
314
  */
119
315
  source_policy?: Shared.SourcePolicy | null;
316
+
317
+ /**
318
+ * Header param: Optional header to specify the beta version(s) to enable.
319
+ */
320
+ betas?: Array<TaskRunAPI.ParallelBeta>;
120
321
  }
121
322
 
122
323
  Beta.TaskRun = TaskRun;
123
324
 
124
325
  export declare namespace Beta {
125
326
  export {
327
+ type ExcerptSettings as ExcerptSettings,
328
+ type ExtractError as ExtractError,
329
+ type ExtractResponse as ExtractResponse,
330
+ type ExtractResult as ExtractResult,
126
331
  type SearchResult as SearchResult,
127
332
  type WebSearchResult as WebSearchResult,
333
+ type BetaExtractParams as BetaExtractParams,
128
334
  type BetaSearchParams as BetaSearchParams,
129
335
  };
130
336
 
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.2'; // x-release-please-version
1
+ export const VERSION = '0.2.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.2";
1
+ export declare const VERSION = "0.2.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.2";
1
+ export declare const VERSION = "0.2.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.2'; // x-release-please-version
4
+ exports.VERSION = '0.2.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.2'; // x-release-please-version
1
+ export const VERSION = '0.2.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map