AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
feat(perplexity-ai): ui improvement (#16060)
Talal Jaber4decd2f91305
diff --git a/bun.lock b/bun.lockindex eb3dce39782..e1182de3c2d 100644--- a/bun.lock+++ b/bun.lock@@ -6931,7 +6931,7 @@},"packages/pieces/community/perplexity-ai": {"name": "@activepieces/piece-perplexity-ai",- "version": "0.3.7",+ "version": "0.4.0","dependencies": {"@activepieces/core-piece-types": "workspace:*","@activepieces/core-utils": "workspace:*",@@ -6941,6 +6941,7 @@},"devDependencies": {"tslib": "2.6.2",+ "vitest": "3.2.6",},},"packages/pieces/community/personal-ai": {diff --git a/packages/pieces/community/perplexity-ai/package.json b/packages/pieces/community/perplexity-ai/package.jsonindex f65ddff6995..7aa5f84d302 100644--- a/packages/pieces/community/perplexity-ai/package.json+++ b/packages/pieces/community/perplexity-ai/package.json@@ -1,12 +1,13 @@{"name": "@activepieces/piece-perplexity-ai",- "version": "0.3.7",+ "version": "0.4.0","main": "./dist/src/index.js","types": "./dist/src/index.d.ts","scripts": {"build": "tsc -p tsconfig.lib.json && cp package.json dist/","bundle": "node ../../../../dist/packages/cli/src/index.js pieces bundle",- "lint": "eslint 'src/**/*.ts'"+ "lint": "eslint 'src/**/*.ts'",+ "test": "vitest run"},"dependencies": {"@activepieces/pieces-common": "workspace:*",@@ -16,6 +17,7 @@"@activepieces/core-utils": "workspace:*"},"devDependencies": {- "tslib": "2.6.2"+ "tslib": "2.6.2",+ "vitest": "3.2.6"}}diff --git a/packages/pieces/community/perplexity-ai/src/i18n/de.json b/packages/pieces/community/perplexity-ai/src/i18n/de.jsonindex 74c918cf4f9..d7f4a179ae8 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/de.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/de.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "sonar-Argumentation","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "Präsenzstrafe",+ "Frequency Penalty": "Frequenzstrafe",+ "Longest reply in tokens, about 4 characters each.": "Längste Antwort in Tokens, je etwa 4 Zeichen.",+ "What you want the model to answer or do.": "Was das Modell beantworten oder tun soll.",+ "Messages sent before the question, such as a system instruction.": "Nachrichten, die vor der Frage gesendet werden, z. B. eine Systemanweisung.",+ "From 0 to 1. Adjust this or Temperature, not both.": "Von 0 bis 1. Passen Sie dies oder die Temperatur an, nicht beides.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "Von 0 bis 2. Niedriger ist fokussierter, höher ist abwechslungsreicher.",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "So erhalten Sie Ihren API-Schlüssel:\n1. Öffnen Sie [API Keys](https://console.perplexity.ai/project/keys) in der Perplexity API Console.\n2. Erstellen Sie einen neuen Schlüssel.\n3. Kopieren Sie den Schlüssel und fügen Sie ihn hier ein.",+ "Ask a question and get an answer sourced from the live web.": "Stellen Sie eine Frage und erhalten Sie eine Antwort aus dem aktuellen Web.",+ "Pro models dig deeper and Reasoning models think before answering.": "Pro-Modelle suchen gründlicher und Reasoning-Modelle denken vor der Antwort nach.",+ "Higher values push the model toward new topics.": "Höhere Werte lenken das Modell zu neuen Themen.",+ "Higher values make the model repeat itself less.": "Höhere Werte sorgen dafür, dass sich das Modell seltener wiederholt."}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/es.json b/packages/pieces/community/perplexity-ai/src/i18n/es.jsonindex 7881f27fa02..df894a4e62e 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/es.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/es.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "razonamiento sonar","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "Penalización por presencia",+ "Frequency Penalty": "Penalización por frecuencia",+ "Longest reply in tokens, about 4 characters each.": "Respuesta más larga en tokens, de unos 4 caracteres cada uno.",+ "What you want the model to answer or do.": "Lo que quieres que el modelo responda o haga.",+ "Messages sent before the question, such as a system instruction.": "Mensajes enviados antes de la pregunta, como una instrucción del sistema.",+ "From 0 to 1. Adjust this or Temperature, not both.": "De 0 a 1. Ajusta esto o la temperatura, no ambos.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "De 0 a 2. Más bajo es más preciso, más alto es más variado.",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "Para obtener tu clave de API:\n1. Abre [API Keys](https://console.perplexity.ai/project/keys) en la Perplexity API Console.\n2. Crea una clave nueva.\n3. Copia la clave y pégala aquí.",+ "Ask a question and get an answer sourced from the live web.": "Haz una pregunta y obtén una respuesta basada en la web actual.",+ "Pro models dig deeper and Reasoning models think before answering.": "Los modelos Pro investigan más a fondo y los Reasoning razonan antes de responder.",+ "Higher values push the model toward new topics.": "Los valores más altos llevan al modelo hacia temas nuevos.",+ "Higher values make the model repeat itself less.": "Los valores más altos hacen que el modelo se repita menos."}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/fr.json b/packages/pieces/community/perplexity-ai/src/i18n/fr.jsonindex e8142079153..cc9f5c0818d 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/fr.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/fr.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "sonar-raisonnement","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "Pénalité de présence",+ "Frequency Penalty": "Pénalité de fréquence",+ "Longest reply in tokens, about 4 characters each.": "Réponse la plus longue en jetons, environ 4 caractères chacun.",+ "What you want the model to answer or do.": "Ce que le modèle doit répondre ou faire.",+ "Messages sent before the question, such as a system instruction.": "Messages envoyés avant la question, comme une instruction système.",+ "From 0 to 1. Adjust this or Temperature, not both.": "De 0 à 1. Ajustez ceci ou la température, pas les deux.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "De 0 à 2. Plus bas est plus ciblé, plus haut est plus varié.",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "Pour obtenir votre clé API :\n1. Ouvrez [API Keys](https://console.perplexity.ai/project/keys) dans la Perplexity API Console.\n2. Créez une nouvelle clé.\n3. Copiez la clé et collez-la ici.",+ "Ask a question and get an answer sourced from the live web.": "Posez une question et obtenez une réponse tirée du web en direct.",+ "Pro models dig deeper and Reasoning models think before answering.": "Les modèles Pro creusent davantage et les modèles Reasoning réfléchissent avant de répondre.",+ "Higher values push the model toward new topics.": "Des valeurs plus élevées orientent le modèle vers de nouveaux sujets.",+ "Higher values make the model repeat itself less.": "Des valeurs plus élevées réduisent les répétitions du modèle."}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/ja.json b/packages/pieces/community/perplexity-ai/src/i18n/ja.jsonindex fe1f28927c2..d155c0e49b1 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/ja.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/ja.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "ソナーの推論は","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "存在ペナルティ",+ "Frequency Penalty": "頻度ペナルティ",+ "Longest reply in tokens, about 4 characters each.": "回答の最大長(トークン数)。1 トークンは約 4 文字です。",+ "What you want the model to answer or do.": "モデルに答えてほしいこと、またはしてほしいこと。",+ "Messages sent before the question, such as a system instruction.": "質問の前に送信するメッセージ(システム指示など)。",+ "From 0 to 1. Adjust this or Temperature, not both.": "0 から 1。これか温度のどちらか一方だけを調整してください。",+ "From 0 to 2. Lower is more focused, higher is more varied.": "0 から 2。低いほど的を絞った出力に、高いほど多様な出力になります。",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "API キーの取得方法:\n1. Perplexity API Console で [API Keys](https://console.perplexity.ai/project/keys) を開きます。\n2. 新しいキーを作成します。\n3. キーをコピーしてここに貼り付けます。",+ "Ask a question and get an answer sourced from the live web.": "質問すると、最新のウェブ情報をもとに回答を返します。",+ "Pro models dig deeper and Reasoning models think before answering.": "Pro モデルはより深く調べ、Reasoning モデルは回答前に推論します。",+ "Higher values push the model toward new topics.": "値を大きくすると、モデルは新しい話題に進みやすくなります。",+ "Higher values make the model repeat itself less.": "値を大きくすると、モデルの繰り返しが減ります。"}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/nl.json b/packages/pieces/community/perplexity-ai/src/i18n/nl.jsonindex a98b75c9e36..1c16a202b5d 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/nl.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/nl.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "sonar-redenering","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "Aanwezigheidsstraf",+ "Frequency Penalty": "Frequentiestraf",+ "Longest reply in tokens, about 4 characters each.": "Langste antwoord in tokens, elk ongeveer 4 tekens.",+ "What you want the model to answer or do.": "Wat het model moet beantwoorden of doen.",+ "Messages sent before the question, such as a system instruction.": "Berichten die vóór de vraag worden verstuurd, zoals een systeeminstructie.",+ "From 0 to 1. Adjust this or Temperature, not both.": "Van 0 tot 1. Pas dit of de temperatuur aan, niet allebei.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "Van 0 tot 2. Lager is gerichter, hoger is gevarieerder.",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "Zo krijgt u uw API-sleutel:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in de Perplexity API Console.\n2. Maak een nieuwe sleutel aan.\n3. Kopieer de sleutel en plak hem hier.",+ "Ask a question and get an answer sourced from the live web.": "Stel een vraag en krijg een antwoord op basis van het actuele web.",+ "Pro models dig deeper and Reasoning models think before answering.": "Pro-modellen zoeken grondiger en Reasoning-modellen denken na voordat ze antwoorden.",+ "Higher values push the model toward new topics.": "Hogere waarden sturen het model naar nieuwe onderwerpen.",+ "Higher values make the model repeat itself less.": "Hogere waarden zorgen dat het model zich minder herhaalt."}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/pt.json b/packages/pieces/community/perplexity-ai/src/i18n/pt.jsonindex 6c4bba68a00..a9aff54dc33 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/pt.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/pt.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "raciocínio dos sonares","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "Penalidade de presença",+ "Frequency Penalty": "Penalidade de frequência",+ "Longest reply in tokens, about 4 characters each.": "Resposta mais longa em tokens, cerca de 4 caracteres cada.",+ "What you want the model to answer or do.": "O que você quer que o modelo responda ou faça.",+ "Messages sent before the question, such as a system instruction.": "Mensagens enviadas antes da pergunta, como uma instrução de sistema.",+ "From 0 to 1. Adjust this or Temperature, not both.": "De 0 a 1. Ajuste isto ou a temperatura, não ambos.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "De 0 a 2. Menor é mais focado, maior é mais variado.",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "Para obter sua chave de API:\n1. Abra [API Keys](https://console.perplexity.ai/project/keys) no Perplexity API Console.\n2. Crie uma nova chave.\n3. Copie a chave e cole aqui.",+ "Ask a question and get an answer sourced from the live web.": "Faça uma pergunta e receba uma resposta baseada na web atual.",+ "Pro models dig deeper and Reasoning models think before answering.": "Os modelos Pro pesquisam mais a fundo e os Reasoning raciocinam antes de responder.",+ "Higher values push the model toward new topics.": "Valores mais altos levam o modelo a novos assuntos.",+ "Higher values make the model repeat itself less.": "Valores mais altos fazem o modelo se repetir menos."}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/ru.json b/packages/pieces/community/perplexity-ai/src/i18n/ru.jsonindex d1b7510ff69..998b62c7a0a 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/ru.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/ru.json@@ -21,5 +21,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "звуковое рассуждение","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "Штраф за присутствие",+ "Frequency Penalty": "Штраф за частоту",+ "Longest reply in tokens, about 4 characters each.": "Максимальная длина ответа в токенах, примерно 4 символа каждый.",+ "What you want the model to answer or do.": "Что модель должна ответить или сделать.",+ "Messages sent before the question, such as a system instruction.": "Сообщения, отправляемые перед вопросом, например системная инструкция.",+ "From 0 to 1. Adjust this or Temperature, not both.": "От 0 до 1. Меняйте это или температуру, но не оба.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "От 0 до 2. Ниже — точнее, выше — разнообразнее.",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "Как получить API-ключ:\n1. Откройте [API Keys](https://console.perplexity.ai/project/keys) в Perplexity API Console.\n2. Создайте новый ключ.\n3. Скопируйте ключ и вставьте его сюда.",+ "Ask a question and get an answer sourced from the live web.": "Задайте вопрос и получите ответ на основе актуальных данных из интернета.",+ "Pro models dig deeper and Reasoning models think before answering.": "Модели Pro ищут глубже, а модели Reasoning рассуждают перед ответом.",+ "Higher values push the model toward new topics.": "Чем выше значение, тем чаще модель переходит к новым темам.",+ "Higher values make the model repeat itself less.": "Чем выше значение, тем реже модель повторяется."}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/translation.json b/packages/pieces/community/perplexity-ai/src/i18n/translation.jsonindex 379ecccd08a..2b8cd06d01b 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/translation.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/translation.json@@ -1,24 +1,26 @@{"AI powered search engine": "AI powered search engine",- "\n Navigate to [API Settings](https://www.perplexity.ai/settings/api) and create new API key.\n ": "\n Navigate to [API Settings](https://www.perplexity.ai/settings/api) and create new API key.\n ",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.","Ask AI": "Ask AI",- "Enables users to generate prompt completion based on a specified model.": "Enables users to generate prompt completion based on a specified model.",+ "Ask a question and get an answer sourced from the live web.": "Ask a question and get an answer sourced from the live web.","Model": "Model","Question": "Question","Temperature": "Temperature","Maximum Tokens": "Maximum Tokens","Top P": "Top P",- "Presence penalty": "Presence penalty",- "Frequency penalty": "Frequency penalty",+ "Presence Penalty": "Presence Penalty",+ "Frequency Penalty": "Frequency Penalty","Roles": "Roles",- "The amount of randomness in the response.Higher values are more random, and lower values are more deterministic.": "The amount of randomness in the response.Higher values are more random, and lower values are more deterministic.",- "Please refer [guide](https://docs.perplexity.ai/guides/model-cards) for each model token limit.": "Please refer [guide](https://docs.perplexity.ai/guides/model-cards) for each model token limit.",- "The nucleus sampling threshold, valued between 0 and 1 inclusive. For each subsequent token, the model considers the results of the tokens with top_p probability mass.": "The nucleus sampling threshold, valued between 0 and 1 inclusive. For each subsequent token, the model considers the results of the tokens with top_p probability mass.",- "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the mode's likelihood to talk about new topics.": "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the mode's likelihood to talk about new topics.",- "A multiplicative penalty greater than 0. Values greater than 1.0 penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.": "A multiplicative penalty greater than 0. Values greater than 1.0 penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.",- "Array of roles to specify more accurate response.After the (optional) system message, user and assistant roles should alternate with user then assistant, ending in user.": "Array of roles to specify more accurate response.After the (optional) system message, user and assistant roles should alternate with user then assistant, ending in user.",- "sonar-reasoning-pro": "sonar-reasoning-pro",- "sonar-reasoning": "sonar-reasoning",- "sonar-pro": "sonar-pro",- "sonar": "sonar"+ "Pro models dig deeper and Reasoning models think before answering.": "Pro models dig deeper and Reasoning models think before answering.",+ "What you want the model to answer or do.": "What you want the model to answer or do.",+ "From 0 to 2. Lower is more focused, higher is more varied.": "From 0 to 2. Lower is more focused, higher is more varied.",+ "Longest reply in tokens, about 4 characters each.": "Longest reply in tokens, about 4 characters each.",+ "From 0 to 1. Adjust this or Temperature, not both.": "From 0 to 1. Adjust this or Temperature, not both.",+ "Higher values push the model toward new topics.": "Higher values push the model toward new topics.",+ "Higher values make the model repeat itself less.": "Higher values make the model repeat itself less.",+ "Messages sent before the question, such as a system instruction.": "Messages sent before the question, such as a system instruction.",+ "Sonar": "Sonar",+ "Sonar Pro": "Sonar Pro",+ "Sonar Reasoning": "Sonar Reasoning",+ "Sonar Reasoning Pro": "Sonar Reasoning Pro"}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/i18n/zh.json b/packages/pieces/community/perplexity-ai/src/i18n/zh.jsonindex 131bf8a6b5e..25440b07926 100644--- a/packages/pieces/community/perplexity-ai/src/i18n/zh.json+++ b/packages/pieces/community/perplexity-ai/src/i18n/zh.json@@ -20,5 +20,17 @@"sonar-reasoning-pro": "sonar-reasoning-pro","sonar-reasoning": "sonar-reasoning","sonar-pro": "sonar-pro",- "sonar": "sonar"+ "sonar": "sonar",+ "Presence Penalty": "存在惩罚",+ "Frequency Penalty": "频率惩罚",+ "Longest reply in tokens, about 4 characters each.": "回复的最大长度(以 token 计),每个约 4 个字符。",+ "What you want the model to answer or do.": "希望模型回答或完成的内容。",+ "Messages sent before the question, such as a system instruction.": "在问题之前发送的消息,例如系统指令。",+ "From 0 to 1. Adjust this or Temperature, not both.": "范围 0 到 1。请调整此项或 Temperature,不要同时调整。",+ "From 0 to 2. Lower is more focused, higher is more varied.": "范围 0 到 2。越低越集中,越高越多样。",+ "To get your API key:\n1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.\n2. Create a new key.\n3. Copy the key and paste it here.": "获取 API 密钥的方法:\n1. 在 Perplexity API Console 中打开 [API Keys](https://console.perplexity.ai/project/keys)。\n2. 创建一个新密钥。\n3. 复制密钥并粘贴到这里。",+ "Ask a question and get an answer sourced from the live web.": "提出问题,获取基于实时网络内容的回答。",+ "Pro models dig deeper and Reasoning models think before answering.": "Pro 模型搜索更深入,Reasoning 模型会先推理再回答。",+ "Higher values push the model toward new topics.": "值越高,模型越倾向于谈论新话题。",+ "Higher values make the model repeat itself less.": "值越高,模型重复的内容越少。"}\ No newline at end of filediff --git a/packages/pieces/community/perplexity-ai/src/index.ts b/packages/pieces/community/perplexity-ai/src/index.tsindex 0199e0b8466..9d91a36566a 100644--- a/packages/pieces/community/perplexity-ai/src/index.ts+++ b/packages/pieces/community/perplexity-ai/src/index.ts@@ -6,7 +6,7 @@ import { perplexityAiAuth } from './lib/auth';export const perplexityAi = createPiece({displayName: 'Perplexity AI',auth: perplexityAiAuth,- minimumSupportedRelease: '0.36.1',+ minimumSupportedRelease: '0.88.2',logoUrl: 'https://cdn.activepieces.com/pieces/perplexity-ai.png',categories: [PieceCategory.ARTIFICIAL_INTELLIGENCE],description: 'AI powered search engine',diff --git a/packages/pieces/community/perplexity-ai/src/lib/actions/create-chat-completion.action.ts b/packages/pieces/community/perplexity-ai/src/lib/actions/create-chat-completion.action.tsindex 4368450afc8..618634a9f25 100644--- a/packages/pieces/community/perplexity-ai/src/lib/actions/create-chat-completion.action.ts+++ b/packages/pieces/community/perplexity-ai/src/lib/actions/create-chat-completion.action.ts@@ -1,6 +1,7 @@import { perplexityAiAuth } from '../auth';import {createAction,+ isNil,Property,} from '@activepieces/pieces-framework';@@ -12,7 +13,6 @@ import {import * as z from 'zod/mini'import { propsValidation } from '@activepieces/pieces-common';-export const createChatCompletionAction = createAction({audience: 'both',auth: perplexityAiAuth,@@ -20,78 +20,86 @@ export const createChatCompletionAction = createAction({classification: 'READ',displayName: 'Ask AI',description:- 'Enables users to generate prompt completion based on a specified model.',+ 'Ask a question and get an answer sourced from the live web.',aiMetadata: { description: 'Sends a question to a Perplexity Sonar model, which answers from a live web search with source citations rather than model memory alone, choosing between the plain sonar models for fast grounded answers and the sonar-reasoning models for step-by-step reasoning. It is the only action in this piece; pick it when the reply must reflect current web content, and prefer a general LLM vendor piece such as OpenAI or Google Gemini when no web lookup is needed. Runs stateless - earlier turns must be supplied in the optional roles array, which alternates user and assistant after any system message; requires a model and a question, and is not idempotent: each call runs a new search and produces a fresh completion.', idempotent: false },props: {model: Property.StaticDropdown({displayName: 'Model',+ description:+ 'Pro models dig deeper and Reasoning models think before answering.',required: true,defaultValue:'sonar-pro',options: {disabled: false,options: [- // https://docs.perplexity.ai/guides/model-cards{- label:'sonar-reasoning-pro',- value:'sonar-reasoning-pro'+ label:'Sonar',+ value:'sonar'},{- label:'sonar-reasoning',- value:'sonar-reasoning'+ label:'Sonar Pro',+ value:'sonar-pro'},{- label:'sonar-pro',- value:'sonar-pro'+ label:'Sonar Reasoning',+ value:'sonar-reasoning'},{- label:'sonar',- value:'sonar'+ label:'Sonar Reasoning Pro',+ value:'sonar-reasoning-pro'}],},}),prompt: Property.LongText({displayName: 'Question',+ description: 'What you want the model to answer or do.',+ placeholder: "e.g. Summarize this week's news about electric cars",required: true,}),temperature: Property.Number({displayName: 'Temperature',required: false,+ advanced: true,description:- 'The amount of randomness in the response.Higher values are more random, and lower values are more deterministic.',+ 'From 0 to 2. Lower is more focused, higher is more varied.',defaultValue: 0.2,}),max_tokens: Property.Number({displayName: 'Maximum Tokens',required: false,- description: `Please refer [guide](https://docs.perplexity.ai/guides/model-cards) for each model token limit.`,+ description: 'Longest reply in tokens, about 4 characters each.',}),top_p: Property.Number({displayName: 'Top P',required: false,+ advanced: true,description:- 'The nucleus sampling threshold, valued between 0 and 1 inclusive. For each subsequent token, the model considers the results of the tokens with top_p probability mass.',+ 'From 0 to 1. Adjust this or Temperature, not both.',defaultValue: 0.9,}),presence_penalty: Property.Number({- displayName: 'Presence penalty',+ displayName: 'Presence Penalty',required: false,+ advanced: true,description:- "Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the mode's likelihood to talk about new topics.",+ 'Higher values push the model toward new topics.',defaultValue: 0,}),frequency_penalty: Property.Number({- displayName: 'Frequency penalty',+ displayName: 'Frequency Penalty',required: false,+ advanced: true,description:- "A multiplicative penalty greater than 0. Values greater than 1.0 penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.",+ 'Higher values make the model repeat itself less.',defaultValue: 1.0,}),roles: Property.Json({displayName: 'Roles',required: false,+ advanced: true,description:- 'Array of roles to specify more accurate response.After the (optional) system message, user and assistant roles should alternate with user then assistant, ending in user.',+ 'Messages sent before the question, such as a system instruction.',defaultValue: [{ role: 'system', content: 'You are a helpful assistant.' },],@@ -100,7 +108,9 @@ export const createChatCompletionAction = createAction({async run(context) {await propsValidation.validateZod(context.propsValue, {temperature: z.optional(z.number().check(z.minimum(0), z.maximum(2))),+ max_tokens: z.nullish(z.int().check(z.minimum(1))),});+ const maxTokens = context.propsValue.max_tokens;const rolesArray = context.propsValue.roles? (context.propsValue.roles as any)@@ -134,6 +144,7 @@ export const createChatCompletionAction = createAction({body: {model: context.propsValue.model,messages: roles,+ ...(isNil(maxTokens) ? {} : { max_tokens: maxTokens }),temperature: context.propsValue.temperature,top_p: context.propsValue.top_p,presence_penalty: context.propsValue.presence_penalty,diff --git a/packages/pieces/community/perplexity-ai/src/lib/auth.ts b/packages/pieces/community/perplexity-ai/src/lib/auth.tsindex f54f8fc6ce2..9afa97d4f23 100644--- a/packages/pieces/community/perplexity-ai/src/lib/auth.ts+++ b/packages/pieces/community/perplexity-ai/src/lib/auth.ts@@ -3,7 +3,8 @@ import { PieceAuth } from '@activepieces/pieces-framework';export const perplexityAiAuth = PieceAuth.SecretText({displayName: 'API Key',required: true,- description: `- Navigate to [API Settings](https://www.perplexity.ai/settings/api) and create new API key.- `,+ description: `To get your API key:+1. Open [API Keys](https://console.perplexity.ai/project/keys) in the Perplexity API Console.+2. Create a new key.+3. Copy the key and paste it here.`,});diff --git a/packages/pieces/community/perplexity-ai/test/ask-ai.test.ts b/packages/pieces/community/perplexity-ai/test/ask-ai.test.tsnew file mode 100644index 00000000000..da6c37f67c3--- /dev/null+++ b/packages/pieces/community/perplexity-ai/test/ask-ai.test.ts@@ -0,0 +1,68 @@+import { beforeEach, describe, expect, it, vi } from 'vitest';+import { createChatCompletionAction } from '../src/lib/actions/create-chat-completion.action';++const sendRequest = vi.fn();++vi.mock('@activepieces/pieces-common', async (importOriginal) => {+ const actual = await importOriginal<typeof import('@activepieces/pieces-common')>();+ return {+ ...actual,+ httpClient: { sendRequest: (...args: unknown[]) => sendRequest(...args) },+ };+});++beforeEach(() => {+ sendRequest.mockReset();+ sendRequest.mockResolvedValue({+ status: 200,+ headers: {},+ body: { choices: [{ message: { content: 'answer' } }], citations: ['https://example.com'] },+ });+});++describe('Ask AI', () => {+ it('sends Maximum Tokens when it is set', async () => {+ await runAskAi({ max_tokens: 256 });+ expect(requestBody()).toMatchObject({ max_tokens: 256 });+ });++ it('leaves Maximum Tokens out of the request when it is empty', async () => {+ await runAskAi({ max_tokens: undefined });+ await runAskAi({ max_tokens: null });+ expect(requestBody(0)).not.toHaveProperty('max_tokens');+ expect(requestBody(1)).not.toHaveProperty('max_tokens');+ });++ it('rejects a Maximum Tokens value that is not a positive whole number', async () => {+ for (const max_tokens of [0, -5, 2.5]) {+ await expect(runAskAi({ max_tokens })).rejects.toThrow('max_tokens');+ }+ expect(sendRequest).not.toHaveBeenCalled();+ });++ it('returns the answer and its citations', async () => {+ await expect(runAskAi({})).resolves.toEqual({ result: 'answer', citations: ['https://example.com'] });+ });+});++function runAskAi(overrides: Record<string, unknown>): Promise<unknown> {+ const propsValue = {+ model: 'sonar-pro',+ prompt: 'What is new today?',+ temperature: 0.2,+ top_p: 0.9,+ presence_penalty: 0,+ frequency_penalty: 1,+ roles: [{ role: 'system', content: 'You are a helpful assistant.' }],+ ...overrides,+ };+ return Promise.resolve(+ Reflect.apply(createChatCompletionAction.run, createChatCompletionAction, [+ { propsValue, auth: { secret_text: 'test-key' } },+ ]),+ );+}++function requestBody(index = 0): unknown {+ return sendRequest.mock.calls[index][0].body;+}diff --git a/packages/pieces/community/perplexity-ai/vitest.config.ts b/packages/pieces/community/perplexity-ai/vitest.config.tsnew file mode 100644index 00000000000..79c97261904--- /dev/null+++ b/packages/pieces/community/perplexity-ai/vitest.config.ts@@ -0,0 +1,19 @@+import path from 'path'+import { defineConfig } from 'vitest/config'++const repoRoot = path.resolve(__dirname, '../../../..')++export default defineConfig({+ root: __dirname,+ test: {+ globals: true,+ environment: 'node',+ include: ['test/**/*.test.ts'],+ },+ resolve: {+ alias: {+ '@activepieces/pieces-framework': path.resolve(repoRoot, 'packages/pieces/framework/src/index.ts'),+ '@activepieces/pieces-common': path.resolve(repoRoot, 'packages/pieces/common/src/index.ts'),+ },+ },+})