Skip to content

Conversation

@michelle0927
Copy link
Collaborator

@michelle0927 michelle0927 commented Oct 14, 2025

Resolves #18642

Summary by CodeRabbit

  • New Features
    • Added an Advanced Chat Completions action with fine-grained controls (temperature, top_p, max tokens, streaming), search options (domain/recency filters, top_k), and options to return images and related questions. Supports multi-message inputs and a simple single-turn mode.
  • Documentation
    • Updated the Chat Completions action description link to the latest API reference.
  • Chores
    • Bumped component version and upgraded platform dependency for improved compatibility.

@vercel
Copy link

vercel bot commented Oct 14, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
pipedream-docs Ignored Ignored Oct 14, 2025 5:50pm
pipedream-docs-redirect-do-not-edit Ignored Ignored Oct 14, 2025 5:50pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 14, 2025

Walkthrough

Adds a new Perplexity "Chat Completions (Advanced)" action with multi-message support and Perplexity search controls, updates metadata/version for the existing chat-completions action, and bumps the Perplexity component package version and @pipedream/platform dependency.

Changes

Cohort / File(s) Summary
Advanced Chat Completions Action (new)
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs
New action exporting metadata and props (model, messages, system, role, content, generation knobs, Perplexity search controls). Builds messages array (accepts JSON strings or objects, injects system, single-turn fallback), assembles payload, calls app.chatCompletions({ $, data }), exports summary, and returns response.
Existing Action Metadata Update
components/perplexity/actions/chat-completions/chat-completions.mjs
Non-functional metadata changes: description URL updated to api-reference/chat-completions-post and version bumped from 0.0.60.0.7.
Package / Dependency Bump
components/perplexity/package.json
Component package version bumped from 0.1.40.2.0; @pipedream/platform dependency updated from ^1.6.5^3.1.0.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant User as User Input
  participant Action as Chat Completions (Advanced)
  participant App as Perplexity App Client
  participant API as Perplexity API

  User->>Action: Provide props (model, messages[] or system+role+content, knobs, search controls)
  Note over Action: Build messages[] (parse JSON strings or use objects, inject system, fallback to single-turn)
  Action->>Action: Assemble data payload (model, messages, temperature/top_p/max_tokens/stream, search filters, top_k, return_images/related_questions)
  Action->>App: chatCompletions({ $, data })
  App->>API: POST /chat/completions
  API-->>App: Response (optionally streamed)
  App-->>Action: Final response
  Action-->>User: Return response and export $summary (notes streaming if set)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I twitch my whiskers, patch and patch,
New messages hop in—multi-turn batch.
Domains and recency, filters in tow,
Streams buffered nicely, tokens in a row.
A happy rabbit stamps: go ship that patch! 🐇✨

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Out of Scope Changes Check ⚠️ Warning The PR includes metadata updates to the existing chat-completions action and a version and dependency bump in the components/perplexity package.json that are not part of the linked issue’s objectives, which focused solely on adding the advanced chat-completions action and its props. Please isolate or remove the chat-completions metadata changes and the package.json version and dependency bump into a separate PR or provide justification for including them in this change set.
Description Check ⚠️ Warning The PR description only includes a reference to the linked issue and does not follow the repository’s required template, missing the ## WHY section and any explanation of the motivation behind the changes. Please update the PR description to include the template’s ## WHY section with a clear explanation of the motivation for adding the advanced chat completions action and any relevant context for reviewers.
✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title clearly specifies the addition of the new Perplexity Chat Completions (Advanced) action and concisely summarizes the primary change introduced by this PR.
Linked Issues Check ✅ Passed Implementation meets all coding objectives from linked issue #18642 by introducing the required props for multi-message support, system message injection, required model selection, OpenAI-compatible generation controls, Perplexity-specific search parameters, and fallback role/content logic while constructing the payload with only provided parameters and invoking the API as specified.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch issue-18642

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1c2d0a5 and ede64b4.

