 ChatCompletion
ChatCompletion
type: "io.kestra.plugin.perplexity.ChatCompletion"Examples
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" }
        }
      }
Properties
apiKey *Requiredstring
API Key
The Perplexity API key used for authentication.
model *Requiredstring
Model
The Perplexity model to use (e.g., sonar, sonar-pro).
frequencyPenalty numberstring
0.0Frequency Penalty
Decreases likelihood of repetition based on prior frequency. Valued between 0 and 2.0.
jsonResponseSchema string
JSON Response Schema
JSON schema (as string) to force a custom Structured Output. If provided, the request will include response_format = { type: "json_schema", json_schema: { schema: 
maxTokens integerstring
The maximum number of tokens to generate.
presencePenalty numberstring
0.0Presence Penalty
Positive values increase the likelihood of discussing new topics. Valued between 0 and 2.0.
stream booleanstring
falseStream
Determines whether to stream the response incrementally.
temperature numberstring
0.2Temperature
The amount of randomness in the response, valued between 0 and 2.
topK integerstring
0Top K
The number of tokens to keep for top-k filtering.
topP numberstring
0.9Top P
The nucleus sampling threshold, valued between 0 and 1.
Outputs
outputText string
The generated text output
rawResponse string
Full, raw response from the API.
Definitions
io.kestra.plugin.perplexity.ChatCompletion-ChatMessage
content string
type string
SYSTEMASSISTANTUSER