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
additionalPropertiesset to false. - resolve_schema_path()
-
Resolve a JSON schema into the argument form the backend’s CLI expects.
- extract_structured()
-
Return the validated
structured_outputfrom 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
-
LlmBackendfor the AnthropicclaudeCLI. - CodexCliBackend
-
LlmBackendfor the OpenAIcodexCLI. - LlmBackends
-
Registry mapping each specialty to the
LlmBackendthat serves it. - check_status()
-
Check whether the
claudeCLI is installed and authenticated. - ClaudeStatus
-
Result of
check_status:ClaudeReady,ClaudeNotInstalled, orClaudeNotAuthenticated. - ClaudeReady
-
The
claudeCLI is installed and authenticated. - ClaudeNotInstalled
-
The
claudeCLI is not on PATH. - ClaudeNotAuthenticated
-
The
claudeCLI 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 -pargv for one stdin-prompted invocation. - ClaudeCliBackend.parse_response()
-
Parse
claudestdout into text or a validated model. - ClaudeCliBackend.env()
-
Return no extra environment variables; the
claudeCLI runs with the inherited environment. - ClaudeCliBackend.build_argv()
-
Build the inline
-pargv for the sentiment/pushback scoring path. - ClaudeCliBackend.parse_result_envelope()
-
Parse the
{is_error, result}JSON envelope fromclaude -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_specialtymaps 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.