AI Prompt Node
The AI Prompt node runs an LLM prompt against each input row and routes the result to out, fallback, or error based on the model response. It sits in the AI group in the component browser.
When to use
- Rows carry unstructured text (support tickets, product descriptions, resumes) that a downstream branch needs a decision on.
- The decision is a labelling problem (classify), a shape extraction (structured JSON out), a natural-language rewrite (summarize / translate / redact), or something bespoke (custom).
- You want the decision path to be auditable — every prompt + model + response lands in the run's payload sample, gated by the AI usage ledger for billing.
Ports
| Port | Direction | Meaning |
|---|---|---|
in | in | Row to run the prompt against. |
out | out | Row plus the model output on success. |
fallback | out | Row routed here when the model returns the configured fallbackCategory (classify mode). |
error | out | Rows the executor could not run (provider error, budget denied, invalid config). |
notify | out | Optional per-row control-plane row. Chain a Notification node downstream. |
Configuration
| Field | Default | Meaning |
|---|---|---|
mode | classify | One of classify, extract, summarize, translate, redact, custom. Currently supports classify; other modes are coming soon. |
model | Provider model id (e.g. gpt-4o-mini, ollama/llama3). Empty falls back to the deterministic mock provider in dev. | |
prompt | Template rendered per row with {{ column }} placeholders. | |
fallbackCategory | Value that routes the row to the fallback port instead of out in classify mode. |
Providers
The AI Prompt node uses the account's configured LLM provider (OpenAI or self-hosted Ollama). A deterministic mock provider is available for dev / no-backend runs so flows can be authored and tested without provider calls.
Extract / summarize / translate / redact modes, a dedicated right-rail inspector UI, and the custom mode with a tool-call schema.
Billing hooks
When both api and ctx.accountId are present, the runtime calls checkAIEntitlement before dispatching to the provider and recordAIUsage after a successful response. Falsy api or ctx.accountId skips both hooks (dev / no-backend runs). The Lugmate usage ledger is what surfaces these calls on Account -> Manage -> Billing.
Failure modes
| Reason | Where the row lands |
|---|---|
| Empty prompt | error port with "prompt_required". |
| Provider throws | error port with the thrown message. |
| Entitlement denied | error port with "entitlement_denied" and the denial reason. |
Classify result equals fallbackCategory | fallback port. |
| Otherwise | out port with the model output columns. |