ChatCompletion ChatCompletion
ChatCompletion Certified

Send chat completion to Perplexity

yaml
type: io.kestra.plugin.perplexity.ChatCompletion
yaml
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

yaml
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" }
        }
      }

yaml
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
Definitions
contentstring
typestring
Possible Values
SYSTEMASSISTANTUSER
Default0.0
Default0.0
Defaultfalse
Default0.2
Default0
Default0.9