
Mistral ChatCompletion
CertifiedSend chat completions to Mistral
Mistral ChatCompletion
Send chat completions to Mistral
Calls Mistral's /chat/completions endpoint with templated messages, returning the first choice's content and raw JSON. Requires a bearer API key; defaults to https://api.mistral.ai/v1. When a JSON schema is provided, the task wraps it in the json_schema response_format with strict=true.
type: io.kestra.plugin.mistral.ChatCompletionExamples
Basic Mistral chat
id: mistral
namespace: company.team
tasks:
- id: chat_completion
type: io.kestra.plugin.mistral.ChatCompletion
apiKey: "{{ secret('MISTRAL_API_KEY') }}"
modelName: open-mistral-7b
messages:
- type: SYSTEM
content: You are a helpful assistant, answer concisely, avoid overly casual language or unnecessary verbosity.
- type: USER
content: "What is the capital of France?"
Mistral chat with Structured Output (JSON schema)
id: mistral_structured
namespace: company.team
tasks:
- id: chat_completion_structured
type: io.kestra.plugin.mistral.ChatCompletion
apiKey: "{{ secret('MISTRAL_API_KEY') }}"
modelName: "ministral-8b-latest"
messages:
- type: SYSTEM
content: "Extract the books information."
- type: USER
content: "I recently read 'To Kill a Mockingbird' by Harper Lee."
jsonResponseSchema: |
{
"type": "object",
"title": "Book",
"additionalProperties": false,
"required": ["name", "authors"],
"properties": {
"name": { "type": "string", "title": "Name" },
"authors": { "type": "array", "title": "Authors", "items": { "type": "string" } }
}
}
Properties
apiKey *Requiredstring
API key
Bearer token for the Mistral API; keep in a secret variable.
messages *Requiredarray
Messages
Chat messages rendered by the RunContext in order; each message needs a type (system, user, assistant) and content.
io.kestra.plugin.mistral.ChatCompletion-ChatMessage
SYSTEMASSISTANTUSERmodelName *Requiredstring
Model name
Mistral model identifier such as mistral-small, mistral-medium, mistral-large-latest, or ministral variants.
baseUrl string
https://api.mistral.ai/v1Base URL
API base URL; defaults to https://api.mistral.ai/v1.
jsonResponseSchema string
JSON Response Schema
Optional JSON schema string to request structured output; wrapped as response_format.type=json_schema with name=kestra_schema and strict=true. The returned content stays a JSON string for compatibility.
Outputs
raw string
Raw response body returned by the Mistral API
response string
Assistant response text extracted from the completion