📒 Files selected for processing (1)
  • components/perplexity/package.json (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
  • GitHub Check: Verify TypeScript components
  • GitHub Check: Publish TypeScript components

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (3)
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (3)

22-27: messages type should be object[] for proper UI/validation (not string[]).

Current type is string[] but code also accepts objects. Use object[] with explicit schema for a better UX and safer validation.

Apply:

-    messages: {
-      type: "string[]",
-      label: "Messages (JSON strings or UI collection)",
-      description: "Array of message objects: [{ role: 'system'|'user'|'assistant', content: '...' }, ...]. If provided, 'role' and 'content' are ignored.",
-      optional: true,
-    },
+    messages: {
+      type: "object[]",
+      label: "Messages",
+      description: "Array of message objects. If provided, 'role' and 'content' are ignored.",
+      optional: true,
+      properties: {
+        role: {
+          type: "string",
+          label: "Role",
+          description: "Message role",
+          options: ["system", "user", "assistant"],
+          default: "user",
+        },
+        content: {
+          type: "string",
+          label: "Content",
+        },
+      },
+    },

114-117: Harden parsing of JSON strings.

Uncaught JSON.parse errors will be opaque. Add a guard for clearer user feedback.

-      messages = this.messages.map((m) =>
-        typeof m === "string"
-          ? JSON.parse(m)
-          : m);
+      messages = this.messages.map((m, idx) => {
+        if (typeof m !== "string") return m;
+        try {
+          return JSON.parse(m);
+        } catch (err) {
+          throw new Error(`Invalid JSON at messages[${idx}]: ${err.message}`);
+        }
+      });

80-84: Prefer enum options for searchRecencyFilter.

Expose allowed values to users to prevent invalid inputs.

-    searchRecencyFilter: {
-      type: "string",
-      label: "Search Recency Filter",
-      description: "Prefer recent sources (e.g., 'day', 'week', 'month', 'year')",
-      optional: true,
-    },
+    searchRecencyFilter: {
+      type: "string",
+      label: "Search Recency Filter",
+      description: "Prefer recent sources",
+      options: ["day", "week", "month", "year"],
+      optional: true,
+    },
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ca56be6 and 1c2d0a5.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (1 hunks)
  • components/perplexity/actions/chat-completions/chat-completions.mjs (1 hunks)
  • components/perplexity/package.json (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (1)
components/perplexity/actions/chat-completions/chat-completions.mjs (1)
  • response (36-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Lint Code Base
  • GitHub Check: pnpm publish
  • GitHub Check: Publish TypeScript components
  • GitHub Check: Ensure component commits modify component versions
  • GitHub Check: Verify TypeScript components
🔇 Additional comments (4)
components/perplexity/actions/chat-completions/chat-completions.mjs (1)

6-7: LGTM: metadata update only.

URL and version bump look good; no runtime changes.

components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (2)

6-8: Version mismatch with PR description.

File declares version "0.0.1" but PR mentions "1.0.0". Align version or PR text before merge.


66-72: Streaming behavior confirmed. The stream flag is passed through to the Perplexity API but, since the Pipedream axios wrapper doesn’t implement SSE handling (no responseType: 'stream'), responses are fully buffered and returned as final text, exactly as described.

components/perplexity/package.json (1)

16-16: Verify @pipedream/platform v3.1.0 compatibility across Perplexity. Ensure axios, prop definitions, annotations, and method signatures in perplexity.app.mjs, chat-completions.mjs, and chat-completions-advanced.mjs behave as in v1.x.

Copy link
Collaborator

@luancazarine luancazarine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @michelle0927, LGTM! Ready for QA!

@vunguyenhung vunguyenhung merged commit e69be29 into master Oct 15, 2025
10 checks passed
@vunguyenhung vunguyenhung deleted the issue-18642 branch October 15, 2025 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ACTION] Perplexity - add Props

3 participants