perplexity-search

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Perplexity Search Skill

Perplexity Search Skill

A skill for executing real-time web searches and research using the Perplexity API.
一款基于Perplexity API执行实时网页搜索与调研的Skill。

Purpose

用途

This skill provides the following capabilities:
  1. perplexity_ask - Answer general questions (using sonar-pro model)
  2. perplexity_research - Deep research and comprehensive reports (using sonar-deep-research model)
  3. perplexity_reason - Advanced reasoning and analysis (using sonar-reasoning-pro model)
  4. perplexity_search - Retrieve web search results
本Skill具备以下功能:
  1. perplexity_ask - 解答通用问题(使用sonar-pro模型)
  2. perplexity_research - 深度调研与综合报告(使用sonar-deep-research模型)
  3. perplexity_reason - 高级推理与分析(使用sonar-reasoning-pro模型)
  4. perplexity_search - 检索网页搜索结果

When to Use

使用场景

Use this skill in the following situations:
  • User needs up-to-date information
  • Received a question requiring web search
  • Asked to perform deep research or investigation
  • Complex analysis or reasoning is required
  • Keywords like "look up", "search for", "latest..." are included
在以下场景中可使用本Skill:
  • 用户需要最新信息
  • 收到需要网页搜索的问题
  • 被要求进行深度调研或调查
  • 需要复杂分析或推理
  • 包含“查找”“搜索”“最新……”等关键词

Prerequisites

前置条件

  • PERPLEXITY_API_KEY
    environment variable must be set
  • Internet connection must be available
  • 必须设置
    PERPLEXITY_API_KEY
    环境变量
  • 需具备互联网连接

Usage

使用方法

Basic Usage

基础用法

Use the
scripts/perplexity_api.py
script to call the API.
bash
undefined
使用
scripts/perplexity_api.py
脚本调用API。
bash
undefined

General questions (ask)

General questions (ask)

python3 scripts/perplexity_api.py ask "your question"
python3 scripts/perplexity_api.py ask "your question"

Deep research (research)

Deep research (research)

python3 scripts/perplexity_api.py research "research topic"
python3 scripts/perplexity_api.py research "research topic"

Advanced reasoning (reason)

Advanced reasoning (reason)

python3 scripts/perplexity_api.py reason "reasoning task"
python3 scripts/perplexity_api.py reason "reasoning task"

Web search (search)

Web search (search)

python3 scripts/perplexity_api.py search "search query" [--max-results 10] [--country JP]
undefined
python3 scripts/perplexity_api.py search "search query" [--max-results 10] [--country JP]
undefined

Command Options

命令选项

ask / research / reason

ask / research / reason

  • First argument: question, research topic, or reasoning task
  • --strip-thinking
    : Remove
    <think>...</think>
    tags to save context tokens (research/reason only)
  • 第一个参数:问题、调研主题或推理任务
  • --strip-thinking
    :移除
    <think>...</think>
    标签以节省上下文令牌(仅适用于research/reason)

search

search

  • First argument: search query
  • --max-results
    : Maximum number of results to return (1-20, default: 10)
  • --max-tokens-per-page
    : Maximum tokens per page (256-2048, default: 1024)
  • --country
    : ISO code for regional results (e.g., JP, US, GB)
  • 第一个参数:搜索查询词
  • --max-results
    :返回结果的最大数量(1-20,默认值:10)
  • --max-tokens-per-page
    :每页最大令牌数(256-2048,默认值:1024)
  • --country
    :用于获取区域结果的ISO代码(例如:JP, US, GB)

Workflow

工作流程

Standard Search Flow

标准搜索流程

  1. Analyze the user's question and select the appropriate tool
    • Simple questions →
      ask
    • Deep research →
      research
    • Complex analysis →
      reason
    • Information gathering →
      search
  2. Execute the script to call the API
  3. Present results to the user, citing sources when available
  1. 分析用户问题并选择合适的工具
    • 简单问题 →
      ask
    • 深度调研 →
      research
    • 复杂分析 →
      reason
    • 信息收集 →
      search
  2. 执行脚本调用API
  3. 向用户展示结果,若有来源则注明

Tool Selection Guidelines

工具选择指南

Use CaseToolDescription
Current weather, newsaskWhen quick answers are needed
Technical topic researchresearchWhen comprehensive analysis is needed
Complex problem analysisreasonWhen logical reasoning is needed
Collecting sourcessearchWhen URLs or snippets are needed
使用场景工具说明
当前天气、新闻ask需要快速解答时
技术主题调研research需要综合分析时
复杂问题分析reason需要逻辑推理时
收集来源search需要URL或片段时

API Details

API详情

For detailed API specifications, see
references/api_reference.md
.
如需详细的API规范,请查看
references/api_reference.md

Troubleshooting

故障排除

  • API Key Error: Verify the
    PERPLEXITY_API_KEY
    environment variable
  • Timeout: Increase
    PERPLEXITY_TIMEOUT_MS
    (default: 300000ms)
  • Proxy Issues: Set
    PERPLEXITY_PROXY
    or
    HTTPS_PROXY
  • API密钥错误:验证
    PERPLEXITY_API_KEY
    环境变量是否正确设置
  • 超时:增大
    PERPLEXITY_TIMEOUT_MS
    (默认值:300000ms)
  • 代理问题:设置
    PERPLEXITY_PROXY
    HTTPS_PROXY