ChatCompletion
ChatCompletion
yaml
type: "io.kestra.plugin.anthropic.ChatCompletion"Examples
yaml
id: anthropic_chat_completion
namespace: company.team
tasks:
- id: chat_completion
type: io.kestra.plugin.anthropic.ChatCompletion
apiKey: "{{ secret('ANTHROPIC_API_KEY') }}"
model: "claude-3-5-sonnet-20241022"
maxTokens: 1024
messages:
- type: USER
content: "What is the capital of Japan? Answer with a unique word and without any punctuation."
yaml
id: anthropic_code_generation
namespace: company.team
tasks:
- id: code_generation
type: io.kestra.plugin.anthropic.ChatCompletion
apiKey: "{{ secret('ANTHROPIC_API_KEY') }}"
model: "claude-3-5-sonnet-20241022"
maxTokens: 1500
temperature: 0.3
messages:
- type: USER
content: |
Write a Python function that:
1. Takes a list of numbers as input
2. Filters out negative numbers
3. Calculates the average of remaining positive numbers
4. Returns the result rounded to 2 decimal places
5. Include error handling for empty lists
Also provide 3 test cases with expected outputs.
yaml
id: anthropic_context_conversation
namespace: company.team
tasks:
- id: code_generation
type: io.kestra.plugin.anthropic.ChatCompletion
apiKey: "{{ secret('ANTHROPIC_API_KEY') }}"
model: "claude-3-5-sonnet-20241022"
maxTokens: 800
temperature: 0.5
messages:
- type: USER
content: "Explain quantum computing in simple terms."
- type: ASSISTANT
content: "Quantum computing uses quantum mechanical phenomena like superposition and entanglement to process information differently than classical computers. Instead of bits that are either 0 or 1, quantum computers use quantum bits (qubits) that can exist in multiple states simultaneously."
- type: USER
content: "That is helpful! Can you give me a practical example of how this could be used in everyday life in the next 10 years?"
Properties
apiKey *Requiredstring
messages *Requiredarray
Definitions
io.kestra.plugin.anthropic.ChatCompletion-ChatMessage
contentstring
typestring
Possible Values
ASSISTANTUSERmodel *Requiredstring
maxTokens integerstring
Default
1024system string
temperature numberstring
Default
1.0topK integerstring
topP numberstring
Outputs
outputText string
rawResponse string
Metrics
usage.input.tokens counter
Unit
tokenusage.output.tokens counter
Unit
token