View as Markdown
Perplexity icon

Perplexity ACTION

Chat Completions (Advanced)

Generates a model's response for the given chat conversation with multi-message support and Perplexity search controls. Docs: https://docs.perplexity.ai/api-reference/chat-completions-post
  • Action
  • Writes data
  • API key
  • SDK
  • MCP

IMPLEMENTATION

Call this tool

Connect a user's Perplexity account once, then configure and run Chat Completions (Advanced) from your backend or agent.

import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "perplexity-chat-completions-advanced",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    perplexity: { authProvisionId: "apn_xxxxxxx" },
    model: "Model",
    messages: ["Messages (JSON strings or UI collection)"],
  },
})

console.log(result)

SCHEMA

Inputs

Pipedream supplies the connected account. Your application provides the operation-specific values below. Dynamic inputs are resolved against that user's account.

Chat Completions (Advanced) inputs
Property Type Description
model Model string
The name of the model that will complete your prompt
Required
messages Messages (JSON strings or UI collection) string[]
Array of message objects: [{ role: 'system'|'user'|'assistant', content: '...' }, ...]. If provided, 'role' and 'content' are ignored.
Optional
system System string
Optional system prompt injected as the first message
Optional
role Role string
The role of the speaker in this turn of conversation. After the (optional) system message, user and assistant roles should alternate with 'user' then 'assistant', ending in 'user'.
Optional
content Content string
The contents of the message in this turn of conversation
Optional
temperature Temperature string
Sampling temperature. Higher values = more diverse output.
Optional
topP Top-p string
Nucleus sampling probability mass. Use either temperature or top_p.
Optional
maxTokens Max Output Tokens integer
Cap response length (Sonar Pro practical max output ~8k).
Optional
stream Stream boolean
Enable server-side streaming. This action will still buffer and return the final text.
Optional
searchDomainFilter Search Domain Filter string[]
Limit web search to these domains (e.g., ['sec.gov','ft.com'])
Optional
searchRecencyFilter Search Recency Filter string
Prefer recent sources (e.g., 'day', 'week', 'month', 'year')
Optional
topK Top K integer
Restrict number of retrieved items considered
Optional
returnImages Return Images boolean
Ask API to include images when applicable
Optional
returnRelatedQuestions Return Related Questions boolean
Ask API to include related questions in response
Optional

REFERENCE

Tool details

Behavior hints are published with the component in the Pipedream registry and surface as MCP tool annotations, so an agent can reason about a tool before it calls it.

Registry key
perplexity-chat-completions-advanced
Version
0.0.4
App
Perplexity
Authentication
API key
Read-only
No
Destructive
No
Open world
Yes