Synsema docsENES

LLM primitives

The LLM is the reasoning engine, swappable like a database driver. Four operations, gated by the llm capability (auto-granted in run, required under serve):

llm.syn
-- Doc example: LLM operations. The four ops return TEXT and need a real provider,
-- so the doctest verifies the offline/online check; the ops are shown in `summarize`.
intent: "doc example: LLM operations"
require llm

task summarize(report)
    when llm_available()
        give reason about report with context = "be concise"   -- needs a provider
    otherwise
        give "(LLM offline)"

print("summarize(\"a report\") → " + summarize("a report"))    -- offline → (LLM offline)

test "llm_available() is a bool — branch on it instead of guessing"
    assert_eq(type_of(llm_available()), "bool")

The four operations

require llm

let analysis be analyze sales_data for "trends and anomalies"
let action   be decide between ["refund", "replace", "escalate"] given ticket
let email    be generate "response email" given complaint with tone = "empathetic"
let insight  be reason about problem with context = background_data

They take a subject: reason about X, decide between [...] given X, analyze X for "...", generate "..." given X. (A bare reason "literal" also works.)

Validated decisions

A decide result must be exactly one of the options — Synsema retries up to 3 times with feedback, then warns and returns the raw response.

Offline mode

Without a provider configured, the ops return descriptive placeholders (e.g. decide"[decision pending]"), so programs stay runnable. Branch on llm_available() instead of guessing:

when llm_available()
    let s be reason "Summarize: " + text
otherwise
    let s be "(LLM offline)"

Configure a provider in Provider config; let the model pick tools in Tool calling.