Skip to main content

AI in TransformScript

AI in TransformScript is in Limited Preview and is not generally available yet. To request access, contact your Account Manager. Access is typically granted to customers who already use TransformScript in production.

TransformScript can call an AI model from inside a transformation and feed the result back into your workflow. This is how you handle input that isn't cleanly structured: extract specific fields from a document, classify a message, or summarize content, then use that output like any other value in your script.

The AI call returns structured output that matches a schema you define, so the result is predictable and machine-readable rather than free text.

Calling AI

You provide a prompt, the input to work from, and an output schema:

---
{
  extraction: ai(
    prompt: "Extract the invoice number, invoice total amount, and invoice currency from the provided invoice.",
    inputs: payload,
  ) as {
    invoiceNumber: String,
    total: Number,
    currency: String
  }
}

The schema is the contract for the result. The model's answer is shaped to match it, so downstream steps can rely on the field names and types. If the output doesn't match the schema, you can fail fast or configure a fallback.

When to Use AI

Use an AI call when the input is unstructured or inconsistent and a fixed parser can't reliably read it: scanned or PDF documents, free-form email bodies, or spreadsheets whose layout varies between senders. For input that already has a dependable structure, the Function Library and selectors extract and reshape it without a model call, which is faster and fully deterministic.