CX · Reference guidellm
PlaygroundDownloadsAboutv0.17.0

llm

A minimal LLM provider (EXPERIMENTAL x/ tier, #6 D2/S10) — the first Runnable. complete POSTs one prompt to Ollama /api/chat and returns the completion; wrap it in a lib-qualified closure ([?fn ($p) [$llm:complete base model $p]]) to compose it through cx-x/run like any other Runnable. Pure request/response shaping (chat-request, completion-of) is separated from the effectful call (complete), which composes the real cx-stdlib/http client + cx-stdlib/json codec — no new transport. Targets the Ollama /api/chat protocol (local, keyless; run under a scoped net grant). A dedicated chat Runnable-factory + stream (NDJSON token sequence) are deferred (S10b — NDJSON needs its own chunked-line reader; #45 itself is CLOSED).

Experimental x/ tier — imported as cx-x/llm. Bundled and gated in-tree like any other module, but EXEMPT from the frozen-surface stability promise (std-lib README, decision D3): a semver-breaking change is allowed here while the surface settles, and the frozen-surface canary never counts it. Pin behaviour you depend on with your own fixtures.

llm:user-message

[$llm:user-message] -> map — Build one chat turn {role:"user", content}.

llm:chat-request

[$llm:chat-request] -> map — Build the Ollama /api/chat request body for a single-prompt, non-streaming turn.

llm:completion-of

[$llm:completion-of] -> string — Extract the assistant's completion text (/message/content) from an /api/chat response value.

llm:complete

[$llm:complete] -> string — POST one prompt to {base}/api/chat (net) and return the completion text. Composes http:post + json. Wrap as [?fn ($p) [$llm:complete base model $p]] to use as a cx-x/run Runnable.