Skip to content

fix(parallel): align integration with Parallel AI API docs#3501

Merged
waleedlatif1 merged 6 commits intostagingfrom
waleedlatif1/validate-parallel-ai
Mar 10, 2026
Merged

fix(parallel): align integration with Parallel AI API docs#3501
waleedlatif1 merged 6 commits intostagingfrom
waleedlatif1/validate-parallel-ai

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • Fixed deep research processor values to match API (pro, ultra, pro-fast, ultra-fast)
  • Added missing search mode param (one-shot, agentic, fast) replacing deprecated processor
  • Added source_policy (include/exclude domains) to search tool
  • Fixed result endpoint URL to use /result suffix
  • Fixed extract objective and excerpts/full_content required status per API docs
  • Added missing response fields (search_id, extract_id, publish_date, full_content)
  • Moved param remapping from tools.config.tool to tools.config.params
  • Added error handling, ?? null on nullable fields, mode: 'advanced' on optional fields
  • Updated types and docs to match

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Mar 10, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment Mar 10, 2026 2:47am

Request Review

@cursor
Copy link

cursor bot commented Mar 10, 2026

PR Summary

Medium Risk
Medium risk because it changes request/response shapes and parameter defaults for external Parallel AI calls, which could break existing workflows expecting the old fields or stringified outputs.

Overview
Updates the Parallel AI integration to match the latest API: parallel_search replaces the deprecated processor with mode, adds domain include/exclude source policy support, and adjusts result excerpt handling/defaults.

parallel_extract and parallel_deep_research are updated to relax/rename parameters, align processor tiers/defaults, and add stronger error handling plus safer nullable-field mapping. Tool/block outputs and TypeScript types now expose structured json outputs and new response fields (search_id, extract_id, publish_date, full_content), with docs and the block UI updated accordingly.

Written by Cursor Bugbot for commit 2df13b6. Configure here.

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 10, 2026

Greptile Summary

This PR aligns the Parallel AI integration with the current API documentation, correcting processor tier values, replacing the deprecated processor param with a mode param on search, adding source_policy domain filtering to search, fixing the result polling URL, making extract fields optional, and surfacing previously missing response fields (search_id, extract_id, publish_date, full_content). The param-remapping logic is also correctly moved from config.tool (mutation) to config.params (return value), which is the right architectural approach.

Key changes:

  • search.ts: processormode (one-shot/agentic/fast), max_chars_per_result wrapped inside excerpts object per new API shape, source_policy construction added, error handling + search_id output added.
  • extract.ts: objective, excerpts, full_content made optional, extract_id and publish_date added to output, error handling added.
  • deep_research.ts: Processor values corrected (pro/ultra/pro-fast/ultra-fast), default changed from basepro, result parsing updated to read taskResult.status directly, error handling added.
  • parallel.ts block: New advanced fields added for search (mode, domain filtering), processor dropdown updated, param remapping moved to config.params.
  • types.ts: Interfaces extended with new fields; ParallelSearchResult.url/title and ParallelExtractResult.url remain typed as non-nullable string while the transform functions can produce null — a type inconsistency worth fixing.

Confidence Score: 4/5

  • Safe to merge with minor type fixes recommended before downstream consumers rely on search/extract result types.
  • The functional changes are well-reasoned and align with API docs. Error handling has been added throughout, and the param remapping refactor is clean. The main concern is a type inconsistency where url/title in ParallelSearchResult and url in ParallelExtractResult are declared as string but can be null at runtime — this could cause silent type errors in downstream code. The include_domains/exclude_domains unconditional undefined assignment and the search_queries input type declaration are minor style issues with no immediate runtime impact.
  • apps/sim/tools/parallel/types.ts — nullable field types need to be corrected to match the actual runtime values produced by the transform functions.

Important Files Changed

