diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 486dd0b..dc936bc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -55,14 +55,18 @@ jobs:
run: ./scripts/build
- name: Get GitHub OIDC Token
- if: github.repository == 'stainless-sdks/parallel-sdk-typescript'
+ if: |-
+ github.repository == 'stainless-sdks/parallel-sdk-typescript' &&
+ !startsWith(github.ref, 'refs/heads/stl/')
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());
- name: Upload tarball
- if: github.repository == 'stainless-sdks/parallel-sdk-typescript'
+ if: |-
+ github.repository == 'stainless-sdks/parallel-sdk-typescript' &&
+ !startsWith(github.ref, 'refs/heads/stl/')
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 816df2d..0477999 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.1"
+ ".": "0.3.2"
}
diff --git a/.stats.yml b/.stats.yml
index 7272afb..d30019d 100644
--- a/.stats.yml
+++ b/.stats.yml
@@ -1,4 +1,4 @@
configured_endpoints: 22
-openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-31ff2f5e2e00191b8f376bd9648d8305d224493bf40dd9f0e73e6668f2558504.yml
-openapi_spec_hash: de646907ddb63402755855b7e78ccbac
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-970b780e86490322cc3c7e2b57f140ca6766a3d9f6e0d3402837ebaf7c2183fc.yml
+openapi_spec_hash: 34f784ce2dec796048e6780924bae08f
config_hash: a398d153133d8884bed4e5256a0ae818
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 673901b..d9ae804 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,37 @@
# Changelog
+## 0.3.2 (2026-03-09)
+
+Full Changelog: [v0.3.1...v0.3.2](https://github.com/parallel-web/parallel-sdk-typescript/compare/v0.3.1...v0.3.2)
+
+### Features
+
+* **api:** add betas back in for search ([88ffc07](https://github.com/parallel-web/parallel-sdk-typescript/commit/88ffc0723b8ad725b626d47d95d45cc088a97bd9))
+* **api:** sync openapi spec ([8b8c04d](https://github.com/parallel-web/parallel-sdk-typescript/commit/8b8c04d813a6f29274cb0e0a416539e0ec7aa5d4))
+
+
+### Bug Fixes
+
+* **client:** avoid memory leak with abort signals ([b5891d2](https://github.com/parallel-web/parallel-sdk-typescript/commit/b5891d2e289ba683e2f977cf52199b8185d1a375))
+* **client:** avoid removing abort listener too early ([971bc60](https://github.com/parallel-web/parallel-sdk-typescript/commit/971bc60f78633e423d4434cc64cbf56a3fe2a08d))
+* **client:** preserve URL params already embedded in path ([0aa4a14](https://github.com/parallel-web/parallel-sdk-typescript/commit/0aa4a148cf3bfc956a1d9de358695df75dbd214e))
+* **docs/contributing:** correct pnpm link command ([0fba230](https://github.com/parallel-web/parallel-sdk-typescript/commit/0fba230efc58ec8db7e3b97e498c970e9d5a42f3))
+
+
+### Chores
+
+* **ci:** skip uploading artifacts on stainless-internal branches ([4d15af4](https://github.com/parallel-web/parallel-sdk-typescript/commit/4d15af4c852abb1422cb3b79579e4f76b837c1d4))
+* **client:** do not parse responses with empty content-length ([5f852e5](https://github.com/parallel-web/parallel-sdk-typescript/commit/5f852e53c6d293dcdd940bcb1fc741b2215c5023))
+* **client:** restructure abort controller binding ([09b3c0f](https://github.com/parallel-web/parallel-sdk-typescript/commit/09b3c0fdd35a41325408f2304488c41c4fcf44e4))
+* format all `api.md` files ([112a9ed](https://github.com/parallel-web/parallel-sdk-typescript/commit/112a9ede4af725999c475e62a590a2273abc6dfe))
+* **internal/client:** fix form-urlencoded requests ([645d7f8](https://github.com/parallel-web/parallel-sdk-typescript/commit/645d7f8e772f781bf86a77b1f35b2ddb6cd215eb))
+* **internal:** avoid type checking errors with ts-reset ([8f10069](https://github.com/parallel-web/parallel-sdk-typescript/commit/8f100690328b09531482ec54e4cf38e0b0d59a9b))
+* **internal:** codegen related update ([ffdc333](https://github.com/parallel-web/parallel-sdk-typescript/commit/ffdc333a95868e11c587facb0ffb3b4f68e2fbad))
+* **internal:** codegen related update ([f66750f](https://github.com/parallel-web/parallel-sdk-typescript/commit/f66750f2632f5e9f32dc2e334c9472fb7aebc7a5))
+* **internal:** move stringifyQuery implementation to internal function ([2cf4c15](https://github.com/parallel-web/parallel-sdk-typescript/commit/2cf4c156bfa74dd29369f77b60ab5fc4281fe1be))
+* **test:** do not count install time for mock server timeout ([3b3f3ed](https://github.com/parallel-web/parallel-sdk-typescript/commit/3b3f3ed79c2ce888d831ed7a26c3a8dcde085ce0))
+* update mock server docs ([004672e](https://github.com/parallel-web/parallel-sdk-typescript/commit/004672ea0157df3c026277c5d892849bb0b9a9fe))
+
## 0.3.1 (2026-01-28)
Full Changelog: [v0.3.0...v0.3.1](https://github.com/parallel-web/parallel-sdk-typescript/compare/v0.3.0...v0.3.1)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 51d29f4..54dc56d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -60,7 +60,7 @@ $ yarn link parallel-web
# With pnpm
$ pnpm link --global
$ cd ../my-package
-$ pnpm link -—global parallel-web
+$ pnpm link --global parallel-web
```
## Running tests
@@ -68,7 +68,7 @@ $ pnpm link -—global parallel-web
Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
```sh
-$ npx prism mock path/to/your/openapi.yml
+$ ./scripts/mock
```
```sh
diff --git a/README.md b/README.md
index 1f86628..1c96161 100644
--- a/README.md
+++ b/README.md
@@ -31,7 +31,7 @@ const taskRun = await client.taskRun.create({
processor: 'base',
});
-console.log(taskRun.run_id);
+console.log(taskRun.interaction_id);
```
### Request & Response types
@@ -155,7 +155,7 @@ const { data: taskRun, response: raw } = await client.taskRun
.create({ input: 'What was the GDP of France in 2023?', processor: 'base' })
.withResponse();
console.log(raw.headers.get('X-My-Header'));
-console.log(taskRun.run_id);
+console.log(taskRun.interaction_id);
```
### Logging
diff --git a/api.md b/api.md
index ed06cc8..fff6b5d 100644
--- a/api.md
+++ b/api.md
@@ -29,87 +29,4 @@ Methods:
- client.taskRun.retrieve(runID) -> TaskRun
- client.taskRun.result(runID, { ...params }) -> TaskRunResult
-# Beta
-
-Types:
-
-- ExcerptSettings
-- ExtractError
-- ExtractResponse
-- ExtractResult
-- FetchPolicy
-- SearchResult
-- UsageItem
-- WebSearchResult
-
-Methods:
-
-- client.beta.extract({ ...params }) -> ExtractResponse
-- client.beta.search({ ...params }) -> SearchResult
-
-## TaskRun
-
-Types:
-
-- BetaRunInput
-- BetaTaskRunResult
-- ErrorEvent
-- McpServer
-- McpToolCall
-- ParallelBeta
-- TaskRunEvent
-- Webhook
-- TaskRunEventsResponse
-
-Methods:
-
-- client.beta.taskRun.create({ ...params }) -> TaskRun
-- client.beta.taskRun.events(runID) -> TaskRunEventsResponse
-- client.beta.taskRun.result(runID, { ...params }) -> BetaTaskRunResult
-
-## TaskGroup
-
-Types:
-
-- TaskGroup
-- TaskGroupRunResponse
-- TaskGroupStatus
-- TaskGroupEventsResponse
-- TaskGroupGetRunsResponse
-
-Methods:
-
-- client.beta.taskGroup.create({ ...params }) -> TaskGroup
-- client.beta.taskGroup.retrieve(taskGroupID) -> TaskGroup
-- client.beta.taskGroup.addRuns(taskGroupID, { ...params }) -> TaskGroupRunResponse
-- client.beta.taskGroup.events(taskGroupID, { ...params }) -> TaskGroupEventsResponse
-- client.beta.taskGroup.getRuns(taskGroupID, { ...params }) -> TaskGroupGetRunsResponse
-
-## FindAll
-
-Types:
-
-- FindAllCandidateMatchStatusEvent
-- FindAllEnrichInput
-- FindAllExtendInput
-- FindAllRun
-- FindAllRunInput
-- FindAllRunResult
-- FindAllRunStatusEvent
-- FindAllSchema
-- FindAllSchemaUpdatedEvent
-- IngestInput
-- FindAllCancelResponse
-- FindAllEventsResponse
-
-Methods:
-
-- client.beta.findall.create({ ...params }) -> FindAllRun
-- client.beta.findall.retrieve(findallID, { ...params }) -> FindAllRun
-- client.beta.findall.cancel(findallID, { ...params }) -> unknown
-- client.beta.findall.enrich(findallID, { ...params }) -> FindAllSchema
-- client.beta.findall.events(findallID, { ...params }) -> FindAllEventsResponse
-- client.beta.findall.extend(findallID, { ...params }) -> FindAllSchema
-- client.beta.findall.ingest({ ...params }) -> FindAllSchema
-- client.beta.findall.result(findallID, { ...params }) -> FindAllRunResult
-- client.beta.findall.schema(findallID, { ...params }) -> FindAllSchema
+# [Beta](src/resources/beta/api.md)
diff --git a/package.json b/package.json
index e7ae0e0..67ef33c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "parallel-web",
- "version": "0.3.1",
+ "version": "0.3.2",
"description": "The official TypeScript library for the Parallel API",
"author": "Parallel ",
"types": "dist/index.d.ts",
diff --git a/scripts/mock b/scripts/mock
index 0b28f6e..bcf3b39 100755
--- a/scripts/mock
+++ b/scripts/mock
@@ -21,11 +21,22 @@ echo "==> Starting mock server with URL ${URL}"
# Run prism mock on the given spec
if [ "$1" == "--daemon" ]; then
+ # Pre-install the package so the download doesn't eat into the startup timeout
+ npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism --version
+
npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
- # Wait for server to come online
+ # Wait for server to come online (max 30s)
echo -n "Waiting for server"
+ attempts=0
while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
+ attempts=$((attempts + 1))
+ if [ "$attempts" -ge 300 ]; then
+ echo
+ echo "Timed out waiting for Prism server to start"
+ cat .prism.log
+ exit 1
+ fi
echo -n "."
sleep 0.1
done
diff --git a/src/client.ts b/src/client.ts
index af02f8e..99463c0 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -11,6 +11,7 @@ import type { APIResponseProps } from './internal/parse';
import { getPlatformHeaders } from './internal/detect-platform';
import * as Shims from './internal/shims';
import * as Opts from './internal/request-options';
+import { stringifyQuery } from './internal/utils/query';
import { VERSION } from './version';
import * as Errors from './core/error';
import * as Uploads from './core/uploads';
@@ -228,21 +229,8 @@ export class Parallel {
/**
* Basic re-implementation of `qs.stringify` for primitive types.
*/
- protected stringifyQuery(query: Record): string {
- return Object.entries(query)
- .filter(([_, value]) => typeof value !== 'undefined')
- .map(([key, value]) => {
- if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
- return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
- }
- if (value === null) {
- return `${encodeURIComponent(key)}=`;
- }
- throw new Errors.ParallelError(
- `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
- );
- })
- .join('&');
+ protected stringifyQuery(query: object | Record): string {
+ return stringifyQuery(query);
}
private getUserAgent(): string {
@@ -274,12 +262,13 @@ export class Parallel {
: new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path));
const defaultQuery = this.defaultQuery();
- if (!isEmptyObj(defaultQuery)) {
- query = { ...defaultQuery, ...query };
+ const pathQuery = Object.fromEntries(url.searchParams);
+ if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) {
+ query = { ...pathQuery, ...defaultQuery, ...query };
}
if (typeof query === 'object' && query && !Array.isArray(query)) {
- url.search = this.stringifyQuery(query as Record);
+ url.search = this.stringifyQuery(query);
}
return url.toString();
@@ -463,7 +452,7 @@ export class Parallel {
loggerFor(this).info(`${responseInfo} - ${retryMessage}`);
const errText = await response.text().catch((err: any) => castToError(err).message);
- const errJSON = safeJSON(errText);
+ const errJSON = safeJSON(errText) as any;
const errMessage = errJSON ? undefined : errText;
loggerFor(this).debug(
@@ -504,9 +493,10 @@ export class Parallel {
controller: AbortController,
): Promise {
const { signal, method, ...options } = init || {};
- if (signal) signal.addEventListener('abort', () => controller.abort());
+ const abort = this._makeAbort(controller);
+ if (signal) signal.addEventListener('abort', abort, { once: true });
- const timeout = setTimeout(() => controller.abort(), ms);
+ const timeout = setTimeout(abort, ms);
const isReadableBody =
((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) ||
@@ -583,9 +573,9 @@ export class Parallel {
}
}
- // If the API asks us to wait a certain amount of time (and it's a reasonable amount),
- // just do what it says, but otherwise calculate a default
- if (!(timeoutMillis && 0 <= timeoutMillis && timeoutMillis < 60 * 1000)) {
+ // If the API asks us to wait a certain amount of time, just do what it
+ // says, but otherwise calculate a default
+ if (timeoutMillis === undefined) {
const maxRetries = options.maxRetries ?? this.maxRetries;
timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries);
}
@@ -673,6 +663,12 @@ export class Parallel {
return headers.values;
}
+ private _makeAbort(controller: AbortController) {
+ // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure
+ // would capture all request options, and cause a memory leak.
+ return () => controller.abort();
+ }
+
private buildBody({ options: { body, headers: rawHeaders } }: { options: FinalRequestOptions }): {
bodyHeaders: HeadersLike;
body: BodyInit | undefined;
@@ -705,6 +701,14 @@ export class Parallel {
(Symbol.iterator in body && 'next' in body && typeof body.next === 'function'))
) {
return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) };
+ } else if (
+ typeof body === 'object' &&
+ headers.values.get('content-type') === 'application/x-www-form-urlencoded'
+ ) {
+ return {
+ bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' },
+ body: this.stringifyQuery(body),
+ };
} else {
return this.#encoder({ body, headers });
}
@@ -729,6 +733,10 @@ export class Parallel {
static toFile = Uploads.toFile;
+ /**
+ * 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.
+ * - Output metadata: citations, excerpts, reasoning, and confidence per field
+ */
taskRun: API.TaskRun = new API.TaskRun(this);
beta: API.Beta = new API.Beta(this);
}
diff --git a/src/core/streaming.ts b/src/core/streaming.ts
index 57924d1..22c2f78 100644
--- a/src/core/streaming.ts
+++ b/src/core/streaming.ts
@@ -46,7 +46,7 @@ export class Stream- implements AsyncIterable
- {
try {
for await (const sse of _iterSSEMessages(response, controller)) {
try {
- yield JSON.parse(sse.data);
+ yield JSON.parse(sse.data) as Item;
} catch (e) {
logger.error(`Could not parse message into JSON:`, sse.data);
logger.error(`From chunk:`, sse.raw);
@@ -102,7 +102,7 @@ export class Stream
- implements AsyncIterable
- {
try {
for await (const line of iterLines()) {
if (done) continue;
- if (line) yield JSON.parse(line);
+ if (line) yield JSON.parse(line) as Item;
}
done = true;
} catch (e) {
diff --git a/src/internal/parse.ts b/src/internal/parse.ts
index 914d001..59b4a55 100644
--- a/src/internal/parse.ts
+++ b/src/internal/parse.ts
@@ -43,6 +43,12 @@ export async function defaultParseResponse(client: Parallel, props: APIRespon
const mediaType = contentType?.split(';')[0]?.trim();
const isJSON = mediaType?.includes('application/json') || mediaType?.endsWith('+json');
if (isJSON) {
+ const contentLength = response.headers.get('content-length');
+ if (contentLength === '0') {
+ // if there is no content we can't do anything
+ return undefined as T;
+ }
+
const json = await response.json();
return json as T;
}
diff --git a/src/internal/utils.ts b/src/internal/utils.ts
index 3cbfacc..c591353 100644
--- a/src/internal/utils.ts
+++ b/src/internal/utils.ts
@@ -6,3 +6,4 @@ export * from './utils/env';
export * from './utils/log';
export * from './utils/uuid';
export * from './utils/sleep';
+export * from './utils/query';
diff --git a/src/internal/utils/query.ts b/src/internal/utils/query.ts
new file mode 100644
index 0000000..2194aaa
--- /dev/null
+++ b/src/internal/utils/query.ts
@@ -0,0 +1,23 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import { ParallelError } from '../../core/error';
+
+/**
+ * Basic re-implementation of `qs.stringify` for primitive types.
+ */
+export function stringifyQuery(query: object | Record) {
+ return Object.entries(query)
+ .filter(([_, value]) => typeof value !== 'undefined')
+ .map(([key, value]) => {
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
+ return `${encodeURIComponent(key)}=${encodeURIComponent(value)}`;
+ }
+ if (value === null) {
+ return `${encodeURIComponent(key)}=`;
+ }
+ throw new ParallelError(
+ `Cannot stringify type ${typeof value}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`,
+ );
+ })
+ .join('&');
+}
diff --git a/src/resources/beta/api.md b/src/resources/beta/api.md
new file mode 100644
index 0000000..ed3542d
--- /dev/null
+++ b/src/resources/beta/api.md
@@ -0,0 +1,84 @@
+# Beta
+
+Types:
+
+-
ExcerptSettings
+- ExtractError
+- ExtractResponse
+- ExtractResult
+- FetchPolicy
+- SearchResult
+- UsageItem
+- WebSearchResult
+
+Methods:
+
+- client.beta.extract({ ...params }) -> ExtractResponse
+- client.beta.search({ ...params }) -> SearchResult
+
+## TaskRun
+
+Types:
+
+- BetaRunInput
+- BetaTaskRunResult
+- ErrorEvent
+- McpServer
+- McpToolCall
+- ParallelBeta
+- TaskRunEvent
+- Webhook
+- TaskRunEventsResponse
+
+Methods:
+
+- client.beta.taskRun.create({ ...params }) -> TaskRun
+- client.beta.taskRun.events(runID) -> TaskRunEventsResponse
+- client.beta.taskRun.result(runID, { ...params }) -> BetaTaskRunResult
+
+## TaskGroup
+
+Types:
+
+- TaskGroup
+- TaskGroupRunResponse
+- TaskGroupStatus
+- TaskGroupEventsResponse
+- TaskGroupGetRunsResponse
+
+Methods:
+
+- client.beta.taskGroup.create({ ...params }) -> TaskGroup
+- client.beta.taskGroup.retrieve(taskGroupID) -> TaskGroup
+- client.beta.taskGroup.addRuns(taskGroupID, { ...params }) -> TaskGroupRunResponse
+- client.beta.taskGroup.events(taskGroupID, { ...params }) -> TaskGroupEventsResponse
+- client.beta.taskGroup.getRuns(taskGroupID, { ...params }) -> TaskGroupGetRunsResponse
+
+## FindAll
+
+Types:
+
+- FindAllCandidateMatchStatusEvent
+- FindAllEnrichInput
+- FindAllExtendInput
+- FindAllRun
+- FindAllRunInput
+- FindAllRunResult
+- FindAllRunStatusEvent
+- FindAllSchema
+- FindAllSchemaUpdatedEvent
+- IngestInput
+- FindAllCancelResponse
+- FindAllEventsResponse
+
+Methods:
+
+- client.beta.findall.create({ ...params }) -> FindAllRun
+- client.beta.findall.retrieve(findallID, { ...params }) -> FindAllRun
+- client.beta.findall.cancel(findallID, { ...params }) -> unknown
+- client.beta.findall.enrich(findallID, { ...params }) -> FindAllSchema
+- client.beta.findall.events(findallID, { ...params }) -> FindAllEventsResponse
+- client.beta.findall.extend(findallID, { ...params }) -> FindAllSchema
+- client.beta.findall.ingest({ ...params }) -> FindAllSchema
+- client.beta.findall.result(findallID, { ...params }) -> FindAllRunResult
+- client.beta.findall.schema(findallID, { ...params }) -> FindAllSchema
diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts
index bb4eac1..fd499a6 100644
--- a/src/resources/beta/beta.ts
+++ b/src/resources/beta/beta.ts
@@ -83,9 +83,6 @@ export class Beta extends APIResource {
/**
* Searches the web.
- *
- * To access this endpoint, pass the `parallel-beta` header with the value
- * `search-extract-2025-10-10`.
*/
search(params: BetaSearchParams, options?: RequestOptions): APIPromise {
const { betas, ...body } = params;
@@ -107,15 +104,15 @@ export interface ExcerptSettings {
/**
* Optional upper bound on the total number of characters to include per url.
* Excerpts may contain fewer characters than this limit to maximize relevance and
- * token efficiency, but will never contain fewer than 1000 characters per result.
+ * token efficiency. Values below 1000 will be automatically set to 1000.
*/
max_chars_per_result?: number | null;
/**
* Optional upper bound on the total number of characters to include across all
* urls. Results may contain fewer characters than this limit to maximize relevance
- * and token efficiency, but will never contain fewer than 1000 characters per
- * result.This overall limit applies in addition to max_chars_per_result.
+ * and token efficiency. Values below 1000 will be automatically set to 1000. This
+ * overall limit applies in addition to max_chars_per_result.
*/
max_chars_total?: number | null;
}
@@ -362,18 +359,22 @@ export interface BetaSearchParams {
max_chars_per_result?: number | null;
/**
- * Body param: Upper bound on the number of results to return. May be limited by
- * the processor. Defaults to 10 if not provided.
+ * Body param: Upper bound on the number of results to return. Defaults to 10 if
+ * not provided.
*/
max_results?: number | null;
/**
* Body param: Presets default values for parameters for different use cases.
- * `one-shot` returns more comprehensive results and longer excerpts to answer
- * questions from a single response, while `agentic` returns more concise,
- * token-efficient results for use in an agentic loop.
- */
- mode?: 'one-shot' | 'agentic' | null;
+ *
+ * - `one-shot` returns more comprehensive results and longer excerpts to answer
+ * questions from a single response
+ * - `agentic` returns more concise, token-efficient results for use in an agentic
+ * loop
+ * - `fast` trades some quality for lower latency, with best results when used with
+ * concise and high-quality objective and keyword queries
+ */
+ mode?: 'one-shot' | 'agentic' | 'fast' | null;
/**
* Body param: Natural-language description of what the web search is trying to
diff --git a/src/resources/beta/findall.ts b/src/resources/beta/findall.ts
index 73ec58d..dcbd930 100644
--- a/src/resources/beta/findall.ts
+++ b/src/resources/beta/findall.ts
@@ -9,6 +9,9 @@ import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * 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.
+ */
export class FindAll extends APIResource {
/**
* Starts a FindAll run.
@@ -367,6 +370,7 @@ export namespace FindAllRun {
| 'user_cancelled'
| 'error_occurred'
| 'timeout'
+ | 'insufficient_funds'
| null;
}
diff --git a/src/resources/beta/task-group.ts b/src/resources/beta/task-group.ts
index f732397..109ee8a 100644
--- a/src/resources/beta/task-group.ts
+++ b/src/resources/beta/task-group.ts
@@ -10,6 +10,15 @@ import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * The Task Group API is currently in beta and enables batch execution of many independent Task runs with group-level monitoring and failure handling.
+ * - Submit hundreds or thousands of Tasks as a single group
+ * - Observe group progress and receive results as they complete
+ * - Real-time updates via Server-Sent Events (SSE)
+ * - Add tasks to an existing group while it is running
+ * - Group-level retry and error aggregation
+ * Status: beta and subject to change.
+ */
export class TaskGroup extends APIResource {
/**
* Initiates a TaskGroup to group and track multiple runs.
@@ -233,7 +242,9 @@ export interface TaskGroupCreateParams {
export interface TaskGroupAddRunsParams {
/**
- * Body param: List of task runs to execute.
+ * Body param: List of task runs to execute. Up to 1,000 runs can be specified per
+ * request. If you'd like to add more runs, split them across multiple TaskGroup
+ * POST requests.
*/
inputs: Array;
diff --git a/src/resources/beta/task-run.ts b/src/resources/beta/task-run.ts
index 779e221..f05382b 100644
--- a/src/resources/beta/task-run.ts
+++ b/src/resources/beta/task-run.ts
@@ -10,6 +10,10 @@ import { buildHeaders } from '../../internal/headers';
import { RequestOptions } from '../../internal/request-options';
import { path } from '../../internal/utils/path';
+/**
+ * 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.
+ * - Output metadata: citations, excerpts, reasoning, and confidence per field
+ */
export class TaskRun extends APIResource {
/**
* Initiates a task run.
@@ -109,6 +113,11 @@ export interface BetaRunInput {
*/
metadata?: { [key: string]: string | number | boolean } | null;
+ /**
+ * Interaction ID to use as context for this request.
+ */
+ previous_interaction_id?: string | null;
+
/**
* Source policy for web search results.
*
@@ -476,6 +485,11 @@ export interface TaskRunCreateParams {
*/
metadata?: { [key: string]: string | number | boolean } | null;
+ /**
+ * Body param: Interaction ID to use as context for this request.
+ */
+ previous_interaction_id?: string | null;
+
/**
* Body param: Source policy for web search results.
*
diff --git a/src/resources/task-run.ts b/src/resources/task-run.ts
index 4bd7045..9b1300e 100644
--- a/src/resources/task-run.ts
+++ b/src/resources/task-run.ts
@@ -6,6 +6,10 @@ import { APIPromise } from '../core/api-promise';
import { RequestOptions } from '../internal/request-options';
import { path } from '../internal/utils/path';
+/**
+ * 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.
+ * - Output metadata: citations, excerpts, reasoning, and confidence per field
+ */
export class TaskRun extends APIResource {
/**
* Initiates a task run.
@@ -131,6 +135,11 @@ export interface RunInput {
*/
metadata?: { [key: string]: string | number | boolean } | null;
+ /**
+ * Interaction ID to use as context for this request.
+ */
+ previous_interaction_id?: string | null;
+
/**
* Source policy for web search results.
*
@@ -158,6 +167,12 @@ export interface TaskRun {
*/
created_at: string | null;
+ /**
+ * Identifier for this interaction. Pass this value as `previous_interaction_id` to
+ * reuse context for a future request.
+ */
+ interaction_id: string;
+
/**
* Whether the run is currently active, i.e. status is one of {'cancelling',
* 'queued', 'running'}.
@@ -355,6 +370,11 @@ export interface TaskRunCreateParams {
*/
metadata?: { [key: string]: string | number | boolean } | null;
+ /**
+ * Interaction ID to use as context for this request.
+ */
+ previous_interaction_id?: string | null;
+
/**
* Source policy for web search results.
*
diff --git a/src/version.ts b/src/version.ts
index 99a66ad..64b8c32 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.3.1'; // x-release-please-version
+export const VERSION = '0.3.2'; // x-release-please-version
diff --git a/tests/api-resources/beta/findall.test.ts b/tests/api-resources/beta/findall.test.ts
index 75cec22..c4c3b5b 100644
--- a/tests/api-resources/beta/findall.test.ts
+++ b/tests/api-resources/beta/findall.test.ts
@@ -140,7 +140,7 @@ describe('resource findall', () => {
});
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('events', async () => {
const responsePromise = client.beta.findall.events('findall_id');
const rawResponse = await responsePromise.asResponse();
@@ -152,7 +152,7 @@ describe('resource findall', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('events: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
diff --git a/tests/api-resources/beta/task-group.test.ts b/tests/api-resources/beta/task-group.test.ts
index f471735..4fe45b6 100644
--- a/tests/api-resources/beta/task-group.test.ts
+++ b/tests/api-resources/beta/task-group.test.ts
@@ -60,6 +60,7 @@ describe('resource taskGroup', () => {
},
],
metadata: { foo: 'string' },
+ previous_interaction_id: 'previous_interaction_id',
source_policy: {
after_date: '2024-01-01',
exclude_domains: ['reddit.com', 'x.com', '.ai'],
@@ -96,7 +97,7 @@ describe('resource taskGroup', () => {
});
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('events', async () => {
const responsePromise = client.beta.taskGroup.events('taskgroup_id');
const rawResponse = await responsePromise.asResponse();
@@ -108,7 +109,7 @@ describe('resource taskGroup', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('events: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
@@ -120,7 +121,7 @@ describe('resource taskGroup', () => {
).rejects.toThrow(Parallel.NotFoundError);
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('getRuns', async () => {
const responsePromise = client.beta.taskGroup.getRuns('taskgroup_id');
const rawResponse = await responsePromise.asResponse();
@@ -132,7 +133,7 @@ describe('resource taskGroup', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('getRuns: request options and params are passed correctly', async () => {
// ensure the request options are being passed correctly by passing an invalid HTTP method in order to cause an error
await expect(
diff --git a/tests/api-resources/beta/task-run.test.ts b/tests/api-resources/beta/task-run.test.ts
index b17f73a..2319b54 100644
--- a/tests/api-resources/beta/task-run.test.ts
+++ b/tests/api-resources/beta/task-run.test.ts
@@ -37,6 +37,7 @@ describe('resource taskRun', () => {
},
],
metadata: { foo: 'string' },
+ previous_interaction_id: 'previous_interaction_id',
source_policy: {
after_date: '2024-01-01',
exclude_domains: ['reddit.com', 'x.com', '.ai'],
@@ -59,7 +60,7 @@ describe('resource taskRun', () => {
});
});
- // Prism doesn't support text/event-stream responses
+ // Mock server doesn't support text/event-stream responses
test.skip('events', async () => {
const responsePromise = client.beta.taskRun.events('run_id');
const rawResponse = await responsePromise.asResponse();
diff --git a/tests/api-resources/task-run.test.ts b/tests/api-resources/task-run.test.ts
index 69774d7..1246671 100644
--- a/tests/api-resources/task-run.test.ts
+++ b/tests/api-resources/task-run.test.ts
@@ -27,6 +27,7 @@ describe('resource taskRun', () => {
input: 'What was the GDP of France in 2023?',
processor: 'base',
metadata: { foo: 'string' },
+ previous_interaction_id: 'previous_interaction_id',
source_policy: {
after_date: '2024-01-01',
exclude_domains: ['reddit.com', 'x.com', '.ai'],
diff --git a/tests/stringifyQuery.test.ts b/tests/stringifyQuery.test.ts
index 2fe1332..e197fb3 100644
--- a/tests/stringifyQuery.test.ts
+++ b/tests/stringifyQuery.test.ts
@@ -1,8 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
-import { Parallel } from 'parallel-web';
-
-const { stringifyQuery } = Parallel.prototype as any;
+import { stringifyQuery } from 'parallel-web/internal/utils/query';
describe(stringifyQuery, () => {
for (const [input, expected] of [
@@ -15,7 +13,7 @@ describe(stringifyQuery, () => {
'e=f',
)}=${encodeURIComponent('g&h')}`,
],
- ]) {
+ ] as const) {
it(`${JSON.stringify(input)} -> ${expected}`, () => {
expect(stringifyQuery(input)).toEqual(expected);
});