
Perplexity ChatCompletion
CertifiedSend chat completion to Perplexity
Perplexity ChatCompletion
Send chat completion to Perplexity
Calls Perplexity /chat/completions with rendered messages and returns the first choice. Requires an API key bearer token; defaults: temperature 0.2, top_p 0.9, top_k 0, stream false, penalties 0.0. Supports optional JSON Schema structured output via response_format.
type: io.kestra.plugin.perplexity.ChatCompletionExamples
Ask a question to Perplexity
id: perplexity_chat
namespace: company.team
tasks:
- id: ask_ai
type: io.kestra.plugin.perplexity.ChatCompletion
apiKey: "{{ secret('PERPLEXITY_API_KEY') }}"
model: sonar
messages:
- type: USER
content: "What is Kestra?"
temperature: 0.7
Perplexity chat with Structured Output (JSON Schema)
id: perplexity_structured
namespace: company.name
tasks:
- id: chat_completion_structured
type: io.kestra.plugin.perplexity.ChatCompletion
apiKey: "{{ secret('PERPLEXITY_API_KEY') }}"
model: sonar
messages:
- type: USER
content: "Make a JSON todo from this casual note: schedule team check-in next week; tags: work, planning;"
jsonResponseSchema: |
{
"type": "object",
"additionalProperties": false,
"required": ["title", "done", "tags"],
"properties": {
"title": { "type": "string" },
"done": { "type": "boolean" },
"tags": { "type": "array", "items": { "type": "string" } },
"notes": { "type": "string" }
}
}
System prompt with length and repetition controls
id: perplexity_guarded
namespace: company.team
tasks:
- id: chat_completion_guarded
type: io.kestra.plugin.perplexity.ChatCompletion
apiKey: "{{ secret('PERPLEXITY_API_KEY') }}"
model: sonar-pro
messages:
- type: SYSTEM
content: "You are a brief release-notes generator."
- type: USER
content: "Summarize changes: added metrics; fixed retry bug; improved docs."
maxTokens: 120
presencePenalty: 0.8
frequencyPenalty: 0.6
Properties
apiKey *Requiredstring
Perplexity API key
Bearer token sent in the Authorization header; store as a secret.
messages *Requiredarray
Conversation messages
Ordered chat turns; roles are mapped to system, assistant, or user before sending.
io.kestra.plugin.perplexity.ChatCompletion-ChatMessage
SYSTEMASSISTANTUSERmodel *Requiredstring
Model name
Model identifier accepted by Perplexity (for example sonar, sonar-pro).
frequencyPenalty numberstring
0.0Frequency Penalty
Penalty based on token frequency; range 0–2; default 0.0.
jsonResponseSchema string
JSON Response Schema
JSON Schema string for Structured Output; passed as response_format with type: json_schema and json_schema.schema set to the provided document.
maxTokens integerstring
Maximum tokens
Upper bound on completion tokens; omit to let the model decide.
pluginDefaultsRef Non-dynamicstring
Reference (ref) of the pluginDefaults to apply to this task.
presencePenalty numberstring
0.0Presence Penalty
Penalty for repeating topics; range 0–2; default 0.0.
stream booleanstring
falseStream
Passes stream to the API; keep false (default) because the task reads only the final response body.
temperature numberstring
0.2Temperature
Randomness factor between 0 and 2; default 0.2.
topK integerstring
0Top K
Top-k filter size; 0 keeps all tokens (default).
topP numberstring
0.9Top P
Nucleus sampling probability cap (0–1); default 0.9.
Outputs
outputText string
Completion text
First choice message.content returned by Perplexity.
rawResponse string
Raw response
Full JSON payload returned by the Perplexity API as a string.