perplexity-reference-architecture
Implement Perplexity reference architecture with best-practice project layout. Use when designing new Perplexity integrations, reviewing project structure, or establishing architecture standards for Perplexity applications. Trigger with phrases like "perplexity architecture", "perplexity best practices", "perplexity project structure", "how to organize perplexity", "perplexity layout".
- License 许可
- MIT
- 最近更新
- 2026-03-20
- Stars
- ★ 4
- Forks
- 0
01 前言 Front Matter
- name
- perplexity-reference-architecture
- author
- Jeremy Longshore <jeremy@intentsolutions.io>
- license
- MIT
- version
- 1.0.0
- description
- Implement Perplexity reference architecture with best-practice project layout. Use when designing new Perplexity integrations, reviewing project structure, or establishing architecture standards for Perplexity applications. Trigger with phrases like "perplexity architecture", "perplexity best practices", "perplexity project structure", "how to organize perplexity", "perplexity layout".
- allowed-tools
- Read, Grep
- compatible-with
- claude-code, codex, openclaw
02 资源文件 1
- 参考文档references/implementation.md3.7 KB
03 SKILL.md 正文
Perplexity Reference Architecture
Contents
Overview
Production architecture for AI-powered research and search with Perplexity Sonar API. Covers model routing for cost/quality tradeoffs, citation extraction, multi-query research pipelines, and conversational search.
Prerequisites
- Perplexity API key (Sonar access)
- OpenAI-compatible client library
- Understanding of search models (sonar, sonar-pro, sonar-reasoning)
Architecture
Application Layer (Research Agent, Fact Checker, Content Writer)
|
Search Router (sonar/sonar-pro/sonar-reasoning)
|
Citation Pipeline (Extract URLs, Validate, Store, Render)
|
Cache Layer (Query Hash -> Result, TTL by freshness need)
Instructions
Step 1: Set Up Search Service with Model Routing
Use OpenAI-compatible client pointed at api.perplexity.ai. Route queries by depth: quick/standard (sonar), deep (sonar-pro), reasoning (sonar-reasoning).
Step 2: Build Citation Extraction Pipeline
Parse response text for [N] URL patterns and inline URLs. Deduplicate and store citations with metadata.
Step 3: Create Research Pipeline
Multi-phase: broad overview (fast model) -> identify subtopics -> deep dive each (sonar-pro) -> deduplicate citations.
Step 4: Implement Conversational Search
Maintain message history for follow-up questions that build on previous context.
See detailed implementation for search service, citation extraction, multi-query research pipeline, conversational session, and fact-check service code.
Output
- Search service with model routing by query depth
- Citation extraction from responses
- Multi-query research pipeline
- Conversational search with context
Error Handling
| Issue | Cause | Solution |
|---|---|---|
| No citations returned | Using basic sonar for complex query | Upgrade to sonar-pro |
| Stale information | Outdated sources | Add recency preference in system prompt |
| High cost | Using sonar-pro for simple queries | Route simple queries to sonar |
| Rate limit | Too many concurrent searches | Add request queue with delays |
Examples
Quick Fact Check
const result = await factCheck("The Earth is approximately 4.5 billion years old");
console.log(result.verdict); // Accurate, with sources
console.log(result.sources); // Citation URLs
Resources
04 同仓库更多 Skills
azure-apim-architecture
Analyzes and explains Azure API Management architecture decisions for enterprise API marketplace implementations using VNet Internal mode, Front Door, hybrid authentication, and multi-environment strategies. Use when discussing APIM component selection, network topology, cost optimization, or comparing alternatives like workspaces vs instances, VNet Internal vs External mode, or Front Door vs Application Gateway.
apiops-deployment
Guides deployment of Azure API Management infrastructure using Infrastructure as Code (Bicep/Terraform), CI/CD pipelines (GitHub Actions/Azure DevOps), and APIOps workflows. Use when deploying APIM, creating pipelines, or implementing dev→test→prod promotion strategies.
apim-policy-authoring
Creates production-ready Azure API Management policy XML for authentication (OAuth 2.0, JWT validation, subscription keys), rate limiting, CORS configuration, error handling, and API transformations. Use when implementing API security, access control, or request/response processing logic.
api-security-review
Reviews Azure API Management configurations for security vulnerabilities, OWASP API Security Top 10 compliance, VNet Internal mode validation, Private Link verification, and Azure Security Benchmark alignment. Use when performing security audits, pre-deployment validation, or compliance reviews.
jira-cli
Interact with Jira from the command line to create, list, view, edit, and transition issues, manage sprints and epics, and perform common Jira workflows. Use when the user asks about Jira tasks, tickets, issues, sprints, or needs to manage project work items.
calculator
Performs arbitrary-precision arithmetic calculations including addition, subtraction, multiplication, division, and exponents. Use when the user asks to calculate, compute, or evaluate math expressions, or when precise decimal arithmetic is needed to avoid floating-point errors.