Mistral ChatCompletion

Mistral ChatCompletion

Certified

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.

yaml
type: io.kestra.plugin.mistral.ChatCompletion

Basic Mistral chat

yaml
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)

yaml
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

API key

Bearer token for the Mistral API; keep in a secret variable.

Messages

Chat messages rendered by the RunContext in order; each message needs a type (system, user, assistant) and content.

Definitions
contentstring
typestring
Possible Values
SYSTEMASSISTANTUSER

Model name

Mistral model identifier such as mistral-small, mistral-medium, mistral-large-latest, or ministral variants.

Defaulthttps://api.mistral.ai/v1

Base URL

API base URL; defaults to https://api.mistral.ai/v1.

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.

Reference (ref) of the pluginDefaults to apply to this task.

Raw response body returned by the Mistral API

Assistant response text extracted from the completion