New to Kestra?
Use blueprints to kickstart your first workflows.
Extract structured JSON from unstructured text with a local Ollama model in Kestra. Parse the fields into typed outputs and post the verdict to Discord.
The most useful LLM output is not prose, it is fields your systems can act on. This blueprint runs io.kestra.plugin.ollama.cli.OllamaCLI with Ollama's JSON mode to extract product, sentiment, and priority from a raw customer message, entirely on your own hardware. A Python task then does what pipelines should always do with model output: parse it, validate it, and emit clean scalars that downstream tasks and notifications can trust. Nothing in the message ever touches a cloud API.
extract (io.kestra.plugin.ollama.cli.OllamaCLI) receives the customer message as an inline inputFiles entry and runs ollama run {{ inputs.model }} --format json with a prompt that names the exact keys and allowed values. The --format json flag constrains the model to emit valid JSON, and the answer is redirected to extracted.json, which outputFiles uploads to internal storage.enableModelCaching: true persists the pulled model between runs, so repeated triage executions skip the download.parse_fields (io.kestra.plugin.scripts.python.Script on the Process task runner) maps the JSON file in through inputFiles, parses it with the standard library, and prints the priority and sentiment through Kestra's ::{"outputs": {...}}:: protocol, turning model output into typed task outputs.notify interpolates only those validated scalars into the Discord payload, so a model that wraps its answer in prose or quotes can fail loudly in the parser instead of corrupting a message.errors block alerts on any failure, including unparseable model output.If conditions, subflows, or database writes.extracted.json preserved as an execution artifact for auditing what the model actually said.JSON mode gets you valid JSON, not correct JSON. The pipeline shape matters: Kestra passes the model's file to a parser through internal storage, the parser promotes fields to typed outputs, and the notification consumes only those outputs. Each seam is observable, each task retries independently, and the execution history keeps both the raw model answer and the parsed verdict for every message ever triaged.
containerImage runs Ollama inside Docker, so the Kestra worker needs access to a Docker daemon. On self-hosted workers that already have Ollama installed locally, set the task's taskRunner to Process to use the local install directly.Process task runner on the worker, or switch the parse task to its default Docker runner.DISCORD_WEBHOOK_URL: Discord incoming webhook URL.DISCORD_WEBHOOK_URL secret to your Kestra namespace.ticket.txt with real text from your queue, or map it from a previous task's output.If task, paging on high and queueing the rest.