diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index dc936bc..5b20c1d 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,12 +1,14 @@
name: CI
on:
push:
- branches-ignore:
- - 'generated'
- - 'codegen/**'
- - 'integrated/**'
- - 'stl-preview-head/**'
- - 'stl-preview-base/**'
+ branches:
+ - '**'
+ - '!integrated/**'
+ - '!stl-preview-head/**'
+ - '!stl-preview-base/**'
+ - '!generated'
+ - '!codegen/**'
+ - 'codegen/stl/**'
pull_request:
branches-ignore:
- 'stl-preview-head/**'
@@ -17,7 +19,7 @@ jobs:
timeout-minutes: 10
name: lint
runs-on: ${{ github.repository == 'stainless-sdks/parallel-sdk-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
steps:
- uses: actions/checkout@v6
@@ -36,7 +38,7 @@ jobs:
timeout-minutes: 5
name: build
runs-on: ${{ github.repository == 'stainless-sdks/parallel-sdk-typescript' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
- if: github.event_name == 'push' || github.event.pull_request.head.repo.fork
+ if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
permissions:
contents: read
id-token: write
diff --git a/.gitignore b/.gitignore
index 2412bb7..c85fe68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
.prism.log
+.stdy.log
node_modules
yarn-error.log
codegen.log
diff --git a/.release-please-manifest.json b/.release-please-manifest.json
index 0477999..2537c1f 100644
--- a/.release-please-manifest.json
+++ b/.release-please-manifest.json
@@ -1,3 +1,3 @@
{
- ".": "0.3.2"
+ ".": "0.4.0"
}
diff --git a/.stats.yml b/.stats.yml
index d30019d..ea4794f 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-970b780e86490322cc3c7e2b57f140ca6766a3d9f6e0d3402837ebaf7c2183fc.yml
-openapi_spec_hash: 34f784ce2dec796048e6780924bae08f
-config_hash: a398d153133d8884bed4e5256a0ae818
+configured_endpoints: 24
+openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/parallel-web%2Fparallel-sdk-57e1c56be0942c131ab5f24d8620de166d0721ef7f3423532abc7027e5a989e7.yml
+openapi_spec_hash: e61f831e30d19590eb3138a1b1709d1d
+config_hash: 80e7ee7ad8e3424616aca7189ffd5ae7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d9ae804..3cd9e7b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,49 @@
# Changelog
+## 0.4.0 (2026-04-21)
+
+Full Changelog: [v0.3.2...v0.4.0](https://github.com/parallel-web/parallel-sdk-typescript/compare/v0.3.2...v0.4.0)
+
+### Features
+
+* **api:** Add Findall Candidates ([425681c](https://github.com/parallel-web/parallel-sdk-typescript/commit/425681c15c71e26b9e7bb6a7f1821eb801f51d96))
+* **api:** Add Search and Extract v1 and associated types ([31fdbd0](https://github.com/parallel-web/parallel-sdk-typescript/commit/31fdbd0279c88476b7ad7eafdf28d50a8747c3c5))
+* **api:** manual - add AdvancedSearchSettings and AdvancedExtractSettings models ([dd4da4a](https://github.com/parallel-web/parallel-sdk-typescript/commit/dd4da4a330e651719013a4d6fc2634b1b65da246))
+* **api:** manual updates - update openapi spec ([6db3155](https://github.com/parallel-web/parallel-sdk-typescript/commit/6db3155b02f1049c76954617410ddbe12bb81129))
+* **api:** Remove full_content from OpenAPI Spec ([5601518](https://github.com/parallel-web/parallel-sdk-typescript/commit/5601518a366f2d003c4435d937f04bd0b2f4c033))
+* **api:** Search/Extract v1 with advanced_settings and max_results ([b8890dd](https://github.com/parallel-web/parallel-sdk-typescript/commit/b8890ddd516a127fec6802bf7285bd76dec62d36))
+* **api:** task to GA v1 ([8f03ca8](https://github.com/parallel-web/parallel-sdk-typescript/commit/8f03ca85200f5e5635d89e2462d0c7caa5ea71cb))
+* **api:** Update OpenAPI spec ([86bcd30](https://github.com/parallel-web/parallel-sdk-typescript/commit/86bcd301677c02492cdc41f59ab0865e79dd9592))
+* **api:** Update OpenAPI spec ([bd31a9a](https://github.com/parallel-web/parallel-sdk-typescript/commit/bd31a9abae974f70562da9389b155d2f9e583cfc))
+
+
+### Chores
+
+* **ci:** skip lint on metadata-only changes ([a67ea61](https://github.com/parallel-web/parallel-sdk-typescript/commit/a67ea61a1c016afbe9f6a32168baf1df5f1267a3))
+* **internal:** codegen related update ([1ede4ba](https://github.com/parallel-web/parallel-sdk-typescript/commit/1ede4ba052196d020b05ad4aee529d757601d3bd))
+* **internal:** codegen related update ([46fa759](https://github.com/parallel-web/parallel-sdk-typescript/commit/46fa759aca57b99b388a6328a23fd116894ec6e8))
+* **internal:** tweak CI branches ([3b86286](https://github.com/parallel-web/parallel-sdk-typescript/commit/3b86286059a92b246e2edad7d477b9f26e7377a3))
+* **internal:** update dependencies to address dependabot vulnerabilities ([17f20a6](https://github.com/parallel-web/parallel-sdk-typescript/commit/17f20a687efdd187f588d770bbd8d31013d42a4b))
+* **internal:** update gitignore ([44b2874](https://github.com/parallel-web/parallel-sdk-typescript/commit/44b28740646b26bde693e3c784b9fa0b0916864b))
+* **internal:** update multipart form array serialization ([94d5441](https://github.com/parallel-web/parallel-sdk-typescript/commit/94d54418380cf7b76bc7b2418fe0c38d9b4adf52))
+* **tests:** bump steady to v0.19.4 ([3a21ec1](https://github.com/parallel-web/parallel-sdk-typescript/commit/3a21ec1835ddec9cc45d06af52d78151821a5c50))
+* **tests:** bump steady to v0.19.5 ([85850b6](https://github.com/parallel-web/parallel-sdk-typescript/commit/85850b6a1088b370d9dbf47cf45db2b630e3a51d))
+* **tests:** bump steady to v0.19.6 ([1fa3c6a](https://github.com/parallel-web/parallel-sdk-typescript/commit/1fa3c6ae2305c44adab524a02e34289d7d84ea8f))
+* **tests:** bump steady to v0.19.7 ([5334631](https://github.com/parallel-web/parallel-sdk-typescript/commit/5334631e16969bb918233659cd253c10ac181e25))
+* **tests:** bump steady to v0.20.1 ([5fe5db0](https://github.com/parallel-web/parallel-sdk-typescript/commit/5fe5db092909bcbb5c7d311b4f08d8ab946f91f8))
+* **tests:** bump steady to v0.20.2 ([a6a363c](https://github.com/parallel-web/parallel-sdk-typescript/commit/a6a363c06a5a21f94b39cd6cf8741ddf6182ed6d))
+* **tests:** bump steady to v0.22.1 ([1d73f54](https://github.com/parallel-web/parallel-sdk-typescript/commit/1d73f543021f3f70cb1d30b9e0ee44c63a24fbd8))
+
+
+### Documentation
+
+* update examples ([6f0e64e](https://github.com/parallel-web/parallel-sdk-typescript/commit/6f0e64e663419703cc87bf14f496880f7cdeff43))
+
+
+### Refactors
+
+* **tests:** switch from prism to steady ([6d6d1d9](https://github.com/parallel-web/parallel-sdk-typescript/commit/6d6d1d990d8a3f398a43bd2a36bbc99eb7a63da6))
+
## 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)
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 54dc56d..e1f535d 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -65,7 +65,7 @@ $ pnpm link --global parallel-web
## Running tests
-Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.
+Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests.
```sh
$ ./scripts/mock
diff --git a/api.md b/api.md
index fff6b5d..482f31b 100644
--- a/api.md
+++ b/api.md
@@ -1,3 +1,23 @@
+# Parallel
+
+Types:
+
+- AdvancedExtractSettings
+- AdvancedSearchSettings
+- ExcerptSettings
+- ExtractError
+- ExtractResponse
+- ExtractResult
+- FetchPolicy
+- SearchResult
+- UsageItem
+- WebSearchResult
+
+Methods:
+
+- client.extract({ ...params }) -> ExtractResponse
+- client.search({ ...params }) -> SearchResult
+
# Shared
Types:
@@ -13,20 +33,27 @@ Types:
- AutoSchema
- Citation
+- ErrorEvent
- FieldBasis
- JsonSchema
+- McpServer
+- McpToolCall
- RunInput
- TaskRun
+- TaskRunEvent
- TaskRunJsonOutput
- TaskRunResult
- TaskRunTextOutput
- TaskSpec
- TextSchema
+- Webhook
+- TaskRunEventsResponse
Methods:
- client.taskRun.create({ ...params }) -> TaskRun
- client.taskRun.retrieve(runID) -> TaskRun
+- client.taskRun.events(runID) -> TaskRunEventsResponse
- client.taskRun.result(runID, { ...params }) -> TaskRunResult
# [Beta](src/resources/beta/api.md)
diff --git a/package.json b/package.json
index 67ef33c..4789bab 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "parallel-web",
- "version": "0.3.2",
+ "version": "0.4.0",
"description": "The official TypeScript library for the Parallel API",
"author": "Parallel ",
"types": "dist/index.d.ts",
@@ -50,6 +50,17 @@
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
+ "overrides": {
+ "minimatch": "^9.0.5"
+ },
+ "pnpm": {
+ "overrides": {
+ "minimatch": "^9.0.5"
+ }
+ },
+ "resolutions": {
+ "minimatch": "^9.0.5"
+ },
"exports": {
".": {
"import": "./dist/index.mjs",
diff --git a/scripts/detect-breaking-changes b/scripts/detect-breaking-changes
index e7ddd5b..dca3fbb 100755
--- a/scripts/detect-breaking-changes
+++ b/scripts/detect-breaking-changes
@@ -7,6 +7,7 @@ cd "$(dirname "$0")/.."
echo "==> Detecting breaking changes"
TEST_PATHS=(
+ tests/api-resources/top-level.test.ts
tests/api-resources/task-run.test.ts
tests/api-resources/beta/beta.test.ts
tests/api-resources/beta/task-run.test.ts
diff --git a/scripts/mock b/scripts/mock
index bcf3b39..feebe5e 100755
--- a/scripts/mock
+++ b/scripts/mock
@@ -19,34 +19,34 @@ fi
echo "==> Starting mock server with URL ${URL}"
-# Run prism mock on the given spec
+# Run steady 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=@stdy/cli@0.22.1 -- steady --version
- npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL" &> .prism.log &
+ npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL" &> .stdy.log &
- # Wait for server to come online (max 30s)
+ # Wait for server to come online via health endpoint (max 30s)
echo -n "Waiting for server"
attempts=0
- while ! grep -q "✖ fatal\|Prism is listening" ".prism.log" ; do
+ while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do
+ if ! kill -0 $! 2>/dev/null; then
+ echo
+ cat .stdy.log
+ exit 1
+ fi
attempts=$((attempts + 1))
if [ "$attempts" -ge 300 ]; then
echo
- echo "Timed out waiting for Prism server to start"
- cat .prism.log
+ echo "Timed out waiting for Steady server to start"
+ cat .stdy.log
exit 1
fi
echo -n "."
sleep 0.1
done
- if grep -q "✖ fatal" ".prism.log"; then
- cat .prism.log
- exit 1
- fi
-
echo
else
- npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock "$URL"
+ npm exec --package=@stdy/cli@0.22.1 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets "$URL"
fi
diff --git a/scripts/test b/scripts/test
index 7bce051..19b8d0c 100755
--- a/scripts/test
+++ b/scripts/test
@@ -9,8 +9,8 @@ GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
-function prism_is_running() {
- curl --silent "http://localhost:4010" >/dev/null 2>&1
+function steady_is_running() {
+ curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1
}
kill_server_on_port() {
@@ -25,7 +25,7 @@ function is_overriding_api_base_url() {
[ -n "$TEST_API_BASE_URL" ]
}
-if ! is_overriding_api_base_url && ! prism_is_running ; then
+if ! is_overriding_api_base_url && ! steady_is_running ; then
# When we exit this script, make sure to kill the background mock server process
trap 'kill_server_on_port 4010' EXIT
@@ -36,19 +36,19 @@ fi
if is_overriding_api_base_url ; then
echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}"
echo
-elif ! prism_is_running ; then
- echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server"
+elif ! steady_is_running ; then
+ echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server"
echo -e "running against your OpenAPI spec."
echo
echo -e "To run the server, pass in the path or url of your OpenAPI"
- echo -e "spec to the prism command:"
+ echo -e "spec to the steady command:"
echo
- echo -e " \$ ${YELLOW}npm exec --package=@stainless-api/prism-cli@5.15.0 -- prism mock path/to/your.openapi.yml${NC}"
+ echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.22.1 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=brackets --validator-form-object-format=brackets${NC}"
echo
exit 1
else
- echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}"
+ echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}"
echo
fi
diff --git a/src/client.ts b/src/client.ts
index 99463c0..0177c07 100644
--- a/src/client.ts
+++ b/src/client.ts
@@ -16,21 +16,42 @@ import { VERSION } from './version';
import * as Errors from './core/error';
import * as Uploads from './core/uploads';
import * as API from './resources/index';
+import * as TopLevelAPI from './resources/top-level';
+import {
+ AdvancedExtractSettings,
+ AdvancedSearchSettings,
+ ExcerptSettings,
+ ExtractError,
+ ExtractParams,
+ ExtractResponse,
+ ExtractResult,
+ FetchPolicy,
+ SearchParams,
+ SearchResult,
+ UsageItem,
+ WebSearchResult,
+} from './resources/top-level';
import { APIPromise } from './core/api-promise';
import {
AutoSchema,
Citation,
+ ErrorEvent,
FieldBasis,
JsonSchema,
+ McpServer,
+ McpToolCall,
RunInput,
TaskRun,
TaskRunCreateParams,
+ TaskRunEvent,
+ TaskRunEventsResponse,
TaskRunJsonOutput,
TaskRunResult,
TaskRunResultParams,
TaskRunTextOutput,
TaskSpec,
TextSchema,
+ Webhook,
} from './resources/task-run';
import { Beta } from './resources/beta/beta';
import { type Fetch } from './internal/builtin-types';
@@ -214,6 +235,43 @@ export class Parallel {
return this.baseURL !== 'https://api.parallel.ai';
}
+ /**
+ * Extracts relevant content from specific web URLs.
+ *
+ * The legacy Extract API reference is available
+ * [here](https://docs.parallel.ai/api-reference/legacy/extract-beta/extract).
+ *
+ * @example
+ * ```ts
+ * const extractResponse = await client.extract({
+ * urls: ['string'],
+ * });
+ * ```
+ */
+ extract(
+ body: TopLevelAPI.ExtractParams,
+ options?: RequestOptions,
+ ): APIPromise {
+ return this.post('/v1/extract', { body, ...options });
+ }
+
+ /**
+ * Searches the web.
+ *
+ * The legacy Search API reference is available
+ * [here](https://docs.parallel.ai/api-reference/legacy/search-beta/search).
+ *
+ * @example
+ * ```ts
+ * const searchResult = await client.search({
+ * search_queries: ['string'],
+ * });
+ * ```
+ */
+ search(body: TopLevelAPI.SearchParams, options?: RequestOptions): APIPromise {
+ return this.post('/v1/search', { body, ...options });
+ }
+
protected defaultQuery(): Record | undefined {
return this._options.defaultQuery;
}
@@ -736,6 +794,13 @@ export class Parallel {
/**
* 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
+ *
+ * Task Groups enable 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
*/
taskRun: API.TaskRun = new API.TaskRun(this);
beta: API.Beta = new API.Beta(this);
@@ -746,18 +811,39 @@ Parallel.Beta = Beta;
export declare namespace Parallel {
export type RequestOptions = Opts.RequestOptions;
+ 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,
+ };
+
export {
type TaskRun as TaskRun,
type AutoSchema as AutoSchema,
type Citation as Citation,
+ type ErrorEvent as ErrorEvent,
type FieldBasis as FieldBasis,
type JsonSchema as JsonSchema,
+ type McpServer as McpServer,
+ type McpToolCall as McpToolCall,
type RunInput as RunInput,
+ type TaskRunEvent as TaskRunEvent,
type TaskRunJsonOutput as TaskRunJsonOutput,
type TaskRunResult as TaskRunResult,
type TaskRunTextOutput as TaskRunTextOutput,
type TaskSpec as TaskSpec,
type TextSchema as TextSchema,
+ type Webhook as Webhook,
+ type TaskRunEventsResponse as TaskRunEventsResponse,
type TaskRunCreateParams as TaskRunCreateParams,
type TaskRunResultParams as TaskRunResultParams,
};
diff --git a/src/internal/utils/env.ts b/src/internal/utils/env.ts
index 2d84800..cc5fa0f 100644
--- a/src/internal/utils/env.ts
+++ b/src/internal/utils/env.ts
@@ -9,10 +9,10 @@
*/
export const readEnv = (env: string): string | undefined => {
if (typeof (globalThis as any).process !== 'undefined') {
- return (globalThis as any).process.env?.[env]?.trim() ?? undefined;
+ return (globalThis as any).process.env?.[env]?.trim() || undefined;
}
if (typeof (globalThis as any).Deno !== 'undefined') {
- return (globalThis as any).Deno.env?.get?.(env)?.trim();
+ return (globalThis as any).Deno.env?.get?.(env)?.trim() || undefined;
}
return undefined;
};
diff --git a/src/resources/beta/api.md b/src/resources/beta/api.md
index ed3542d..24adbf2 100644
--- a/src/resources/beta/api.md
+++ b/src/resources/beta/api.md
@@ -3,13 +3,13 @@
Types:
- ExcerptSettings
-- ExtractError
- ExtractResponse
- ExtractResult
-- FetchPolicy
- SearchResult
-- UsageItem
- WebSearchResult
+- ExtractError
+- FetchPolicy
+- UsageItem
Methods:
@@ -20,21 +20,21 @@ Methods:
Types:
+- ParallelBeta
+- TaskRunEventsResponse
- BetaRunInput
- BetaTaskRunResult
-- ErrorEvent
+- Webhook
- McpServer
- McpToolCall
-- ParallelBeta
- TaskRunEvent
-- Webhook
-- TaskRunEventsResponse
+- ErrorEvent
Methods:
-- client.beta.taskRun.create({ ...params }) -> TaskRun
+- client.beta.taskRun.create({ ...params }) -> TaskRun
- client.beta.taskRun.events(runID) -> TaskRunEventsResponse
-- client.beta.taskRun.result(runID, { ...params }) -> BetaTaskRunResult
+- client.beta.taskRun.result(runID, { ...params }) -> TaskRunResult
## TaskGroup
@@ -59,6 +59,8 @@ Methods:
Types:
- FindAllCandidateMatchStatusEvent
+- FindAllCandidatesRequest
+- FindAllCandidatesResponse
- FindAllEnrichInput
- FindAllExtendInput
- FindAllRun
@@ -76,6 +78,7 @@ Methods:
- client.beta.findall.create({ ...params }) -> FindAllRun
- client.beta.findall.retrieve(findallID, { ...params }) -> FindAllRun
- client.beta.findall.cancel(findallID, { ...params }) -> unknown
+- client.beta.findall.candidates({ ...params }) -> FindAllCandidatesResponse
- client.beta.findall.enrich(findallID, { ...params }) -> FindAllSchema
- client.beta.findall.events(findallID, { ...params }) -> FindAllEventsResponse
- client.beta.findall.extend(findallID, { ...params }) -> FindAllSchema
diff --git a/src/resources/beta/beta.ts b/src/resources/beta/beta.ts
index fd499a6..47f3388 100644
--- a/src/resources/beta/beta.ts
+++ b/src/resources/beta/beta.ts
@@ -2,12 +2,16 @@
import { APIResource } from '../../core/resource';
import * as Shared from '../shared';
+import * as TopLevelAPI from '../top-level';
import * as FindAllAPI from './findall';
import {
FindAll,
FindAllCancelParams,
FindAllCancelResponse,
FindAllCandidateMatchStatusEvent,
+ FindAllCandidatesParams,
+ FindAllCandidatesRequest,
+ FindAllCandidatesResponse,
FindAllCreateParams,
FindAllEnrichInput,
FindAllEnrichParams,
@@ -66,8 +70,12 @@ export class Beta extends APIResource {
/**
* Extracts relevant content from specific web URLs.
*
- * To access this endpoint, pass the `parallel-beta` header with the value
- * `search-extract-2025-10-10`.
+ * @example
+ * ```ts
+ * const extractResponse = await client.beta.extract({
+ * urls: ['string'],
+ * });
+ * ```
*/
extract(params: BetaExtractParams, options?: RequestOptions): APIPromise {
const { betas, ...body } = params;
@@ -83,6 +91,11 @@ export class Beta extends APIResource {
/**
* Searches the web.
+ *
+ * @example
+ * ```ts
+ * const searchResult = await client.beta.search();
+ * ```
*/
search(params: BetaSearchParams, options?: RequestOptions): APIPromise {
const { betas, ...body } = params;
@@ -117,28 +130,6 @@ export interface ExcerptSettings {
max_chars_total?: number | null;
}
-/**
- * Extract error details.
- */
-export interface ExtractError {
- /**
- * Content returned for http client or server errors, if any.
- */
- content: string | null;
-
- /**
- * Error type.
- */
- error_type: string;
-
- /**
- * HTTP status code, if available.
- */
- http_status_code: number | null;
-
- url: string;
-}
-
/**
* Fetch result.
*/
@@ -146,7 +137,7 @@ export interface ExtractResponse {
/**
* Extract errors: requested URLs not in the results.
*/
- errors: Array;
+ errors: Array;
/**
* Extract request ID, e.g. `extract_cad0a6d2dec046bd95ae900527d880e7`
@@ -161,7 +152,7 @@ export interface ExtractResponse {
/**
* Usage metrics for the extract request.
*/
- usage?: Array | null;
+ usage?: Array | null;
/**
* Warnings for the extract request, if any.
@@ -199,28 +190,6 @@ export interface ExtractResult {
title?: string | null;
}
-/**
- * Policy for live fetching web results.
- */
-export interface FetchPolicy {
- /**
- * If false, fallback to cached content older than max-age if live fetch fails or
- * times out. If true, returns an error instead.
- */
- disable_cache_fallback?: boolean;
-
- /**
- * Maximum age of cached content in seconds to trigger a live fetch. Minimum value
- * 600 seconds (10 minutes).
- */
- max_age_seconds?: number | null;
-
- /**
- * Timeout in seconds for fetching live content if unavailable in cache.
- */
- timeout_seconds?: number | null;
-}
-
/**
* Output for the Search API.
*/
@@ -238,7 +207,7 @@ export interface SearchResult {
/**
* Usage metrics for the search request.
*/
- usage?: Array | null;
+ usage?: Array | null;
/**
* Warnings for the search request, if any.
@@ -246,21 +215,6 @@ export interface SearchResult {
warnings?: Array | null;
}
-/**
- * Usage item for a single operation.
- */
-export interface UsageItem {
- /**
- * Count of the SKU.
- */
- count: number;
-
- /**
- * Name of the SKU.
- */
- name: string;
-}
-
/**
* A single search result from the web search API.
*/
@@ -286,6 +240,12 @@ export interface WebSearchResult {
title?: string | null;
}
+export type ExtractError = TopLevelAPI.ExtractError;
+
+export type FetchPolicy = TopLevelAPI.FetchPolicy;
+
+export type UsageItem = TopLevelAPI.UsageItem;
+
export interface BetaExtractParams {
/**
* Body param
@@ -302,7 +262,7 @@ export interface BetaExtractParams {
/**
* Body param: Policy for live fetching web results.
*/
- fetch_policy?: FetchPolicy | null;
+ fetch_policy?: TopLevelAPI.FetchPolicy | null;
/**
* Body param: Include full content from each URL. Note that if neither objective
@@ -322,6 +282,13 @@ export interface BetaExtractParams {
*/
search_queries?: Array | null;
+ /**
+ * Body param: Session identifier to track calls across separate search and extract
+ * calls, to be used as part of a larger task. Specifying it may give better
+ * contextual results for subsequent API calls.
+ */
+ session_id?: string | null;
+
/**
* Header param: Optional header to specify the beta version(s) to enable.
*/
@@ -351,7 +318,12 @@ export interface BetaSearchParams {
/**
* Body param: Policy for live fetching web results.
*/
- fetch_policy?: FetchPolicy | null;
+ fetch_policy?: TopLevelAPI.FetchPolicy | null;
+
+ /**
+ * Body param: ISO 3166-1 alpha-2 country code for geo-targeted search results.
+ */
+ location?: string | null;
/**
* @deprecated Body param: DEPRECATED: Use `excerpts.max_chars_per_result` instead.
@@ -395,6 +367,13 @@ export interface BetaSearchParams {
*/
search_queries?: Array | null;
+ /**
+ * Body param: Session identifier to track calls across separate search and extract
+ * calls, to be used as part of a larger task. Specifying it may give better
+ * contextual results for subsequent API calls.
+ */
+ session_id?: string | null;
+
/**
* Body param: Source policy for web search results.
*
@@ -414,28 +393,28 @@ Beta.FindAll = FindAll;
export declare namespace Beta {
export {
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 ExtractError as ExtractError,
+ type FetchPolicy as FetchPolicy,
+ type UsageItem as UsageItem,
type BetaExtractParams as BetaExtractParams,
type BetaSearchParams as BetaSearchParams,
};
export {
TaskRun as TaskRun,
+ type ParallelBeta as ParallelBeta,
+ type TaskRunEventsResponse as TaskRunEventsResponse,
type BetaRunInput as BetaRunInput,
type BetaTaskRunResult as BetaTaskRunResult,
- type ErrorEvent as ErrorEvent,
+ type Webhook as Webhook,
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 ErrorEvent as ErrorEvent,
type TaskRunCreateParams as TaskRunCreateParams,
type TaskRunResultParams as TaskRunResultParams,
};
@@ -455,6 +434,8 @@ export declare namespace Beta {
export {
FindAll as FindAll,
type FindAllCandidateMatchStatusEvent as FindAllCandidateMatchStatusEvent,
+ type FindAllCandidatesRequest as FindAllCandidatesRequest,
+ type FindAllCandidatesResponse as FindAllCandidatesResponse,
type FindAllEnrichInput as FindAllEnrichInput,
type FindAllExtendInput as FindAllExtendInput,
type FindAllRun as FindAllRun,
@@ -469,6 +450,7 @@ export declare namespace Beta {
type FindAllCreateParams as FindAllCreateParams,
type FindAllRetrieveParams as FindAllRetrieveParams,
type FindAllCancelParams as FindAllCancelParams,
+ type FindAllCandidatesParams as FindAllCandidatesParams,
type FindAllEnrichParams as FindAllEnrichParams,
type FindAllEventsParams as FindAllEventsParams,
type FindAllExtendParams as FindAllExtendParams,
diff --git a/src/resources/beta/findall.ts b/src/resources/beta/findall.ts
index dcbd930..a054365 100644
--- a/src/resources/beta/findall.ts
+++ b/src/resources/beta/findall.ts
@@ -26,6 +26,23 @@ export class FindAll extends APIResource {
* /v1beta/findall/runs/{findall_id}/events endpoint,
* - Or specifying a webhook with relevant event types during run creation to
* receive notifications.
+ *
+ * @example
+ * ```ts
+ * const findallRun = await client.beta.findall.create({
+ * entity_type: 'entity_type',
+ * generator: 'base',
+ * match_conditions: [
+ * {
+ * description:
+ * "Company must have SOC2 Type II certification (not Type I). Look for evidence in: trust centers, security/compliance pages, audit reports, or press releases specifically mentioning 'SOC2 Type II'. If no explicit SOC2 Type II mention is found, consider requirement not satisfied.",
+ * name: 'name',
+ * },
+ * ],
+ * match_limit: 0,
+ * objective: 'objective',
+ * });
+ * ```
*/
create(params: FindAllCreateParams, options?: RequestOptions): APIPromise {
const { betas, ...body } = params;
@@ -41,6 +58,13 @@ export class FindAll extends APIResource {
/**
* Retrieve a FindAll run.
+ *
+ * @example
+ * ```ts
+ * const findallRun = await client.beta.findall.retrieve(
+ * 'findall_id',
+ * );
+ * ```
*/
retrieve(
findallID: string,
@@ -59,6 +83,13 @@ export class FindAll extends APIResource {
/**
* Cancel a FindAll run.
+ *
+ * @example
+ * ```ts
+ * const response = await client.beta.findall.cancel(
+ * 'findall_id',
+ * );
+ * ```
*/
cancel(
findallID: string,
@@ -75,8 +106,49 @@ export class FindAll extends APIResource {
});
}
+ /**
+ * Return ranked entity candidates matching a natural language objective.
+ *
+ * This endpoint performs a best-effort search optimised for low latency. For
+ * comprehensive match evaluation and enrichment, use the
+ * [FindAll API](https://docs.parallel.ai/findall-api/findall-quickstart).
+ *
+ * @example
+ * ```ts
+ * const findallCandidatesResponse =
+ * await client.beta.findall.candidates({
+ * entity_type: 'company',
+ * objective: 'objective',
+ * });
+ * ```
+ */
+ candidates(body: FindAllCandidatesParams, options?: RequestOptions): APIPromise {
+ return this._client.post('/v1beta/findall/candidates', {
+ body,
+ ...options,
+ headers: buildHeaders([{ 'parallel-beta': 'findall-2025-09-15' }, options?.headers]),
+ });
+ }
+
/**
* Add an enrichment to a FindAll run.
+ *
+ * @example
+ * ```ts
+ * const findallSchema = await client.beta.findall.enrich(
+ * 'findall_id',
+ * {
+ * output_schema: {
+ * json_schema: {
+ * additionalProperties: 'bar',
+ * properties: 'bar',
+ * required: 'bar',
+ * type: 'bar',
+ * },
+ * },
+ * },
+ * );
+ * ```
*/
enrich(
findallID: string,
@@ -101,6 +173,13 @@ export class FindAll extends APIResource {
* Optional event ID to resume from. timeout: Optional timeout in seconds. If None,
* keep connection alive as long as the run is going. If set, stop after specified
* duration.
+ *
+ * @example
+ * ```ts
+ * const response = await client.beta.findall.events(
+ * 'findall_id',
+ * );
+ * ```
*/
events(
findallID: string,
@@ -121,6 +200,14 @@ export class FindAll extends APIResource {
/**
* Extend a FindAll run by adding additional matches to the current match limit.
+ *
+ * @example
+ * ```ts
+ * const findallSchema = await client.beta.findall.extend(
+ * 'findall_id',
+ * { additional_match_limit: 0 },
+ * );
+ * ```
*/
extend(
findallID: string,
@@ -145,6 +232,14 @@ export class FindAll extends APIResource {
*
* The generated specification serves as a suggested starting point and can be
* further customized by the user.
+ *
+ * @example
+ * ```ts
+ * const findallSchema = await client.beta.findall.ingest({
+ * objective:
+ * 'Find all AI companies that raised Series A funding in 2024',
+ * });
+ * ```
*/
ingest(params: FindAllIngestParams, options?: RequestOptions): APIPromise {
const { betas, ...body } = params;
@@ -160,6 +255,13 @@ export class FindAll extends APIResource {
/**
* Retrieve the FindAll run result at the time of the request.
+ *
+ * @example
+ * ```ts
+ * const findallRunResult = await client.beta.findall.result(
+ * 'findall_id',
+ * );
+ * ```
*/
result(
findallID: string,
@@ -178,6 +280,13 @@ export class FindAll extends APIResource {
/**
* Get FindAll Run Schema
+ *
+ * @example
+ * ```ts
+ * const findallSchema = await client.beta.findall.schema(
+ * 'findall_id',
+ * );
+ * ```
*/
schema(
findallID: string,
@@ -272,6 +381,56 @@ export namespace FindAllCandidateMatchStatusEvent {
}
}
+export interface FindAllCandidatesRequest {
+ /**
+ * Type of entity to search for.
+ */
+ entity_type: 'company' | 'people';
+
+ /**
+ * Natural language description of target entities.
+ */
+ objective: string;
+
+ /**
+ * Maximum number of candidates to return. Must be between 5 and 1000 (inclusive).
+ * May return fewer results. Defaults to 100.
+ */
+ match_limit?: number;
+}
+
+export interface FindAllCandidatesResponse {
+ /**
+ * Candidate set request ID. Example:
+ * `candidate_set_cad0a6d2dec046bd95ae900527d880e7`
+ */
+ candidate_set_id: string;
+
+ /**
+ * Ranked list of entity candidates.
+ */
+ candidates: Array;
+}
+
+export namespace FindAllCandidatesResponse {
+ export interface Candidate {
+ /**
+ * Descriptive text about the entity.
+ */
+ description: string;
+
+ /**
+ * Entity name.
+ */
+ name: string;
+
+ /**
+ * Canonical URL for the entity.
+ */
+ url: string;
+ }
+}
+
/**
* Input model for FindAll enrich.
*/
@@ -284,7 +443,7 @@ export interface FindAllEnrichInput {
/**
* List of MCP servers to use for the task.
*/
- mcp_servers?: Array | null;
+ mcp_servers?: Array | null;
/**
* Processor to use for the task.
@@ -413,7 +572,7 @@ export interface FindAllRunInput {
/**
* Maximum number of matches to find for this FindAll run. Must be between 5 and
- * 1000 (inclusive).
+ * 1000 (inclusive). May return fewer results.
*/
match_limit: number;
@@ -435,7 +594,7 @@ export interface FindAllRunInput {
/**
* Webhooks for Task Runs.
*/
- webhook?: BetaTaskRunAPI.Webhook | null;
+ webhook?: TaskRunAPI.Webhook | null;
}
export namespace FindAllRunInput {
@@ -668,7 +827,7 @@ export type FindAllEventsResponse =
| FindAllSchemaUpdatedEvent
| FindAllRunStatusEvent
| FindAllCandidateMatchStatusEvent
- | BetaTaskRunAPI.ErrorEvent;
+ | TaskRunAPI.ErrorEvent;
export interface FindAllCreateParams {
/**
@@ -688,7 +847,7 @@ export interface FindAllCreateParams {
/**
* Body param: Maximum number of matches to find for this FindAll run. Must be
- * between 5 and 1000 (inclusive).
+ * between 5 and 1000 (inclusive). May return fewer results.
*/
match_limit: number;
@@ -710,7 +869,7 @@ export interface FindAllCreateParams {
/**
* Body param: Webhooks for Task Runs.
*/
- webhook?: BetaTaskRunAPI.Webhook | null;
+ webhook?: TaskRunAPI.Webhook | null;
/**
* Header param: Optional header to specify the beta version(s) to enable.
@@ -766,6 +925,24 @@ export interface FindAllCancelParams {
betas?: Array;
}
+export interface FindAllCandidatesParams {
+ /**
+ * Type of entity to search for.
+ */
+ entity_type: 'company' | 'people';
+
+ /**
+ * Natural language description of target entities.
+ */
+ objective: string;
+
+ /**
+ * Maximum number of candidates to return. Must be between 5 and 1000 (inclusive).
+ * May return fewer results. Defaults to 100.
+ */
+ match_limit?: number;
+}
+
export interface FindAllEnrichParams {
/**
* Body param: JSON schema for the enrichment output schema for the FindAll run.
@@ -775,7 +952,7 @@ export interface FindAllEnrichParams {
/**
* Body param: List of MCP servers to use for the task.
*/
- mcp_servers?: Array | null;
+ mcp_servers?: Array | null;
/**
* Body param: Processor to use for the task.
@@ -848,6 +1025,8 @@ export interface FindAllSchemaParams {
export declare namespace FindAll {
export {
type FindAllCandidateMatchStatusEvent as FindAllCandidateMatchStatusEvent,
+ type FindAllCandidatesRequest as FindAllCandidatesRequest,
+ type FindAllCandidatesResponse as FindAllCandidatesResponse,
type FindAllEnrichInput as FindAllEnrichInput,
type FindAllExtendInput as FindAllExtendInput,
type FindAllRun as FindAllRun,
@@ -862,6 +1041,7 @@ export declare namespace FindAll {
type FindAllCreateParams as FindAllCreateParams,
type FindAllRetrieveParams as FindAllRetrieveParams,
type FindAllCancelParams as FindAllCancelParams,
+ type FindAllCandidatesParams as FindAllCandidatesParams,
type FindAllEnrichParams as FindAllEnrichParams,
type FindAllEventsParams as FindAllEventsParams,
type FindAllExtendParams as FindAllExtendParams,
diff --git a/src/resources/beta/index.ts b/src/resources/beta/index.ts
index 50d9d9f..9681d32 100644
--- a/src/resources/beta/index.ts
+++ b/src/resources/beta/index.ts
@@ -5,6 +5,8 @@ export {
FindAll,
Findall,
type FindAllCandidateMatchStatusEvent,
+ type FindAllCandidatesRequest,
+ type FindAllCandidatesResponse,
type FindAllEnrichInput,
type FindAllExtendInput,
type FindAllRun,
@@ -19,6 +21,7 @@ export {
type FindAllCreateParams,
type FindAllRetrieveParams,
type FindAllCancelParams,
+ type FindAllCandidatesParams,
type FindAllEnrichParams,
type FindAllEventsParams,
type FindAllExtendParams,
@@ -60,15 +63,15 @@ export {
} from './task-group';
export {
TaskRun,
+ type ParallelBeta,
+ type TaskRunEventsResponse,
type BetaRunInput,
type BetaTaskRunResult,
- type ErrorEvent,
+ type Webhook,
type McpServer,
type McpToolCall,
- type ParallelBeta,
type TaskRunEvent,
- type Webhook,
- type TaskRunEventsResponse,
+ type ErrorEvent,
type TaskRunCreateParams,
type TaskRunResultParams,
} from './task-run';
diff --git a/src/resources/beta/task-group.ts b/src/resources/beta/task-group.ts
index 109ee8a..7c642c3 100644
--- a/src/resources/beta/task-group.ts
+++ b/src/resources/beta/task-group.ts
@@ -11,17 +11,24 @@ 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.
+ * 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
+ *
+ * Task Groups enable 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.
+ *
+ * @example
+ * ```ts
+ * const taskGroup = await client.beta.taskGroup.create();
+ * ```
*/
create(body: TaskGroupCreateParams, options?: RequestOptions): APIPromise {
return this._client.post('/v1beta/tasks/groups', {
@@ -33,6 +40,13 @@ export class TaskGroup extends APIResource {
/**
* Retrieves aggregated status across runs in a TaskGroup.
+ *
+ * @example
+ * ```ts
+ * const taskGroup = await client.beta.taskGroup.retrieve(
+ * 'taskgroup_id',
+ * );
+ * ```
*/
retrieve(taskGroupID: string, options?: RequestOptions): APIPromise {
return this._client.get(path`/v1beta/tasks/groups/${taskGroupID}`, {
@@ -43,14 +57,28 @@ export class TaskGroup extends APIResource {
/**
* Initiates multiple task runs within a TaskGroup.
+ *
+ * @example
+ * ```ts
+ * const taskGroupRunResponse =
+ * await client.beta.taskGroup.addRuns('taskgroup_id', {
+ * inputs: [
+ * {
+ * input: 'What was the GDP of France in 2023?',
+ * processor: 'base',
+ * },
+ * ],
+ * });
+ * ```
*/
addRuns(
taskGroupID: string,
params: TaskGroupAddRunsParams,
options?: RequestOptions,
): APIPromise {
- const { betas, ...body } = params;
+ const { refresh_status, betas, ...body } = params;
return this._client.post(path`/v1beta/tasks/groups/${taskGroupID}/runs`, {
+ query: { refresh_status },
body,
...options,
headers: buildHeaders([
@@ -65,6 +93,13 @@ export class TaskGroup extends APIResource {
*
* The connection will remain open for up to an hour as long as at least one run in
* the group is still active.
+ *
+ * @example
+ * ```ts
+ * const response = await client.beta.taskGroup.events(
+ * 'taskgroup_id',
+ * );
+ * ```
*/
events(
taskGroupID: string,
@@ -93,6 +128,13 @@ export class TaskGroup extends APIResource {
* specify the `last_event_id` parameter with the `event_id` of the last event in
* the stream. The stream will resume from the next event after the
* `last_event_id`.
+ *
+ * @example
+ * ```ts
+ * const response = await client.beta.taskGroup.getRuns(
+ * 'taskgroup_id',
+ * );
+ * ```
*/
getRuns(
taskGroupID: string,
@@ -201,8 +243,8 @@ export interface TaskGroupStatus {
*/
export type TaskGroupEventsResponse =
| TaskGroupEventsResponse.TaskGroupStatusEvent
- | BetaTaskRunAPI.TaskRunEvent
- | BetaTaskRunAPI.ErrorEvent;
+ | TaskRunAPI.TaskRunEvent
+ | TaskRunAPI.ErrorEvent;
export namespace TaskGroupEventsResponse {
/**
@@ -231,7 +273,7 @@ export namespace TaskGroupEventsResponse {
*
* May indicate completion, cancellation, or failure.
*/
-export type TaskGroupGetRunsResponse = BetaTaskRunAPI.TaskRunEvent | BetaTaskRunAPI.ErrorEvent;
+export type TaskGroupGetRunsResponse = TaskRunAPI.TaskRunEvent | TaskRunAPI.ErrorEvent;
export interface TaskGroupCreateParams {
/**
@@ -246,7 +288,12 @@ export interface TaskGroupAddRunsParams {
* request. If you'd like to add more runs, split them across multiple TaskGroup
* POST requests.
*/
- inputs: Array;
+ inputs: Array;
+
+ /**
+ * Query param
+ */
+ refresh_status?: boolean;
/**
* Body param: Specification for a task.
diff --git a/src/resources/beta/task-run.ts b/src/resources/beta/task-run.ts
index f05382b..4b83fe1 100644
--- a/src/resources/beta/task-run.ts
+++ b/src/resources/beta/task-run.ts
@@ -1,7 +1,6 @@
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../../core/resource';
-import * as BetaTaskRunAPI from './task-run';
import * as Shared from '../shared';
import * as TaskRunAPI from '../task-run';
import { APIPromise } from '../../core/api-promise';
@@ -13,6 +12,15 @@ 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
+ *
+ * Task Groups enable 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
+ *
+ * @deprecated Use GA Task Run instead
*/
export class TaskRun extends APIResource {
/**
@@ -21,10 +29,12 @@ export class TaskRun extends APIResource {
* Returns immediately with a run object in status 'queued'.
*
* Beta features can be enabled by setting the 'parallel-beta' header.
+ *
+ * @deprecated Use GA Task Run instead
*/
create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise {
const { betas, ...body } = params;
- return this._client.post('/v1/tasks/runs?beta=true', {
+ return this._client.post('/v1/tasks/runs', {
body,
...options,
headers: buildHeaders([
@@ -42,6 +52,8 @@ export class TaskRun extends APIResource {
*
* For task runs that did not have enable_events set to true during creation, the
* frequency of events will be reduced.
+ *
+ * @deprecated Use GA Task Run instead
*/
events(runID: string, options?: RequestOptions): APIPromise> {
return this._client.get(path`/v1beta/tasks/runs/${runID}/events`, {
@@ -56,14 +68,16 @@ export class TaskRun extends APIResource {
/**
* Retrieves a run result by run_id, blocking until the run is completed.
+ *
+ * @deprecated Use GA Task Run instead
*/
result(
runID: string,
params: TaskRunResultParams | null | undefined = {},
options?: RequestOptions,
- ): APIPromise {
+ ): APIPromise {
const { betas, ...query } = params ?? {};
- return this._client.get(path`/v1/tasks/runs/${runID}/result?beta=true`, {
+ return this._client.get(path`/v1/tasks/runs/${runID}/result`, {
query,
...options,
headers: buildHeaders([
@@ -74,243 +88,6 @@ export class TaskRun extends APIResource {
}
}
-/**
- * Task run input with additional beta fields.
- */
-export interface BetaRunInput {
- /**
- * Input to the task, either text or a JSON object.
- */
- input: string | { [key: string]: unknown };
-
- /**
- * Processor to use for the task.
- */
- processor: string;
-
- /**
- * Controls tracking of task run execution progress. When set to true, progress
- * events are recorded and can be accessed via the
- * [Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
- * false, no progress events are tracked. Note that progress tracking cannot be
- * enabled after a run has been created. The flag is set to true by default for
- * premium processors (pro and above). To enable this feature in your requests,
- * specify `events-sse-2025-07-24` as one of the values in `parallel-beta` header
- * (for API calls) or `betas` param (for the SDKs).
- */
- enable_events?: boolean | null;
-
- /**
- * Optional list of MCP servers to use for the run. To enable this feature in your
- * requests, specify `mcp-server-2025-07-17` as one of the values in
- * `parallel-beta` header (for API calls) or `betas` param (for the SDKs).
- */
- mcp_servers?: Array | null;
-
- /**
- * User-provided metadata stored with the run. Keys and values must be strings with
- * a maximum length of 16 and 512 characters respectively.
- */
- 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.
- *
- * This policy governs which sources are allowed/disallowed in results.
- */
- source_policy?: Shared.SourcePolicy | null;
-
- /**
- * Specification for a task.
- *
- * Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
- * Not specifying a TaskSpec is the same as setting an auto output schema.
- *
- * For convenience bare strings are also accepted as input or output schemas.
- */
- task_spec?: TaskRunAPI.TaskSpec | null;
-
- /**
- * Webhooks for Task Runs.
- */
- webhook?: Webhook | null;
-}
-
-/**
- * Result of a beta task run. Available only if beta headers are specified.
- */
-export interface BetaTaskRunResult {
- /**
- * Output from the task conforming to the output schema.
- */
- output: BetaTaskRunResult.BetaTaskRunTextOutput | BetaTaskRunResult.BetaTaskRunJsonOutput;
-
- /**
- * Beta task run object with status 'completed'.
- */
- run: TaskRunAPI.TaskRun;
-}
-
-export namespace BetaTaskRunResult {
- /**
- * Output from a task that returns text.
- */
- export interface BetaTaskRunTextOutput {
- /**
- * Basis for the output. To include per-list-element basis entries, send the
- * `parallel-beta` header with the value `field-basis-2025-11-25` when creating the
- * run.
- */
- basis: Array;
-
- /**
- * Text output from the task.
- */
- content: string;
-
- /**
- * The type of output being returned, as determined by the output schema of the
- * task spec.
- */
- type: 'text';
-
- /**
- * Always None.
- */
- beta_fields?: { [key: string]: unknown } | null;
-
- /**
- * MCP tool calls made by the task.
- */
- mcp_tool_calls?: Array | null;
- }
-
- /**
- * Output from a task that returns JSON.
- */
- export interface BetaTaskRunJsonOutput {
- /**
- * Basis for the output. To include per-list-element basis entries, send the
- * `parallel-beta` header with the value `field-basis-2025-11-25` when creating the
- * run.
- */
- basis: Array;
-
- /**
- * Output from the task as a native JSON object, as determined by the output schema
- * of the task spec.
- */
- content: { [key: string]: unknown };
-
- /**
- * The type of output being returned, as determined by the output schema of the
- * task spec.
- */
- type: 'json';
-
- /**
- * Always None.
- */
- beta_fields?: { [key: string]: unknown } | null;
-
- /**
- * MCP tool calls made by the task.
- */
- mcp_tool_calls?: Array | null;
-
- /**
- * Output schema for the Task Run. Populated only if the task was executed with an
- * auto schema.
- */
- output_schema?: { [key: string]: unknown } | null;
- }
-}
-
-/**
- * Event indicating an error.
- */
-export interface ErrorEvent {
- /**
- * Error.
- */
- error: Shared.ErrorObject;
-
- /**
- * Event type; always 'error'.
- */
- type: 'error';
-}
-
-/**
- * MCP server configuration.
- */
-export interface McpServer {
- /**
- * Name of the MCP server.
- */
- name: string;
-
- /**
- * URL of the MCP server.
- */
- url: string;
-
- /**
- * List of allowed tools for the MCP server.
- */
- allowed_tools?: Array | null;
-
- /**
- * Headers for the MCP server.
- */
- headers?: { [key: string]: string } | null;
-
- /**
- * Type of MCP server being configured. Always `url`.
- */
- type?: 'url';
-}
-
-/**
- * Result of an MCP tool call.
- */
-export interface McpToolCall {
- /**
- * Arguments used to call the MCP tool.
- */
- arguments: string;
-
- /**
- * Name of the MCP server.
- */
- server_name: string;
-
- /**
- * Identifier for the tool call.
- */
- tool_call_id: string;
-
- /**
- * Name of the tool being called.
- */
- tool_name: string;
-
- /**
- * Output received from the tool call, if successful.
- */
- content?: string | null;
-
- /**
- * Error message if the tool call failed.
- */
- error?: string | null;
-}
-
/**
* Model for the parallel-beta header.
*/
@@ -323,61 +100,14 @@ export type ParallelBeta =
| 'field-basis-2025-11-25'
| (string & {});
-/**
- * Event when a task run transitions to a non-active status.
- *
- * May indicate completion, cancellation, or failure.
- */
-export interface TaskRunEvent {
- /**
- * Cursor to resume the event stream. Always empty for non Task Group runs.
- */
- event_id: string | null;
-
- /**
- * Task run object.
- */
- run: TaskRunAPI.TaskRun;
-
- /**
- * Event type; always 'task_run.state'.
- */
- type: 'task_run.state';
-
- /**
- * Task run input with additional beta fields.
- */
- input?: BetaRunInput | null;
-
- /**
- * Output from the run; included only if requested and if status == `completed`.
- */
- output?: TaskRunAPI.TaskRunTextOutput | TaskRunAPI.TaskRunJsonOutput | null;
-}
-
-/**
- * Webhooks for Task Runs.
- */
-export interface Webhook {
- /**
- * URL for the webhook.
- */
- url: string;
-
- /**
- * Event types to send the webhook notifications for.
- */
- event_types?: Array<'task_run.status'>;
-}
-
/**
* A progress update for a task run.
*/
export type TaskRunEventsResponse =
| TaskRunEventsResponse.TaskRunProgressStatsEvent
| TaskRunEventsResponse.TaskRunProgressMessageEvent
- | TaskRunEvent
- | ErrorEvent;
+ | TaskRunAPI.TaskRunEvent
+ | TaskRunAPI.ErrorEvent;
export namespace TaskRunEventsResponse {
/**
@@ -449,6 +179,52 @@ export namespace TaskRunEventsResponse {
}
}
+/**
+ * @deprecated Use parallel.types.task_run.TaskRunInput instead
+ */
+export type BetaRunInput = TaskRunAPI.RunInput;
+
+/**
+ * @deprecated Use parallel.types.task_run.TaskRunResult instead
+ */
+export type BetaTaskRunResult = TaskRunAPI.TaskRunResult;
+
+/**
+ * Backwards-compatible namespace for `BetaTaskRunResult`.
+ * @deprecated Use `TaskRunJsonOutput` and `TaskRunTextOutput` from `task-run` instead.
+ */
+export namespace BetaTaskRunResult {
+ /** @deprecated Use `TaskRunAPI.TaskRunTextOutput` instead */
+ export type BetaTaskRunTextOutput = TaskRunAPI.TaskRunTextOutput;
+ /** @deprecated Use `TaskRunAPI.TaskRunJsonOutput` instead */
+ export type BetaTaskRunJsonOutput = TaskRunAPI.TaskRunJsonOutput;
+}
+
+/**
+ * @deprecated Use parallel.types.task_run.Webhook instead
+ */
+export type Webhook = TaskRunAPI.Webhook;
+
+/**
+ * @deprecated Use parallel.types.task_run.McpServer instead
+ */
+export type McpServer = TaskRunAPI.McpServer;
+
+/**
+ * @deprecated Use parallel.types.task_run.McpToolCall instead
+ */
+export type McpToolCall = TaskRunAPI.McpToolCall;
+
+/**
+ * @deprecated Use parallel.types.task_run.TaskRunEvent instead
+ */
+export type TaskRunEvent = TaskRunAPI.TaskRunEvent;
+
+/**
+ * @deprecated Use parallel.types.task_run.ErrorEvent instead
+ */
+export type ErrorEvent = TaskRunAPI.ErrorEvent;
+
export interface TaskRunCreateParams {
/**
* Body param: Input to the task, either text or a JSON object.
@@ -460,24 +236,25 @@ export interface TaskRunCreateParams {
*/
processor: string;
+ /**
+ * Body param: Advanced search configuration for a task run.
+ */
+ advanced_settings?: TaskRunCreateParams.AdvancedSettings | null;
+
/**
* Body param: Controls tracking of task run execution progress. When set to true,
* progress events are recorded and can be accessed via the
- * [Task Run events](https://platform.parallel.ai/api-reference) endpoint. When
- * false, no progress events are tracked. Note that progress tracking cannot be
- * enabled after a run has been created. The flag is set to true by default for
- * premium processors (pro and above). To enable this feature in your requests,
- * specify `events-sse-2025-07-24` as one of the values in `parallel-beta` header
- * (for API calls) or `betas` param (for the SDKs).
+ * [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
+ * no progress events are tracked. Note that progress tracking cannot be enabled
+ * after a run has been created. The flag is set to true by default for premium
+ * processors (pro and above).
*/
enable_events?: boolean | null;
/**
- * Body param: Optional list of MCP servers to use for the run. To enable this
- * feature in your requests, specify `mcp-server-2025-07-17` as one of the values
- * in `parallel-beta` header (for API calls) or `betas` param (for the SDKs).
+ * Body param: Optional list of MCP servers to use for the run.
*/
- mcp_servers?: Array | null;
+ mcp_servers?: Array | null;
/**
* Body param: User-provided metadata stored with the run. Keys and values must be
@@ -510,7 +287,7 @@ export interface TaskRunCreateParams {
/**
* Body param: Webhooks for Task Runs.
*/
- webhook?: Webhook | null;
+ webhook?: TaskRunAPI.Webhook | null;
/**
* Header param: Optional header to specify the beta version(s) to enable.
@@ -518,6 +295,18 @@ export interface TaskRunCreateParams {
betas?: Array;
}
+export namespace TaskRunCreateParams {
+ /**
+ * Advanced search configuration for a task run.
+ */
+ export interface AdvancedSettings {
+ /**
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
+ */
+ location?: string | null;
+ }
+}
+
export interface TaskRunResultParams {
/**
* Query param
@@ -532,15 +321,15 @@ export interface TaskRunResultParams {
export declare namespace TaskRun {
export {
+ type ParallelBeta as ParallelBeta,
+ type TaskRunEventsResponse as TaskRunEventsResponse,
type BetaRunInput as BetaRunInput,
type BetaTaskRunResult as BetaTaskRunResult,
- type ErrorEvent as ErrorEvent,
+ type Webhook as Webhook,
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 ErrorEvent as ErrorEvent,
type TaskRunCreateParams as TaskRunCreateParams,
type TaskRunResultParams as TaskRunResultParams,
};
diff --git a/src/resources/index.ts b/src/resources/index.ts
index 709471e..c7e6560 100644
--- a/src/resources/index.ts
+++ b/src/resources/index.ts
@@ -6,14 +6,34 @@ export {
TaskRun,
type AutoSchema,
type Citation,
+ type ErrorEvent,
type FieldBasis,
type JsonSchema,
+ type McpServer,
+ type McpToolCall,
type RunInput,
+ type TaskRunEvent,
type TaskRunJsonOutput,
type TaskRunResult,
type TaskRunTextOutput,
type TaskSpec,
type TextSchema,
+ type Webhook,
+ type TaskRunEventsResponse,
type TaskRunCreateParams,
type TaskRunResultParams,
} from './task-run';
+export {
+ type AdvancedExtractSettings,
+ type AdvancedSearchSettings,
+ type ExcerptSettings,
+ type ExtractError,
+ type ExtractResponse,
+ type ExtractResult,
+ type FetchPolicy,
+ type SearchResult,
+ type UsageItem,
+ type WebSearchResult,
+ type ExtractParams,
+ type SearchParams,
+} from './top-level';
diff --git a/src/resources/shared.ts b/src/resources/shared.ts
index 477a52c..1b43c5d 100644
--- a/src/resources/shared.ts
+++ b/src/resources/shared.ts
@@ -52,7 +52,8 @@ export interface SourcePolicy {
* List of domains to exclude from results. If specified, sources from these
* domains will be excluded. Accepts plain domains (e.g., example.com,
* subdomain.example.gov) or bare domain extension starting with a period (e.g.,
- * .gov, .edu, .co.uk).
+ * .gov, .edu, .co.uk). The combined number of domains in include_domains and
+ * exclude_domains cannot exceed 200.
*/
exclude_domains?: Array;
@@ -60,7 +61,8 @@ export interface SourcePolicy {
* List of domains to restrict the results to. If specified, only sources from
* these domains will be included. Accepts plain domains (e.g., example.com,
* subdomain.example.gov) or bare domain extension starting with a period (e.g.,
- * .gov, .edu, .co.uk).
+ * .gov, .edu, .co.uk). The combined number of domains in include_domains and
+ * exclude_domains cannot exceed 200.
*/
include_domains?: Array;
}
diff --git a/src/resources/task-run.ts b/src/resources/task-run.ts
index 9b1300e..9399fc4 100644
--- a/src/resources/task-run.ts
+++ b/src/resources/task-run.ts
@@ -2,13 +2,23 @@
import { APIResource } from '../core/resource';
import * as Shared from './shared';
+import * as BetaTaskRunAPI from './beta/task-run';
import { APIPromise } from '../core/api-promise';
+import { Stream } from '../core/streaming';
+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
+ *
+ * Task Groups enable 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
*/
export class TaskRun extends APIResource {
/**
@@ -17,29 +27,85 @@ export class TaskRun extends APIResource {
* Returns immediately with a run object in status 'queued'.
*
* Beta features can be enabled by setting the 'parallel-beta' header.
- */
- create(body: TaskRunCreateParams, options?: RequestOptions): APIPromise {
- return this._client.post('/v1/tasks/runs', { body, ...options });
+ *
+ * @example
+ * ```ts
+ * const taskRun = await client.taskRun.create({
+ * input: 'What was the GDP of France in 2023?',
+ * processor: 'base',
+ * });
+ * ```
+ */
+ create(params: TaskRunCreateParams, options?: RequestOptions): APIPromise {
+ const { betas, ...body } = params;
+ return this._client.post('/v1/tasks/runs', {
+ body,
+ ...options,
+ headers: buildHeaders([
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
+ options?.headers,
+ ]),
+ });
}
/**
* Retrieves run status by run_id.
*
* The run result is available from the `/result` endpoint.
+ *
+ * @example
+ * ```ts
+ * const taskRun = await client.taskRun.retrieve('run_id');
+ * ```
*/
retrieve(runID: string, options?: RequestOptions): APIPromise {
return this._client.get(path`/v1/tasks/runs/${runID}`, options);
}
+ /**
+ * Streams events for a task run.
+ *
+ * Returns a stream of events showing progress updates and state changes for the
+ * task run.
+ *
+ * For task runs that did not have enable_events set to true during creation, the
+ * frequency of events will be reduced.
+ *
+ * @example
+ * ```ts
+ * const response = await client.taskRun.events('run_id');
+ * ```
+ */
+ events(runID: string, options?: RequestOptions): APIPromise> {
+ return this._client.get(path`/v1/tasks/runs/${runID}/events`, {
+ ...options,
+ headers: buildHeaders([{ Accept: 'text/event-stream' }, options?.headers]),
+ stream: true,
+ }) as APIPromise>;
+ }
+
/**
* Retrieves a run result by run_id, blocking until the run is completed.
+ *
+ * @example
+ * ```ts
+ * const taskRunResult = await client.taskRun.result('run_id');
+ * ```
*/
result(
runID: string,
- query: TaskRunResultParams | null | undefined = {},
+ params: TaskRunResultParams | null | undefined = {},
options?: RequestOptions,
): APIPromise {
- return this._client.get(path`/v1/tasks/runs/${runID}/result`, { query, ...options });
+ const { betas, ...query } = params ?? {};
+ return this._client.get(path`/v1/tasks/runs/${runID}/result`, {
+ query,
+ ...options,
+ headers: buildHeaders([
+ { ...(betas?.toString() != null ? { 'parallel-beta': betas?.toString() } : undefined) },
+ options?.headers,
+ ]),
+ });
}
}
@@ -74,6 +140,21 @@ export interface Citation {
title?: string | null;
}
+/**
+ * Event indicating an error.
+ */
+export interface ErrorEvent {
+ /**
+ * Error.
+ */
+ error: Shared.ErrorObject;
+
+ /**
+ * Event type; always 'error'.
+ */
+ type: 'error';
+}
+
/**
* Citations and reasoning supporting one field of a task output.
*/
@@ -115,6 +196,71 @@ export interface JsonSchema {
type?: 'json';
}
+/**
+ * MCP server configuration.
+ */
+export interface McpServer {
+ /**
+ * Name of the MCP server.
+ */
+ name: string;
+
+ /**
+ * URL of the MCP server.
+ */
+ url: string;
+
+ /**
+ * List of allowed tools for the MCP server.
+ */
+ allowed_tools?: Array | null;
+
+ /**
+ * Headers for the MCP server.
+ */
+ headers?: { [key: string]: string } | null;
+
+ /**
+ * Type of MCP server being configured. Always `url`.
+ */
+ type?: 'url';
+}
+
+/**
+ * Result of an MCP tool call.
+ */
+export interface McpToolCall {
+ /**
+ * Arguments used to call the MCP tool.
+ */
+ arguments: string;
+
+ /**
+ * Name of the MCP server.
+ */
+ server_name: string;
+
+ /**
+ * Identifier for the tool call.
+ */
+ tool_call_id: string;
+
+ /**
+ * Name of the tool being called.
+ */
+ tool_name: string;
+
+ /**
+ * Output received from the tool call, if successful.
+ */
+ content?: string | null;
+
+ /**
+ * Error message if the tool call failed.
+ */
+ error?: string | null;
+}
+
/**
* Request to run a task.
*/
@@ -129,6 +275,26 @@ export interface RunInput {
*/
processor: string;
+ /**
+ * Advanced search configuration for a task run.
+ */
+ advanced_settings?: RunInput.AdvancedSettings | null;
+
+ /**
+ * Controls tracking of task run execution progress. When set to true, progress
+ * events are recorded and can be accessed via the
+ * [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
+ * no progress events are tracked. Note that progress tracking cannot be enabled
+ * after a run has been created. The flag is set to true by default for premium
+ * processors (pro and above).
+ */
+ enable_events?: boolean | null;
+
+ /**
+ * Optional list of MCP servers to use for the run.
+ */
+ mcp_servers?: Array | null;
+
/**
* User-provided metadata stored with the run. Keys and values must be strings with
* a maximum length of 16 and 512 characters respectively.
@@ -156,6 +322,23 @@ export interface RunInput {
* For convenience bare strings are also accepted as input or output schemas.
*/
task_spec?: TaskSpec | null;
+
+ /**
+ * Webhooks for Task Runs.
+ */
+ webhook?: Webhook | null;
+}
+
+export namespace RunInput {
+ /**
+ * Advanced search configuration for a task run.
+ */
+ export interface AdvancedSettings {
+ /**
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
+ */
+ location?: string | null;
+ }
}
/**
@@ -220,6 +403,38 @@ export interface TaskRun {
warnings?: Array | null;
}
+/**
+ * Event when a task run transitions to a non-active status.
+ *
+ * May indicate completion, cancellation, or failure.
+ */
+export interface TaskRunEvent {
+ /**
+ * Cursor to resume the event stream. Always empty for non Task Group runs.
+ */
+ event_id: string | null;
+
+ /**
+ * Task run object.
+ */
+ run: TaskRun;
+
+ /**
+ * Event type; always 'task_run.state'.
+ */
+ type: 'task_run.state';
+
+ /**
+ * Request to run a task.
+ */
+ input?: RunInput | null;
+
+ /**
+ * Output from the run; included only if requested and if status == `completed`.
+ */
+ output?: TaskRunTextOutput | TaskRunJsonOutput | null;
+}
+
/**
* Output from a task that returns JSON.
*/
@@ -244,19 +459,16 @@ export interface TaskRunJsonOutput {
type: 'json';
/**
- * Additional fields from beta features used in this task run. When beta features
- * are specified during both task run creation and result retrieval, this field
- * will be empty and instead the relevant beta attributes will be directly included
- * in the `BetaTaskRunJsonOutput` or corresponding output type. However, if beta
- * features were specified during task run creation but not during result
- * retrieval, this field will contain the dump of fields from those beta features.
- * Each key represents the beta feature version (one amongst parallel-beta headers)
- * and the values correspond to the beta feature attributes, if any. For now, only
- * MCP server beta features have attributes. For example,
- * `{mcp-server-2025-07-17: [{'server_name':'mcp_server', 'tool_call_id': 'tc_123', ...}]}}`
+ * @deprecated Deprecated. mcp-server-2025-07-17 is now included directly in the
+ * output (e.g. mcp_tool_calls).
*/
beta_fields?: { [key: string]: unknown } | null;
+ /**
+ * MCP tool calls made by the task.
+ */
+ mcp_tool_calls?: Array | null;
+
/**
* Output schema for the Task Run. Populated only if the task was executed with an
* auto schema.
@@ -300,18 +512,15 @@ export interface TaskRunTextOutput {
type: 'text';
/**
- * Additional fields from beta features used in this task run. When beta features
- * are specified during both task run creation and result retrieval, this field
- * will be empty and instead the relevant beta attributes will be directly included
- * in the `BetaTaskRunJsonOutput` or corresponding output type. However, if beta
- * features were specified during task run creation but not during result
- * retrieval, this field will contain the dump of fields from those beta features.
- * Each key represents the beta feature version (one amongst parallel-beta headers)
- * and the values correspond to the beta feature attributes, if any. For now, only
- * MCP server beta features have attributes. For example,
- * `{mcp-server-2025-07-17: [{'server_name':'mcp_server', 'tool_call_id': 'tc_123', ...}]}}`
+ * @deprecated Deprecated. mcp-server-2025-07-17 is now included directly in the
+ * output (e.g. mcp_tool_calls).
*/
beta_fields?: { [key: string]: unknown } | null;
+
+ /**
+ * MCP tool calls made by the task.
+ */
+ mcp_tool_calls?: Array | null;
}
/**
@@ -353,37 +562,151 @@ export interface TextSchema {
type?: 'text';
}
+/**
+ * Webhooks for Task Runs.
+ */
+export interface Webhook {
+ /**
+ * URL for the webhook.
+ */
+ url: string;
+
+ /**
+ * Event types to send the webhook notifications for.
+ */
+ event_types?: Array<'task_run.status'>;
+}
+
+/**
+ * A progress update for a task run.
+ */
+export type TaskRunEventsResponse =
+ | TaskRunEventsResponse.TaskRunProgressStatsEvent
+ | TaskRunEventsResponse.TaskRunProgressMessageEvent
+ | TaskRunEvent
+ | ErrorEvent;
+
+export namespace TaskRunEventsResponse {
+ /**
+ * A progress update for a task run.
+ */
+ export interface TaskRunProgressStatsEvent {
+ /**
+ * Completion percentage of the task run. Ranges from 0 to 100 where 0 indicates no
+ * progress and 100 indicates completion.
+ */
+ progress_meter: number;
+
+ /**
+ * Source stats describing progress so far.
+ */
+ source_stats: TaskRunProgressStatsEvent.SourceStats;
+
+ /**
+ * Event type; always 'task_run.progress_stats'.
+ */
+ type: 'task_run.progress_stats';
+ }
+
+ export namespace TaskRunProgressStatsEvent {
+ /**
+ * Source stats describing progress so far.
+ */
+ export interface SourceStats {
+ /**
+ * Number of sources considered in processing the task.
+ */
+ num_sources_considered: number | null;
+
+ /**
+ * Number of sources read in processing the task.
+ */
+ num_sources_read: number | null;
+
+ /**
+ * A sample of URLs of sources read in processing the task.
+ */
+ sources_read_sample: Array | null;
+ }
+ }
+
+ /**
+ * A message for a task run progress update.
+ */
+ export interface TaskRunProgressMessageEvent {
+ /**
+ * Progress update message.
+ */
+ message: string;
+
+ /**
+ * Timestamp of the message.
+ */
+ timestamp: string | null;
+
+ /**
+ * Event type; always starts with 'task_run.progress_msg'.
+ */
+ type:
+ | 'task_run.progress_msg.plan'
+ | 'task_run.progress_msg.search'
+ | 'task_run.progress_msg.result'
+ | 'task_run.progress_msg.tool_call'
+ | 'task_run.progress_msg.exec_status';
+ }
+}
+
export interface TaskRunCreateParams {
/**
- * Input to the task, either text or a JSON object.
+ * Body param: Input to the task, either text or a JSON object.
*/
input: string | { [key: string]: unknown };
/**
- * Processor to use for the task.
+ * Body param: Processor to use for the task.
*/
processor: string;
/**
- * User-provided metadata stored with the run. Keys and values must be strings with
- * a maximum length of 16 and 512 characters respectively.
+ * Body param: Advanced search configuration for a task run.
+ */
+ advanced_settings?: TaskRunCreateParams.AdvancedSettings | null;
+
+ /**
+ * Body param: Controls tracking of task run execution progress. When set to true,
+ * progress events are recorded and can be accessed via the
+ * [Task Run events](https://docs.parallel.ai/api-reference) endpoint. When false,
+ * no progress events are tracked. Note that progress tracking cannot be enabled
+ * after a run has been created. The flag is set to true by default for premium
+ * processors (pro and above).
+ */
+ enable_events?: boolean | null;
+
+ /**
+ * Body param: Optional list of MCP servers to use for the run.
+ */
+ mcp_servers?: Array | null;
+
+ /**
+ * Body param: User-provided metadata stored with the run. Keys and values must be
+ * strings with a maximum length of 16 and 512 characters respectively.
*/
metadata?: { [key: string]: string | number | boolean } | null;
/**
- * Interaction ID to use as context for this request.
+ * Body param: Interaction ID to use as context for this request.
*/
previous_interaction_id?: string | null;
/**
- * Source policy for web search results.
+ * Body param: Source policy for web search results.
*
* This policy governs which sources are allowed/disallowed in results.
*/
source_policy?: Shared.SourcePolicy | null;
/**
- * Specification for a task.
+ * Body param: Specification for a task.
*
* Auto output schemas can be specified by setting `output_schema={"type":"auto"}`.
* Not specifying a TaskSpec is the same as setting an auto output schema.
@@ -391,25 +714,61 @@ export interface TaskRunCreateParams {
* For convenience bare strings are also accepted as input or output schemas.
*/
task_spec?: TaskSpec | null;
+
+ /**
+ * Body param: Webhooks for Task Runs.
+ */
+ webhook?: Webhook | null;
+
+ /**
+ * Header param: Optional header to specify the beta version(s) to enable.
+ */
+ betas?: Array;
+}
+
+export namespace TaskRunCreateParams {
+ /**
+ * Advanced search configuration for a task run.
+ */
+ export interface AdvancedSettings {
+ /**
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
+ */
+ location?: string | null;
+ }
}
export interface TaskRunResultParams {
+ /**
+ * Query param
+ */
timeout?: number;
+
+ /**
+ * Header param: Optional header to specify the beta version(s) to enable.
+ */
+ betas?: Array;
}
export declare namespace TaskRun {
export {
type AutoSchema as AutoSchema,
type Citation as Citation,
+ type ErrorEvent as ErrorEvent,
type FieldBasis as FieldBasis,
type JsonSchema as JsonSchema,
+ type McpServer as McpServer,
+ type McpToolCall as McpToolCall,
type RunInput as RunInput,
type TaskRun as TaskRun,
+ type TaskRunEvent as TaskRunEvent,
type TaskRunJsonOutput as TaskRunJsonOutput,
type TaskRunResult as TaskRunResult,
type TaskRunTextOutput as TaskRunTextOutput,
type TaskSpec as TaskSpec,
type TextSchema as TextSchema,
+ type Webhook as Webhook,
+ type TaskRunEventsResponse as TaskRunEventsResponse,
type TaskRunCreateParams as TaskRunCreateParams,
type TaskRunResultParams as TaskRunResultParams,
};
diff --git a/src/resources/top-level.ts b/src/resources/top-level.ts
new file mode 100644
index 0000000..8171ddd
--- /dev/null
+++ b/src/resources/top-level.ts
@@ -0,0 +1,385 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import * as Shared from './shared';
+
+/**
+ * Advanced extract configuration.
+ *
+ * These settings may impact result quality and latency unless used carefully. See
+ * https://docs.parallel.ai/search/advanced-extract-settings for more info.
+ */
+export interface AdvancedExtractSettings {
+ /**
+ * Optional settings for returning relevant excerpts.
+ */
+ excerpt_settings?: ExcerptSettings | null;
+
+ /**
+ * Policy for live fetching web results.
+ */
+ fetch_policy?: FetchPolicy | null;
+
+ /**
+ * Controls full content extraction. Set to true to enable with defaults, false to
+ * disable, or provide FullContentSettings for fine-grained control.
+ */
+ full_content?: AdvancedExtractSettings.FullContentSettings | boolean;
+}
+
+export namespace AdvancedExtractSettings {
+ /**
+ * Optional settings for returning full content.
+ */
+ export interface FullContentSettings {
+ /**
+ * Optional limit on the number of characters to include in the full content for
+ * each url. Full content always starts at the beginning of the page and is
+ * truncated at the limit if necessary.
+ */
+ max_chars_per_result?: number | null;
+ }
+}
+
+/**
+ * Advanced search configuration.
+ *
+ * These settings may impact result quality and latency unless used carefully. See
+ * https://docs.parallel.ai/search/advanced-search-settings for more info.
+ */
+export interface AdvancedSearchSettings {
+ /**
+ * Optional settings for returning relevant excerpts.
+ */
+ excerpt_settings?: ExcerptSettings | null;
+
+ /**
+ * Policy for live fetching web results.
+ */
+ fetch_policy?: FetchPolicy | null;
+
+ /**
+ * ISO 3166-1 alpha-2 country code for geo-targeted search results.
+ */
+ location?: string | null;
+
+ /**
+ * Upper bound on the number of results to return. Defaults to 10 if not provided.
+ */
+ max_results?: number | null;
+
+ /**
+ * Source policy for web search results.
+ *
+ * This policy governs which sources are allowed/disallowed in results.
+ */
+ source_policy?: Shared.SourcePolicy | null;
+}
+
+/**
+ * Optional settings for returning relevant excerpts.
+ */
+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. Values below 1000 will be automatically set to 1000.
+ */
+ max_chars_per_result?: number | null;
+}
+
+/**
+ * Extract error details.
+ */
+export interface ExtractError {
+ /**
+ * Content returned for http client or server errors, if any.
+ */
+ content: string | null;
+
+ /**
+ * Error type.
+ */
+ error_type: string;
+
+ /**
+ * HTTP status code, if available.
+ */
+ http_status_code: number | null;
+
+ url: string;
+}
+
+/**
+ * Extract response.
+ */
+export interface ExtractResponse {
+ /**
+ * Extract errors: requested URLs not in the results.
+ */
+ errors: Array;
+
+ /**
+ * Extract request ID, e.g. `extract_cad0a6d2dec046bd95ae900527d880e7`
+ */
+ extract_id: string;
+
+ /**
+ * Successful extract results.
+ */
+ results: Array;
+
+ /**
+ * Session identifier. Echoed back from the request if provided, otherwise
+ * generated by the server. Should be passed to future search and extract calls
+ * made by the agent as part of the same larger task.
+ */
+ session_id: string;
+
+ /**
+ * Usage metrics for the extract request.
+ */
+ usage?: Array | null;
+
+ /**
+ * Warnings for the extract request, if any.
+ */
+ warnings?: Array | null;
+}
+
+/**
+ * Extract result for a single URL.
+ */
+export interface ExtractResult {
+ /**
+ * Relevant excerpted content from the URL, formatted as markdown.
+ */
+ excerpts: Array;
+
+ /**
+ * URL associated with the search result.
+ */
+ url: string;
+
+ /**
+ * Full content from the URL formatted as markdown, if requested.
+ */
+ full_content?: string | null;
+
+ /**
+ * Publish date of the webpage in YYYY-MM-DD format, if available.
+ */
+ publish_date?: string | null;
+
+ /**
+ * Title of the webpage, if available.
+ */
+ title?: string | null;
+}
+
+/**
+ * Policy for live fetching web results.
+ */
+export interface FetchPolicy {
+ /**
+ * If false, fallback to cached content older than max-age if live fetch fails or
+ * times out. If true, returns an error instead.
+ */
+ disable_cache_fallback?: boolean;
+
+ /**
+ * Maximum age of cached content in seconds to trigger a live fetch. Minimum value
+ * 600 seconds (10 minutes).
+ */
+ max_age_seconds?: number | null;
+
+ /**
+ * Timeout in seconds for fetching live content if unavailable in cache.
+ */
+ timeout_seconds?: number | null;
+}
+
+/**
+ * Search response.
+ */
+export interface SearchResult {
+ /**
+ * A list of search results, ordered by decreasing relevance.
+ */
+ results: Array;
+
+ /**
+ * Search ID. Example: `search_cad0a6d2dec046bd95ae900527d880e7`
+ */
+ search_id: string;
+
+ /**
+ * Session identifier, echoed back from the request if provided, otherwise
+ * generated by the server. Should be passed to future search and extract calls
+ * made by the agent as part of the same larger task.
+ */
+ session_id: string;
+
+ /**
+ * Usage metrics for the search request.
+ */
+ usage?: Array | null;
+
+ /**
+ * Warnings for the search request, if any.
+ */
+ warnings?: Array | null;
+}
+
+/**
+ * Usage item for a single operation.
+ */
+export interface UsageItem {
+ /**
+ * Count of the SKU.
+ */
+ count: number;
+
+ /**
+ * Name of the SKU.
+ */
+ name: string;
+}
+
+/**
+ * A single search result from the web search API.
+ */
+export interface WebSearchResult {
+ /**
+ * Relevant excerpted content from the URL, formatted as markdown.
+ */
+ excerpts: Array;
+
+ /**
+ * URL associated with the search result.
+ */
+ url: string;
+
+ /**
+ * Publish date of the webpage in YYYY-MM-DD format, if available.
+ */
+ publish_date?: string | null;
+
+ /**
+ * Title of the webpage, if available.
+ */
+ title?: string | null;
+}
+
+export interface ExtractParams {
+ /**
+ * URLs to extract content from. Up to 20 URLs.
+ */
+ urls: Array;
+
+ /**
+ * Advanced extract configuration.
+ *
+ * These settings may impact result quality and latency unless used carefully. See
+ * https://docs.parallel.ai/search/advanced-extract-settings for more info.
+ */
+ advanced_settings?: AdvancedExtractSettings | null;
+
+ /**
+ * The model generating this request and consuming the results. Enables
+ * optimizations and tailors default settings for the model's capabilities.
+ */
+ client_model?: string | null;
+
+ /**
+ * Upper bound on total characters across excerpts from all extracted results.
+ */
+ max_chars_total?: number | null;
+
+ /**
+ * As in SearchRequest, a natural-language description of the underlying question
+ * or goal driving the request. Used together with search_queries to focus excerpts
+ * on the most relevant content.
+ */
+ objective?: string | null;
+
+ /**
+ * Optional keyword search queries, as in SearchRequest. Used together with
+ * objective to focus excerpts on the most relevant content.
+ */
+ search_queries?: Array | null;
+
+ /**
+ * Session identifier to track calls across separate search and extract calls, to
+ * be used as part of a larger task. Specifying it may give better contextual
+ * results for subsequent API calls.
+ */
+ session_id?: string | null;
+}
+
+export interface SearchParams {
+ /**
+ * Concise keyword search queries, 3-6 words each. At least one query is required,
+ * provide 2-3 for best results. Used together with objective to focus results on
+ * the most relevant content.
+ */
+ search_queries: Array;
+
+ /**
+ * Advanced search configuration.
+ *
+ * These settings may impact result quality and latency unless used carefully. See
+ * https://docs.parallel.ai/search/advanced-search-settings for more info.
+ */
+ advanced_settings?: AdvancedSearchSettings | null;
+
+ /**
+ * The model generating this request and consuming the results. Enables
+ * optimizations and tailors default settings for the model's capabilities.
+ */
+ client_model?: string | null;
+
+ /**
+ * Upper bound on total characters across excerpts from all results.
+ */
+ max_chars_total?: number | null;
+
+ /**
+ * Search mode preset: supported values are `basic` and `advanced`. Basic mode
+ * offers the lowest latency and works best with 2-3 high-quality search_queries.
+ * Advanced mode provides higher quality with more advanced retrieval and
+ * compression. Defaults to `advanced` when omitted.
+ */
+ mode?: 'basic' | 'advanced' | null;
+
+ /**
+ * Natural-language description of the underlying question or goal driving the
+ * search. Used together with search_queries to focus results on the most relevant
+ * content. Should be self-contained with enough context to understand the intent
+ * of the search.
+ */
+ objective?: string | null;
+
+ /**
+ * Session identifier to track calls across separate search and extract calls, to
+ * be used as part of a larger task. Specifying it may give better contextual
+ * results for subsequent API calls.
+ */
+ session_id?: string | null;
+}
+
+export declare namespace TopLevel {
+ 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,
+ };
+}
diff --git a/src/version.ts b/src/version.ts
index 64b8c32..4e7f788 100644
--- a/src/version.ts
+++ b/src/version.ts
@@ -1 +1 @@
-export const VERSION = '0.3.2'; // x-release-please-version
+export const VERSION = '0.4.0'; // x-release-please-version
diff --git a/tests/api-resources/beta/beta.test.ts b/tests/api-resources/beta/beta.test.ts
index bbd84c2..846c650 100644
--- a/tests/api-resources/beta/beta.test.ts
+++ b/tests/api-resources/beta/beta.test.ts
@@ -31,6 +31,7 @@ describe('resource beta', () => {
full_content: true,
objective: 'objective',
search_queries: ['string'],
+ session_id: 'session_id',
betas: ['mcp-server-2025-07-17'],
});
});
diff --git a/tests/api-resources/beta/findall.test.ts b/tests/api-resources/beta/findall.test.ts
index c4c3b5b..3049a66 100644
--- a/tests/api-resources/beta/findall.test.ts
+++ b/tests/api-resources/beta/findall.test.ts
@@ -95,6 +95,28 @@ describe('resource findall', () => {
).rejects.toThrow(Parallel.NotFoundError);
});
+ test('candidates: only required params', async () => {
+ const responsePromise = client.beta.findall.candidates({
+ entity_type: 'company',
+ objective: 'objective',
+ });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('candidates: required and optional params', async () => {
+ const response = await client.beta.findall.candidates({
+ entity_type: 'company',
+ objective: 'objective',
+ match_limit: 5,
+ });
+ });
+
test('enrich: only required params', async () => {
const responsePromise = client.beta.findall.enrich('findall_id', {
output_schema: {
@@ -140,8 +162,7 @@ describe('resource findall', () => {
});
});
- // Mock server doesn't support text/event-stream responses
- test.skip('events', async () => {
+ test('events', async () => {
const responsePromise = client.beta.findall.events('findall_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -152,8 +173,7 @@ describe('resource findall', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- // Mock server doesn't support text/event-stream responses
- test.skip('events: request options and params are passed correctly', async () => {
+ test('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(
client.beta.findall.events(
diff --git a/tests/api-resources/beta/task-group.test.ts b/tests/api-resources/beta/task-group.test.ts
index 4fe45b6..1587fe7 100644
--- a/tests/api-resources/beta/task-group.test.ts
+++ b/tests/api-resources/beta/task-group.test.ts
@@ -49,6 +49,7 @@ describe('resource taskGroup', () => {
{
input: 'What was the GDP of France in 2023?',
processor: 'base',
+ advanced_settings: { location: 'us' },
enable_events: true,
mcp_servers: [
{
@@ -81,6 +82,7 @@ describe('resource taskGroup', () => {
webhook: { url: 'url', event_types: ['task_run.status'] },
},
],
+ refresh_status: true,
default_task_spec: {
output_schema: {
json_schema: {
@@ -97,8 +99,7 @@ describe('resource taskGroup', () => {
});
});
- // Mock server doesn't support text/event-stream responses
- test.skip('events', async () => {
+ test('events', async () => {
const responsePromise = client.beta.taskGroup.events('taskgroup_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -109,8 +110,7 @@ describe('resource taskGroup', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- // Mock server doesn't support text/event-stream responses
- test.skip('events: request options and params are passed correctly', async () => {
+ test('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(
client.beta.taskGroup.events(
@@ -121,8 +121,7 @@ describe('resource taskGroup', () => {
).rejects.toThrow(Parallel.NotFoundError);
});
- // Mock server doesn't support text/event-stream responses
- test.skip('getRuns', async () => {
+ test('getRuns', async () => {
const responsePromise = client.beta.taskGroup.getRuns('taskgroup_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
@@ -133,8 +132,7 @@ describe('resource taskGroup', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
- // Mock server doesn't support text/event-stream responses
- test.skip('getRuns: request options and params are passed correctly', async () => {
+ test('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(
client.beta.taskGroup.getRuns(
diff --git a/tests/api-resources/beta/task-run.test.ts b/tests/api-resources/beta/task-run.test.ts
index 2319b54..bf203d6 100644
--- a/tests/api-resources/beta/task-run.test.ts
+++ b/tests/api-resources/beta/task-run.test.ts
@@ -26,6 +26,7 @@ describe('resource taskRun', () => {
const response = await client.beta.taskRun.create({
input: 'What was the GDP of France in 2023?',
processor: 'base',
+ advanced_settings: { location: 'us' },
enable_events: true,
mcp_servers: [
{
@@ -60,8 +61,7 @@ describe('resource taskRun', () => {
});
});
- // Mock server doesn't support text/event-stream responses
- test.skip('events', async () => {
+ test('events', async () => {
const responsePromise = client.beta.taskRun.events('run_id');
const rawResponse = await responsePromise.asResponse();
expect(rawResponse).toBeInstanceOf(Response);
diff --git a/tests/api-resources/task-run.test.ts b/tests/api-resources/task-run.test.ts
index 1246671..78f6fb6 100644
--- a/tests/api-resources/task-run.test.ts
+++ b/tests/api-resources/task-run.test.ts
@@ -26,6 +26,17 @@ describe('resource taskRun', () => {
const response = await client.taskRun.create({
input: 'What was the GDP of France in 2023?',
processor: 'base',
+ advanced_settings: { location: 'us' },
+ enable_events: true,
+ mcp_servers: [
+ {
+ name: 'name',
+ url: 'url',
+ allowed_tools: ['string'],
+ headers: { foo: 'string' },
+ type: 'url',
+ },
+ ],
metadata: { foo: 'string' },
previous_interaction_id: 'previous_interaction_id',
source_policy: {
@@ -45,6 +56,8 @@ describe('resource taskRun', () => {
},
input_schema: 'string',
},
+ webhook: { url: 'url', event_types: ['task_run.status'] },
+ betas: ['mcp-server-2025-07-17'],
});
});
@@ -59,6 +72,17 @@ describe('resource taskRun', () => {
expect(dataAndResponse.response).toBe(rawResponse);
});
+ test('events', async () => {
+ const responsePromise = client.taskRun.events('run_id');
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
test('result', async () => {
const responsePromise = client.taskRun.result('run_id');
const rawResponse = await responsePromise.asResponse();
@@ -73,7 +97,11 @@ describe('resource taskRun', () => {
test('result: 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(
- client.taskRun.result('run_id', { timeout: 0 }, { path: '/_stainless_unknown_path' }),
+ client.taskRun.result(
+ 'run_id',
+ { timeout: 0, betas: ['mcp-server-2025-07-17'] },
+ { path: '/_stainless_unknown_path' },
+ ),
).rejects.toThrow(Parallel.NotFoundError);
});
});
diff --git a/tests/api-resources/top-level.test.ts b/tests/api-resources/top-level.test.ts
new file mode 100644
index 0000000..f1b0ecd
--- /dev/null
+++ b/tests/api-resources/top-level.test.ts
@@ -0,0 +1,78 @@
+// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
+
+import Parallel from 'parallel-web';
+
+const client = new Parallel({
+ apiKey: 'My API Key',
+ baseURL: process.env['TEST_API_BASE_URL'] ?? 'http://127.0.0.1:4010',
+});
+
+describe('top level methods', () => {
+ test('extract: only required params', async () => {
+ const responsePromise = client.extract({ urls: ['string'] });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('extract: required and optional params', async () => {
+ const response = await client.extract({
+ urls: ['string'],
+ advanced_settings: {
+ excerpt_settings: { max_chars_per_result: 0 },
+ fetch_policy: {
+ disable_cache_fallback: true,
+ max_age_seconds: 86400,
+ timeout_seconds: 60,
+ },
+ full_content: { max_chars_per_result: 0 },
+ },
+ client_model: 'claude-sonnet-4-6-20260401',
+ max_chars_total: 0,
+ objective: 'objective',
+ search_queries: ['string'],
+ session_id: 'session_id',
+ });
+ });
+
+ test('search: only required params', async () => {
+ const responsePromise = client.search({ search_queries: ['string'] });
+ const rawResponse = await responsePromise.asResponse();
+ expect(rawResponse).toBeInstanceOf(Response);
+ const response = await responsePromise;
+ expect(response).not.toBeInstanceOf(Response);
+ const dataAndResponse = await responsePromise.withResponse();
+ expect(dataAndResponse.data).toBe(response);
+ expect(dataAndResponse.response).toBe(rawResponse);
+ });
+
+ test('search: required and optional params', async () => {
+ const response = await client.search({
+ search_queries: ['string'],
+ advanced_settings: {
+ excerpt_settings: { max_chars_per_result: 0 },
+ fetch_policy: {
+ disable_cache_fallback: true,
+ max_age_seconds: 86400,
+ timeout_seconds: 60,
+ },
+ location: 'us',
+ max_results: 0,
+ source_policy: {
+ after_date: '2024-01-01',
+ exclude_domains: ['reddit.com', 'x.com', '.ai'],
+ include_domains: ['wikipedia.org', 'usa.gov', '.edu'],
+ },
+ },
+ client_model: 'claude-sonnet-4-6-20260401',
+ max_chars_total: 0,
+ mode: 'basic',
+ objective: 'objective',
+ session_id: 'session_id',
+ });
+ });
+});
diff --git a/yarn.lock b/yarn.lock
index fc9f262..f6eae3c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -1219,18 +1219,10 @@ baseline-browser-mapping@^2.9.0:
resolved "https://registry.yarnpkg.com/baseline-browser-mapping/-/baseline-browser-mapping-2.9.14.tgz#3b6af0bc032445bca04de58caa9a87cfe921cbb3"
integrity sha512-B0xUquLkiGLgHhpPBqvl7GWegWBUNuujQ6kXd/r1U38ElPT6Ok8KZ8e+FpUGEc2ZoRQUzq/aUnaKFc/svWUGSg==
-brace-expansion@^1.1.7:
- version "1.1.12"
- resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.12.tgz#ab9b454466e5a8cc3a187beaad580412a9c5b843"
- integrity sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==
- dependencies:
- balanced-match "^1.0.0"
- concat-map "0.0.1"
-
-brace-expansion@^2.0.1:
- version "2.0.2"
- resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.0.2.tgz#54fc53237a613d854c7bd37463aad17df87214e7"
- integrity sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==
+brace-expansion@^2.0.2:
+ version "2.1.0"
+ resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-2.1.0.tgz#4f41a41190216ee36067ec381526fe9539c4f0ae"
+ integrity sha512-TN1kCZAgdgweJhWWpgKYrQaMNHcDULHkWwQIspdtjV4Y5aurRdZpjAqn6yX3FPqTA9ngHCc4hJxMAMgGfve85w==
dependencies:
balanced-match "^1.0.0"
@@ -1395,11 +1387,6 @@ commander@^10.0.1:
resolved "https://registry.yarnpkg.com/commander/-/commander-10.0.1.tgz#881ee46b4f77d1c1dccc5823433aa39b022cbe06"
integrity sha512-y4Mg2tXshplEbSGzx7amzPwKKOCGuoSRP/CjEdwwk0FOGlUbq6lKuoyDZTNZkmxHdJtp54hdfY/JUrdL7Xfdug==
-concat-map@0.0.1:
- version "0.0.1"
- resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
- integrity sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==
-
convert-source-map@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a"
@@ -2600,26 +2587,12 @@ mimic-fn@^2.1.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
integrity sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==
-minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2:
- version "3.1.2"
- resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
- integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
- dependencies:
- brace-expansion "^1.1.7"
-
-minimatch@^5.0.1:
- version "5.1.6"
- resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-5.1.6.tgz#1cfcb8cf5522ea69952cd2af95ae09477f122a96"
- integrity sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==
- dependencies:
- brace-expansion "^2.0.1"
-
-minimatch@^9.0.4:
- version "9.0.5"
- resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.5.tgz#d74f9dd6b57d83d8e98cfb82133b03978bc929e5"
- integrity sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==
+minimatch@^3.0.4, minimatch@^3.1.1, minimatch@^3.1.2, minimatch@^5.0.1, minimatch@^9.0.4, minimatch@^9.0.5:
+ version "9.0.9"
+ resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.9.tgz#9b0cb9fcb78087f6fd7eababe2511c4d3d60574e"
+ integrity sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==
dependencies:
- brace-expansion "^2.0.1"
+ brace-expansion "^2.0.2"
minimist@^1.2.6:
version "1.2.6"