Filename Overview
apps/sim/tools/parallel/types.ts Correctly updated types to reflect API changes (optional fields, new response shapes, extended basis structure), but ParallelSearchResult.url/title and ParallelExtractResult.url are still typed as non-nullable string while the transform functions map them with ?? null.
apps/sim/tools/parallel/search.ts Good improvements: added error handling, mode param, source_policy construction, search_id in output, and smarter search_queries handling for both string and array inputs. Logic is sound.
apps/sim/tools/parallel/extract.ts Fields correctly made optional per API docs, extract_id and publish_date added to output, error handling added. Minor: url typed as non-nullable string in the interface but mapped as nullable in transformResponse.
apps/sim/tools/parallel/deep_research.ts Processor values corrected to match API (pro/ultra/pro-fast/ultra-fast), error handling added to transformResponse, result response parsing updated to use taskResult.status directly rather than taskResult.run.status. Changes appear correct.
apps/sim/blocks/blocks/parallel.ts Param remapping correctly moved to config.params, new search advanced fields added (mode, include/exclude domains). Two style concerns: unconditional undefined key assignment for domain params, and search_queries input type declared as string despite the tool accepting and preferring an array.
apps/sim/tools/parallel/index.ts Added export * from './types' to re-export types from the index barrel file — straightforward and correct.
apps/docs/content/docs/en/tools/parallel_ai.mdx Documentation updated to match new API: corrected processor values, added mode, source_policy, search_id, extract_id, publish_date, full_content fields, and updated deep research time estimate from 15 to 45 minutes.

Sequence Diagram

sequenceDiagram
    participant UI as Block UI (parallel.ts)
    participant BP as config.params()
    participant ST as parallel_search tool
    participant ET as parallel_extract tool
    participant DR as parallel_deep_research tool
    participant API as Parallel AI API

    UI->>BP: params (operation, search_mode, search_queries, search_include/exclude_domains, ...)
    BP-->>ST: {objective, search_queries[], mode, max_results, max_chars_per_result, include_domains, exclude_domains}
    ST->>API: POST /v1beta/search\n{objective, search_queries, mode,\n max_results, excerpts:{max_chars_per_result},\n source_policy:{include/exclude_domains}}
    API-->>ST: {search_id, results:[{url, title, publish_date, excerpts}]}
    ST-->>UI: {search_id, results[]}

    UI->>BP: params (operation=extract, extract_objective, urls, excerpts, full_content)
    BP-->>ET: {urls, objective, excerpts, full_content}
    ET->>API: POST /v1beta/extract\n{urls[], objective, excerpts, full_content}
    API-->>ET: {extract_id, results:[{url, title, publish_date, excerpts, full_content}]}
    ET-->>UI: {extract_id, results[]}

    UI->>BP: params (operation=deep_research, research_input, processor, include/exclude_domains)
    BP-->>DR: {input, processor, include_domains, exclude_domains}
    DR->>API: POST /v1/tasks/runs\n{input, processor, task_spec:{output_schema:auto}, source_policy}
    API-->>DR: {run_id, status}
    DR->>API: GET /v1/tasks/runs/{run_id}/result
    API-->>DR: {status, output:{content, basis}}
    DR-->>UI: {status, run_id, message, content, basis[]}
Loading

Comments Outside Diff (1)

  1. apps/sim/blocks/blocks/parallel.ts, line 238 (link)

    search_queries input declared as string but the tool expects and receives an array

    The inputs declaration for search_queries uses type: 'string', yet config.params converts the comma-separated string into an array (result.search_queries = queries). When another block wires a JSON/array value into this input, the typeof params.search_queries === 'string' guard in config.params (line 200) will be false, so result.search_queries is never set — and the array value falls through as a raw base-param whose type (string) conflicts with the tool's json param declaration.

    Consider updating the inputs declaration to reflect the dual-type nature of the field:

Last reviewed commit: 2df13b6

@waleedlatif1
Copy link
Collaborator Author

@cursor review

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@greptile

@waleedlatif1
Copy link
Collaborator Author

@cursor review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@waleedlatif1 waleedlatif1 merged commit 2e1c639 into staging Mar 10, 2026
6 checks passed
@waleedlatif1 waleedlatif1 deleted the waleedlatif1/validate-parallel-ai branch March 10, 2026 02:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant