Batch Ticket Classification with a Local Ollama Model
A shell loop inside one OllamaCLI task classifies every line of an input file with a local model, producing a CSV artifact and a Slack count report.
Classify customer messages with the HuggingFace Inference API and write the predicted category back to Postgres.
Triage incoming customer messages automatically with zero-shot text classification. This blueprint reads a customer message from a Postgres database, sends it to the HuggingFace Inference API using the facebook/bart-large-mnli model, and writes the predicted category back to the same row. It solves the problem of manually routing support, warranty, upsell, and help requests by turning free-text messages into structured labels your downstream systems can act on, no model training or hosting required.
message_id input identifying the customer message to classify.retrieve_data task (io.kestra.plugin.jdbc.postgresql.Query) runs a SELECT against customer.message with fetchType: FETCH_ONE to fetch the user_id and message text.classification task (io.kestra.plugin.huggingface.Inference) sends the message to the facebook/bart-large-mnli model with candidate_labels of support, warranty, upsell, and help for zero-shot classification.insert_category task (io.kestra.plugin.jdbc.postgresql.Query) runs an UPDATE that writes the top predicted label (labels[0]) back to the category column for that message_id.Kestra coordinates the database reads, the inference call, and the write-back as one declarative YAML flow with built-in retries, full execution logs, and lineage across tasks. You can drive it from event triggers (for example, a new row in Postgres or a webhook) rather than polling, something the HuggingFace Inference API and a raw database cannot orchestrate on their own. Secrets, parameters, and connection settings stay centralized instead of scattered across scripts.
customer.message table containing message_id, user_id, message, and category columns.HUGGINGFACE_API_KEY: HuggingFace Inference API token.POSTGRES_HOST: Postgres host for the JDBC connection.POSTGRES_USERNAME: Postgres username.POSTGRES_PASSWORD: Postgres password.customer.message table schema matches the queries.message_id.category column to confirm the predicted label was written.candidate_labels to match your own taxonomy.model at a different HuggingFace model for your task or language.