网淘吧来吧,欢迎您!

Perplexity Search Skill

2026-03-31 新闻来源:网淘吧 围观:18
电脑广告
手机广告

Perplexity 搜索

使用 Perplexity 的搜索 API 搜索网络,获取经过排名的实时结果。

快速开始

基本搜索:

Perplexity Search Skill

python3 {baseDir}/scripts/search.py "your search query"

带选项:

# Get 10 results
python3 {baseDir}/scripts/search.py "AI trends 2024" --count 10

# Filter by recency
python3 {baseDir}/scripts/search.py "recent AI news" --recency week

# Get raw JSON output
python3 {baseDir}/scripts/search.py "market research" --json

API 密钥设置

脚本需要一个PERPLEXITY_API_KEY环境变量。

选项 1:在 OpenClaw 配置中设置(推荐)

添加到~/.openclaw/openclaw.json

{
  "skills": {
    "perplexity-search": {
      "env": {
        "PERPLEXITY_API_KEY": "your-api-key-here"
      }
    }
  }
}

选项 2:环境变量

export PERPLEXITY_API_KEY="your-api-key-here"

从以下网址获取您的 API 密钥:https://perplexity.ai/account/api

参数

  • query- 搜索查询字符串(必需)
  • --count N- 结果数量(1-10,默认值:5)
  • --recency FILTER- 时效性筛选:
  • --json- 输出原始JSON而非格式化结果

响应格式

API返回:

{
  "results": [
    {
      "title": "Article title",
      "url": "https://example.com/article",
      "snippet": "Brief excerpt from the page...",
      "date": "2024-01-15",
      "last_updated": "2024-02-01"
    }
  ],
  "id": "search-request-id"
}

使用场景

市场研究:

python3 {baseDir}/scripts/search.py "golf coaching Instagram trends" --count 10

近期新闻:

python3 {baseDir}/scripts/search.py "AI regulation updates" --recency week

竞品分析:

python3 {baseDir}/scripts/search.py "AI golf training apps" --count 10

定价

Perplexity搜索API:每1000次请求5美元

使用量查询地址:https://perplexity.ai/account/api

安全机制

  • API密钥仅从环境变量加载 - 绝不硬编码
  • 输出净化机制可防止终端注入攻击
  • 错误信息不暴露敏感信息
  • 30秒超时防止请求挂起
  • 对所有参数进行输入验证

备注

  • 结果按相关性排序
  • 包含实时网络数据
  • 支持按时效性筛选
  • 返回结构化JSON或格式化文本
  • 根据您的Perplexity套餐适用速率限制

免责申明
部分文章来自各大搜索引擎,如有侵权,请与我联系删除。
打赏

文章底部电脑广告
手机广告位-内容正文底部
上一篇:Safe Exec 0.3.2 下一篇:Whoop

相关文章

您是本站第381262名访客 今日有381篇新文章/评论