ChatCompletion
ChatCompletion
yaml
type: "io.kestra.plugin.openai.ChatCompletion"Examples
yaml
id: openai_chat
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: What is data orchestration?
tasks:
- id: completion
type: io.kestra.plugin.openai.ChatCompletion
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4o
prompt: "{{ inputs.prompt }}"
- id: log_output
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.completion.choices[0].message.content }}"
yaml
id: openai_chat
namespace: company.team
tasks:
- id: prompt
type: io.kestra.plugin.openai.ChatCompletion
apiKey: "{{ secret('OPENAI_API_KEY') }}"
model: gpt-4o
prompt: Explain in one sentence why data engineers build data pipelines
- id: use_output
type: io.kestra.plugin.core.log.Log
message: "{{ outputs.prompt.choices | jq('.[].message.content') | first }}"
yaml
id: openai_chat
namespace: company.team
inputs:
- id: prompt
type: STRING
defaults: I love your product and would purchase it again!
tasks:
- id: prioritize_response
type: io.kestra.plugin.openai.ChatCompletion
apiKey: "yourOpenAIapiKey"
model: gpt-4o
messages:
- role: user
content: "{{ inputs.prompt }}"
functions:
- name: respond_to_review
description: Given the customer product review provided as input, determines how urgently a reply is required and then provides suggested response text.
parameters:
- name: response_urgency
type: string
description: How urgently this customer review needs a reply. Bad reviews
must be addressed immediately before anyone sees them. Good reviews can
wait until later.
required: true
enumValues:
- reply_immediately
- reply_later
- name: response_text
type: string
description: The text to post online in response to this review.
required: true
- id: response_urgency
type: io.kestra.plugin.core.debug.Return
format: "{{ outputs.prioritize_response | jq('.choices[0].message.tool_calls[0].function.arguments | fromjson | .response_urgency') | first }}"
- id: response_text
type: io.kestra.plugin.core.debug.Return
format: "{{ outputs.prioritize_response | jq('.choices[0].message.tool_calls[0].function.arguments | fromjson | .response_text') | first }}"
Properties
apiKey *Requiredstring
model *Requiredstring
clientTimeout Non-dynamicinteger
Default
10frequencyPenalty numberstring
functionCall string
Default
autofunctions array
Definitions
io.kestra.plugin.openai.ChatCompletion-PluginChatFunction
descriptionstring
namestring
parametersarray
io.kestra.plugin.openai.ChatCompletion-PluginChatFunctionParameter
description*Requiredstring
name*Requiredstring
type*Requiredstring
enumValuesarray
SubTypestring
requiredbooleanstring
jsonResponseSchema string
logitBias object
SubTypeinteger
maxTokens integerstring
messages array
Definitions
io.kestra.plugin.openai.ChatCompletion-ChatMessage
contentstring
namestring
rolestring
n integerstring
Default
1presencePenalty numberstring
prompt string
stop array
SubTypestring
temperature numberstring
Default
1.0topP numberstring
Default
1.0user string
Outputs
choices array
Definitions
com.openai.models.chat.completions.ChatCompletion-Choice
index
com.openai.core.JsonField
logprobs
com.openai.core.JsonField
message
com.openai.core.JsonField
id string
model string
object string
usage
Definitions