First-Class Prompts & Schemas
Write auto-dedented, brace-balanced @{ … } prompts with ${expr} interpolation, attach ‘’ LLM hints directly to fields, and generate JSON Schemas + decoders at compile time via type_schema<T>() and decode<T>().
.splx)import llm from "std/llm"import os from "std/os"
/// Developer doc-comment (shown in IDE hover, omitted from LLM schemas).'' Historical figure profile returned by the model.type Person = struct { firstName: Str '' Given name, e.g. Ada lastName: Str '' Family name, e.g. Lovelace age: Int '' Age in years profession: Str '' Primary occupation}
let api_key = os.env("OPENAI_API_KEY") ?? panic("OPENAI_API_KEY not set")
// Automatically sends `type_schema<Person>()` and validates the JSON response!let ada = llm.ask<Person>( provider: "openai_responses", model: "gpt-6-luna", api_key: api_key) @{ Generate a profile for Ada Lovelace.}?
print("${ada.firstName} ${ada.lastName} (${ada.age}) — ${ada.profession}")First-Class Prompts & Schemas
Write auto-dedented, brace-balanced @{ … } prompts with ${expr} interpolation, attach ‘’ LLM hints directly to fields, and generate JSON Schemas + decoders at compile time via type_schema<T>() and decode<T>().
Hindley-Milner + Row Polymorphism
Zero null or undefined. Structural records, functional spread ({ …x, k: v }), open records (..r), hybrid dynamic records (..extra: Dict<Str, Json>), and exhaustive match.
Colorless Async & Agents
No async/await clutter. The compiler infers suspension automatically, runs map sequentially to prevent runaway fan-out, and offers opt-in par_map, multi-provider std/llm, and deterministic agent_replay<T>.
Compiles to Clean ESM
Targets Browser and Node 22+ / Bun / Deno with zero root runtime dependencies, self-tail-call optimization, reifiable generics (reified fn), and a built-in LSP server for VS Code.