Reference

Calling

One-shot LLM calls and structured output.

call.call()

Run one CLI-backed LLM call and parse its response.

schema_for()

Serialize a Pydantic model’s JSON schema, with additionalProperties set to false.

resolve_schema_path()

Resolve a JSON schema into the argument form the backend’s CLI expects.

extract_structured()

Return the validated structured_output from a stream-json event list, if present.

parse_structured_output()

Parse raw CLI stdout into text or a validated model.

parse_result_envelope()

Parse a {is_error, result} JSON envelope into its result text.

Backends

CLI backends, the specialty registry, and Claude status checks.

LlmBackend

Abstract interface for an LLM CLI backend.

ClaudeCliBackend

LlmBackend for the Anthropic claude CLI.

CodexCliBackend

LlmBackend for the OpenAI codex CLI.

LlmBackends

Registry mapping each specialty to the LlmBackend that serves it.

check_status()

Check whether the claude CLI is installed and authenticated.

ClaudeStatus

Result of check_status: ClaudeReady, ClaudeNotInstalled, or ClaudeNotAuthenticated.

ClaudeReady

The claude CLI is installed and authenticated.

ClaudeNotInstalled

The claude CLI is not on PATH.

ClaudeNotAuthenticated

The claude CLI is installed but not authenticated.

ClaudeCliBackend Methods

Methods for the ClaudeCliBackend class

ClaudeCliBackend.cc_sentiment()

Build a backend preset for the sentiment/pushback scoring path.

ClaudeCliBackend.build_command()

Build the claude -p argv for one stdin-prompted invocation.

ClaudeCliBackend.parse_response()

Parse claude stdout into text or a validated model.

ClaudeCliBackend.env()

Return no extra environment variables; the claude CLI runs with the inherited environment.

ClaudeCliBackend.build_argv()

Build the inline -p argv for the sentiment/pushback scoring path.

ClaudeCliBackend.parse_result_envelope()

Parse the {is_error, result} JSON envelope from claude -p --output-format json.

Transport

Subprocess plumbing shared by the CLI backends.

run_cli()

Run a CLI command to completion and return its stdout.

arun_cli()

Run a CLI command asynchronously and return its stdout.

collect_process()

Drain a subprocess’s stdout and stderr concurrently and wait for it to exit.

map_concurrent()

Map an async function over items with bounded concurrency.

Types

Shared type aliases.

types.TModel

Abstract model tier; each backend maps it to a provider-specific model name.

types.TSpecialty

Task specialty; LlmBackends.for_specialty maps each to its registered backend.

MLX

Local Apple-Silicon engine, adapter codec, fuser, and runtime patches.

mlx.MlxEngine

Runs batched MLX inference on a dedicated worker thread.

mlx.AdapterCodec

Compresses and decompresses a homogeneous-dtype safetensors LoRA adapter.

mlx.AdapterFuser

Fuses a shipped LoRA adapter into a base MLX model.

mlx.MLXPatches

Idempotent runtime patches for mlx_lm.