Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

added perplexity search endpoint, updated models list for perplexity block

Fixes #1795

Type of Change

  • New feature

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 Nov 5, 2025

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

Project Deployment Preview Comments Updated (UTC)
docs Ready Ready Preview Comment Nov 5, 2025 6:59pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

Greptile Overview

Greptile Summary

This PR adds Perplexity search endpoint support, extending the existing Perplexity integration beyond chat to include web search functionality.

Key Changes

  • Added new perplexity_search tool with support for advanced filtering (domain, country, recency, date ranges)
  • Updated Perplexity block with operation dropdown to switch between Chat and Search modes
  • Refreshed model list to include current Perplexity models (Sonar, Sonar Pro, Sonar Deep Research, Sonar Reasoning variants)
  • Added conditional field rendering based on selected operation
  • Implemented domain filter parsing from comma-separated string to array
  • Updated documentation to reflect new search capabilities

Implementation

The implementation follows established patterns in the codebase, with proper TypeScript typing and consistent structure matching other search tools like Tavily and Exa. The block config properly handles conditional field display and parameter transformation for both operations.

Confidence Score: 4/5

  • This PR is safe to merge with minor considerations
  • The implementation is well-structured and follows existing patterns. No critical bugs found. Score reduced from 5 due to lack of error handling for malformed API responses and no validation for numeric constraints (max_results 1-20, max 20 domains)
  • Pay attention to apps/sim/tools/perplexity/search.ts for potential runtime errors with malformed API responses

Important Files Changed

File Analysis

Filename Score Overview
apps/sim/tools/perplexity/search.ts 4/5 New search tool implementation following established patterns, proper TypeScript typing and API integration
apps/sim/tools/perplexity/types.ts 5/5 Added TypeScript interfaces for search params and response, clean type definitions
apps/sim/blocks/blocks/perplexity.ts 4/5 Updated block config with operation dropdown and conditional fields, models list updated, proper parameter transformation

Sequence Diagram

sequenceDiagram
    participant User
    participant PerplexityBlock
    participant ToolConfig
    participant PerplexityAPI

    User->>PerplexityBlock: Select operation (Chat/Search)
    
    alt Search Operation
        User->>PerplexityBlock: Enter search query & filters
        PerplexityBlock->>PerplexityBlock: Parse domain filter (comma-separated to array)
        PerplexityBlock->>ToolConfig: Route to perplexity_search tool
        ToolConfig->>PerplexityAPI: POST /search with query & filters
        PerplexityAPI-->>ToolConfig: Return search results
        ToolConfig->>ToolConfig: Transform response (map results)
        ToolConfig-->>User: Return formatted search results
    else Chat Operation
        User->>PerplexityBlock: Enter prompt & model selection
        PerplexityBlock->>ToolConfig: Route to perplexity_chat tool
        ToolConfig->>PerplexityAPI: POST /chat/completions
        PerplexityAPI-->>ToolConfig: Return chat completion
        ToolConfig->>ToolConfig: Transform response
        ToolConfig-->>User: Return chat response
    end
Loading

6 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 0260dbc into staging Nov 5, 2025
14 of 15 checks passed
@waleedlatif1 waleedlatif1 deleted the sim-343 branch November 5, 2025 19:15
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 5, 2025
10 tasks
waleedlatif1 added a commit that referenced this pull request Nov 12, 2025
@waleedlatif1 waleedlatif1 mentioned this pull request Nov 12, 2025
10 tasks
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.

2 participants