$npx -y skills add LeonChaoX/qinyan-academic-skills --skill perplexity-searchPerform AI-powered web searches with real-time information using Perplexity models via LiteLLM and OpenRouter. This skill should be used when conducting web searches for current information, finding recent scientific literature, getting grounded answers with source citations, or
| 1 | # Perplexity Search |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Perform AI-powered web searches using Perplexity models through LiteLLM and OpenRouter. Perplexity provides real-time, web-grounded answers with source citations, making it ideal for finding current information, recent scientific literature, and facts beyond the model's training data cutoff. |
| 6 | |
| 7 | This skill provides access to all Perplexity models through OpenRouter, requiring only a single API key (no separate Perplexity account needed). |
| 8 | |
| 9 | ## When to Use This Skill |
| 10 | |
| 11 | Use this skill when: |
| 12 | - Searching for current information or recent developments (2024 and beyond) |
| 13 | - Finding latest scientific publications and research |
| 14 | - Getting real-time answers grounded in web sources |
| 15 | - Verifying facts with source citations |
| 16 | - Conducting literature searches across multiple domains |
| 17 | - Accessing information beyond the model's knowledge cutoff |
| 18 | - Performing domain-specific research (biomedical, technical, clinical) |
| 19 | - Comparing current approaches or technologies |
| 20 | |
| 21 | **Do not use** for: |
| 22 | - Simple calculations or logic problems (use directly) |
| 23 | - Tasks requiring code execution (use standard tools) |
| 24 | - Questions well within the model's training data (unless verification needed) |
| 25 | |
| 26 | ## Quick Start |
| 27 | |
| 28 | ### Setup (One-time) |
| 29 | |
| 30 | 1. **Get OpenRouter API key**: |
| 31 | - Visit https://openrouter.ai/keys |
| 32 | - Create account and generate API key |
| 33 | - Add credits to account (minimum $5 recommended) |
| 34 | |
| 35 | 2. **Configure environment**: |
| 36 | ```bash |
| 37 | # Set API key |
| 38 | export OPENROUTER_API_KEY='sk-or-v1-your-key-here' |
| 39 | |
| 40 | # Or use setup script |
| 41 | python scripts/setup_env.py --api-key sk-or-v1-your-key-here |
| 42 | ``` |
| 43 | |
| 44 | 3. **Install dependencies**: |
| 45 | ```bash |
| 46 | uv pip install litellm |
| 47 | ``` |
| 48 | |
| 49 | 4. **Verify setup**: |
| 50 | ```bash |
| 51 | python scripts/perplexity_search.py --check-setup |
| 52 | ``` |
| 53 | |
| 54 | See `references/openrouter_setup.md` for detailed setup instructions, troubleshooting, and security best practices. |
| 55 | |
| 56 | ### Basic Usage |
| 57 | |
| 58 | **Simple search:** |
| 59 | ```bash |
| 60 | python scripts/perplexity_search.py "What are the latest developments in CRISPR gene editing?" |
| 61 | ``` |
| 62 | |
| 63 | **Save results:** |
| 64 | ```bash |
| 65 | python scripts/perplexity_search.py "Recent CAR-T therapy clinical trials" --output results.json |
| 66 | ``` |
| 67 | |
| 68 | **Use specific model:** |
| 69 | ```bash |
| 70 | python scripts/perplexity_search.py "Compare mRNA and viral vector vaccines" --model sonar-pro-search |
| 71 | ``` |
| 72 | |
| 73 | **Verbose output:** |
| 74 | ```bash |
| 75 | python scripts/perplexity_search.py "Quantum computing for drug discovery" --verbose |
| 76 | ``` |
| 77 | |
| 78 | ## Available Models |
| 79 | |
| 80 | Access models via `--model` parameter: |
| 81 | |
| 82 | - **sonar-pro** (default): General-purpose search, best balance of cost and quality |
| 83 | - **sonar-pro-search**: Most advanced agentic search with multi-step reasoning |
| 84 | - **sonar**: Basic model, most cost-effective for simple queries |
| 85 | - **sonar-reasoning-pro**: Advanced reasoning with step-by-step analysis |
| 86 | - **sonar-reasoning**: Basic reasoning capabilities |
| 87 | |
| 88 | **Model selection guide:** |
| 89 | - Default queries → `sonar-pro` |
| 90 | - Complex multi-step analysis → `sonar-pro-search` |
| 91 | - Explicit reasoning needed → `sonar-reasoning-pro` |
| 92 | - Simple fact lookups → `sonar` |
| 93 | - Cost-sensitive bulk queries → `sonar` |
| 94 | |
| 95 | See `references/model_comparison.md` for detailed comparison, use cases, pricing, and performance characteristics. |
| 96 | |
| 97 | ## Crafting Effective Queries |
| 98 | |
| 99 | ### Be Specific and Detailed |
| 100 | |
| 101 | **Good examples:** |
| 102 | - "What are the latest clinical trial results for CAR-T cell therapy in treating B-cell lymphoma published in 2024?" |
| 103 | - "Compare the efficacy and safety profiles of mRNA vaccines versus viral vector vaccines for COVID-19" |
| 104 | - "Explain AlphaFold3 improvements over AlphaFold2 with specific accuracy metrics from 2023-2024 research" |
| 105 | |
| 106 | **Bad examples:** |
| 107 | - "Tell me about cancer treatment" (too broad) |
| 108 | - "CRISPR" (too vague) |
| 109 | - "vaccines" (lacks specificity) |
| 110 | |
| 111 | ### Include Time Constraints |
| 112 | |
| 113 | Perplexity searches real-time web data: |
| 114 | - "What papers were published in Nature Medicine in 2024 about long COVID?" |
| 115 | - "What are the latest developments (past 6 months) in large language model efficiency?" |
| 116 | - "What was announced at NeurIPS 2023 regarding AI safety?" |
| 117 | |
| 118 | ### Specify Domain and Sources |
| 119 | |
| 120 | For high-quality results, mention source preferences: |
| 121 | - "According to peer-reviewed publications in high-impact journals..." |
| 122 | - "Based on FDA-approved treatments..." |
| 123 | - "From clinical trial registries like clinicaltrials.gov..." |
| 124 | |
| 125 | ### Structure Complex Queries |
| 126 | |
| 127 | Break com |