44 lines
1.2 KiB
Markdown
44 lines
1.2 KiB
Markdown
|
|
# Perplexity API Skill
|
||
|
|
|
||
|
|
Perplexity AI API integration for OpenClaw. Provides search-enhanced LLM responses with citations.
|
||
|
|
|
||
|
|
## API Details
|
||
|
|
|
||
|
|
- **Endpoint**: `https://api.perplexity.ai/chat/completions`
|
||
|
|
- **Key**: Stored in `config.json`
|
||
|
|
- **Models**: sonar, sonar-pro, sonar-reasoning, sonar-deep-research
|
||
|
|
- **Format**: OpenAI-compatible
|
||
|
|
|
||
|
|
## Usage
|
||
|
|
|
||
|
|
```python
|
||
|
|
from skills.perplexity.scripts.query import query_perplexity
|
||
|
|
|
||
|
|
# Simple query
|
||
|
|
response = query_perplexity("What is quantum computing?")
|
||
|
|
|
||
|
|
# With citations
|
||
|
|
response = query_perplexity("Latest AI news", include_citations=True)
|
||
|
|
|
||
|
|
# Specific model
|
||
|
|
response = query_perplexity("Complex research question", model="sonar-deep-research")
|
||
|
|
```
|
||
|
|
|
||
|
|
## Models
|
||
|
|
|
||
|
|
| Model | Best For | Search Context |
|
||
|
|
|-------|----------|----------------|
|
||
|
|
| sonar | Quick answers, simple queries | Low/Medium/High |
|
||
|
|
| sonar-pro | Complex queries, coding | Medium/High |
|
||
|
|
| sonar-reasoning | Step-by-step reasoning | Medium/High |
|
||
|
|
| sonar-deep-research | Comprehensive research | High |
|
||
|
|
|
||
|
|
## Files
|
||
|
|
|
||
|
|
- `scripts/query.py` - Main query interface
|
||
|
|
- `config.json` - API key storage (auto-created)
|
||
|
|
|
||
|
|
## Privacy Note
|
||
|
|
|
||
|
|
Perplexity API sends queries to Perplexity's servers (not local). Use SearXNG for fully local search.
|