Learn / AI in 5 Minutes

AI in 5 Minutes

Spark treats AI operations as language statements — not library calls. Here are the four primitives most teams use first.

classify — label text

use fast

classify Intent { support, sales, spam }
  from "My washer is broken and I need help"
  min_confidence 0.7
  -> intent

print intent
./spark --dry-run examples/classify_intent.spark

extract — structured data

extract Person {
  name: string
  age: int
} from "Ada Lovelace was born in 1815" -> person

print person

pipeline — compose steps

let doc "Laundry machines need regular cleaning."

pipeline {
  ask "Summarize: {doc}" -> summary
  | ask "Translate to Spanish: {summary}" -> es
}

print es

Steps share bindings. Prefix a step with | inside the block.

voice — listen, think, speak

voice {
  listen -> user
  classify Intent { support, sales } from user -> intent
  ask "Reply helpfully to: {user}" -> reply
  speak reply -> "out.wav"
}

Create & tune models

When you outgrow a single use fast, Spark has a four-step workflow to analyze, compare, improve, and export a model blueprint:

model code

model analyze "fast" -> report

model compare ["fast", "code", "best"]
  on suite "examples/eval_suite.json" -> comparison

model improve from report prefer quality -> blueprint

model build blueprint into "out/my-model.md"
./spark --dry-run examples/model_improve.spark

model build writes a markdown plan — review it before any live training. Try the full chain in Playground (Model tune workflow) or use the interactive wizard to generate a program for modifying an existing model or creating a new one.

Try it interactively

Open Playground to edit classify and pipeline samples and preview dry-run output before installing locally.

See all functions → — browse 100+ language ops and stdlib helpers with search and filters.

Next lesson

Function Catalog — full surface area beyond classify, extract, pipeline, and voice. Then Build a Model for analyze, compare, improve, and export.