|
| 1 | +import type { IntegrationPlugin } from "../registry"; |
| 2 | +import { registerIntegration } from "../registry"; |
| 3 | +import { PerplexityIcon } from "./icon"; |
| 4 | + |
| 5 | +const perplexityPlugin: IntegrationPlugin = { |
| 6 | + type: "perplexity", |
| 7 | + label: "Perplexity", |
| 8 | + description: "AI-powered search and research with real-time web access", |
| 9 | + |
| 10 | + icon: PerplexityIcon, |
| 11 | + |
| 12 | + formFields: [ |
| 13 | + { |
| 14 | + id: "perplexityApiKey", |
| 15 | + label: "API Key", |
| 16 | + type: "password", |
| 17 | + placeholder: "pplx-...", |
| 18 | + configKey: "apiKey", |
| 19 | + envVar: "PERPLEXITY_API_KEY", |
| 20 | + helpText: "Get your API key from ", |
| 21 | + helpLink: { |
| 22 | + text: "perplexity.ai/settings/api", |
| 23 | + url: "https://www.perplexity.ai/settings/api", |
| 24 | + }, |
| 25 | + }, |
| 26 | + ], |
| 27 | + |
| 28 | + testConfig: { |
| 29 | + getTestFunction: async () => { |
| 30 | + const { testPerplexity } = await import("./test"); |
| 31 | + return testPerplexity; |
| 32 | + }, |
| 33 | + }, |
| 34 | + |
| 35 | + actions: [ |
| 36 | + { |
| 37 | + slug: "search", |
| 38 | + label: "Search Web", |
| 39 | + description: |
| 40 | + "Search the web with AI-powered answers and citations from Perplexity", |
| 41 | + category: "Perplexity", |
| 42 | + stepFunction: "perplexitySearchStep", |
| 43 | + stepImportPath: "search", |
| 44 | + outputFields: [ |
| 45 | + { field: "answer", description: "AI-generated answer to the query" }, |
| 46 | + { field: "citations", description: "Array of source URLs" }, |
| 47 | + { field: "model", description: "Model used for the response" }, |
| 48 | + ], |
| 49 | + configFields: [ |
| 50 | + { |
| 51 | + key: "query", |
| 52 | + label: "Search Query", |
| 53 | + type: "template-input", |
| 54 | + placeholder: "Enter your search query or use {{NodeName.field}}", |
| 55 | + example: "What are the latest developments in AI?", |
| 56 | + required: true, |
| 57 | + }, |
| 58 | + { |
| 59 | + key: "searchFocus", |
| 60 | + label: "Search Focus", |
| 61 | + type: "select", |
| 62 | + defaultValue: "internet", |
| 63 | + options: [ |
| 64 | + { value: "internet", label: "General Web" }, |
| 65 | + { value: "academic", label: "Academic Sources" }, |
| 66 | + { value: "news", label: "News Articles" }, |
| 67 | + { value: "youtube", label: "YouTube" }, |
| 68 | + { value: "reddit", label: "Reddit" }, |
| 69 | + ], |
| 70 | + }, |
| 71 | + ], |
| 72 | + }, |
| 73 | + { |
| 74 | + slug: "ask", |
| 75 | + label: "Ask Question", |
| 76 | + description: |
| 77 | + "Ask a question and get an AI-powered response with web sources", |
| 78 | + category: "Perplexity", |
| 79 | + stepFunction: "perplexityAskStep", |
| 80 | + stepImportPath: "ask", |
| 81 | + outputFields: [ |
| 82 | + { field: "answer", description: "AI-generated answer" }, |
| 83 | + { field: "citations", description: "Array of source URLs" }, |
| 84 | + { field: "model", description: "Model used for the response" }, |
| 85 | + ], |
| 86 | + configFields: [ |
| 87 | + { |
| 88 | + key: "question", |
| 89 | + label: "Question", |
| 90 | + type: "template-textarea", |
| 91 | + placeholder: "Enter your question or use {{NodeName.field}}", |
| 92 | + example: "Explain quantum computing in simple terms", |
| 93 | + rows: 3, |
| 94 | + required: true, |
| 95 | + }, |
| 96 | + { |
| 97 | + key: "systemPrompt", |
| 98 | + label: "System Prompt", |
| 99 | + type: "template-textarea", |
| 100 | + placeholder: "Optional: customize how Perplexity responds", |
| 101 | + rows: 2, |
| 102 | + }, |
| 103 | + { |
| 104 | + key: "model", |
| 105 | + label: "Model", |
| 106 | + type: "select", |
| 107 | + defaultValue: "sonar", |
| 108 | + options: [ |
| 109 | + { value: "sonar", label: "Sonar (Fast)" }, |
| 110 | + { value: "sonar-pro", label: "Sonar Pro (Advanced)" }, |
| 111 | + { value: "sonar-reasoning", label: "Sonar Reasoning (Complex)" }, |
| 112 | + ], |
| 113 | + }, |
| 114 | + ], |
| 115 | + }, |
| 116 | + { |
| 117 | + slug: "research", |
| 118 | + label: "Research Topic", |
| 119 | + description: |
| 120 | + "Conduct deep research on a topic with comprehensive analysis and citations", |
| 121 | + category: "Perplexity", |
| 122 | + stepFunction: "perplexityResearchStep", |
| 123 | + stepImportPath: "research", |
| 124 | + outputFields: [ |
| 125 | + { field: "report", description: "Comprehensive research report" }, |
| 126 | + { field: "citations", description: "Array of source URLs" }, |
| 127 | + { field: "model", description: "Model used for the response" }, |
| 128 | + ], |
| 129 | + configFields: [ |
| 130 | + { |
| 131 | + key: "topic", |
| 132 | + label: "Research Topic", |
| 133 | + type: "template-textarea", |
| 134 | + placeholder: |
| 135 | + "Enter the topic to research or use {{NodeName.field}}", |
| 136 | + example: "The impact of artificial intelligence on healthcare", |
| 137 | + rows: 3, |
| 138 | + required: true, |
| 139 | + }, |
| 140 | + { |
| 141 | + key: "depth", |
| 142 | + label: "Research Depth", |
| 143 | + type: "select", |
| 144 | + defaultValue: "detailed", |
| 145 | + options: [ |
| 146 | + { value: "brief", label: "Brief Overview" }, |
| 147 | + { value: "detailed", label: "Detailed Analysis" }, |
| 148 | + { value: "comprehensive", label: "Comprehensive Report" }, |
| 149 | + ], |
| 150 | + }, |
| 151 | + ], |
| 152 | + }, |
| 153 | + ], |
| 154 | +}; |
| 155 | + |
| 156 | +// Auto-register on import |
| 157 | +registerIntegration(perplexityPlugin); |
| 158 | + |
| 159 | +export default perplexityPlugin; |
0 commit comments