Skip to main content

AI Prompt Node

Flow 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

PortDirectionMeaning
ininRow to run the prompt against.
outoutRow plus the model output on success.
fallbackoutRow routed here when the model returns the configured fallbackCategory (classify mode).
erroroutRows the executor could not run (provider error, budget denied, invalid config).
notifyoutOptional per-row control-plane row. Chain a Notification node downstream.

Configuration

FieldDefaultMeaning
modeclassifyOne of classify, extract, summarize, translate, redact, custom. Currently supports classify; other modes are coming soon.
modelProvider model id (e.g. gpt-4o-mini, ollama/llama3). Empty falls back to the deterministic mock provider in dev.
promptTemplate rendered per row with {{ column }} placeholders.
fallbackCategoryValue 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.

Coming Soon

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

ReasonWhere the row lands
Empty prompterror port with "prompt_required".
Provider throwserror port with the thrown message.
Entitlement deniederror port with "entitlement_denied" and the denial reason.
Classify result equals fallbackCategoryfallback port.
Otherwiseout port with the model output columns.