Skip to main content
Mellea command-line tool for LLM-powered workflows. Provides sub-commands for serving models (m serve), training and uploading adapters (m alora), decomposing tasks into subtasks (m decompose), running test-based evaluation pipelines (m eval), and applying automated code migrations (m fix).

m alora

Train or upload aLoRAs for requirement validation.

m alora add-readme

Generate and upload an INTRINSIC_README.md for a trained adapter. Uses an LLM to auto-generate documentation for a trained adapter based on the training data and model configuration, then uploads it to the Hugging Face Hub repository.
Prerequisites:
  • Hugging Face CLI authenticated (huggingface-cli login).
  • An LLM backend available for README generation.
Arguments: Options: Output: Generates a README.md file, displays it for confirmation, and uploads it to the Hugging Face Hub repository specified by --name. Example:
See also: Lora and Alora Adapters

m alora train

Train an aLoRA or LoRA adapter on a labelled dataset. Fine-tunes a base causal language model using a JSONL dataset of item/label pairs. Supports both aLoRA (asymmetric LoRA) and standard LoRA adapters.
Prerequisites:
  • Mellea installed with adapter extras (uv add mellea[adapters]).
  • A CUDA, MPS, or CPU device available for training.
Arguments: Options: Output: Saves adapter weights to the path specified by --outfile. The output directory contains an adapter_config.json and the trained weight files, ready for upload or local inference. Example:
See also: Lora and Alora Adapters

m alora upload

Upload a trained adapter to a remote model registry. Pushes adapter weights to Hugging Face Hub, optionally packaging the adapter as an intrinsic with an io.yaml configuration file.
Prerequisites: Hugging Face CLI authenticated (huggingface-cli login).
Arguments: Options: Output: Creates or updates a Hugging Face Hub repository at the name specified by --name and uploads the adapter weight files. Example:
See also: Lora and Alora Adapters

m decompose

Utility pipeline for decomposing task prompts.

m decompose run

Break a complex task into ordered, executable subtasks. Reads user queries from a file or interactive input, runs the LLM-driven decomposition pipeline for each task job, and writes one JSON file, one rendered Python script, and any generated validation modules under a per-job output directory.
Prerequisites:
  • Mellea installed (uv add mellea).
  • An Ollama instance running locally, or an OpenAI-compatible endpoint configured via --backend-endpoint.
Options: Output: Creates a directory <out-dir>/<out-name>/ containing a JSON decomposition result file, a ready-to-run Python script, and any generated validation modules. One directory per task job. Example:
See also: M Decompose, Refactor Prompts with Cli

m eval

LLM-as-a-judge evaluation pipelines.

m eval run

Run LLM-as-a-judge evaluation on one or more test files. Loads test cases from JSON/JSONL files, generates candidate responses using the specified generation backend, scores them with a judge model, and writes aggregated results to a file.
Prerequisites:
  • Mellea installed (uv add mellea).
  • At least one inference backend available (Ollama by default).
  • A separate judge backend/model is recommended but optional (defaults to the generation backend).
Arguments: Options: Output: Writes evaluation results to <output-path>.<output-format> (default eval_results.json). The file contains per-test-case scores, judge verdicts, and aggregate statistics. Example:
See also: Evaluate with Llm as a Judge

m fix

Fix code for API changes.

m fix async

Fix async calls for the await_result default change. Scans Python source files for aact, ainstruct, and aquery calls and applies an automated migration to restore blocking behaviour after the await_result default changed from True to False.
Prerequisites: Mellea installed (uv add mellea).
Arguments: Options: Modes:
  • add-await-result — (default) Adds await_result=True to each call so it blocks until the result is ready. Use this if you don’t need to stream partial results.
  • add-stream-loop — Inserts a while not r.is_computed(): await r.astream() loop after each call. This only works if you passed a streaming model option (e.g. stream=True) to the call; otherwise the loop will finish immediately.
Best practices:
  • Run with —dry-run first to review what will be changed.
  • Only run a given mode once per file. The tool detects prior fixes and skips calls that already have await_result=True or a stream loop, but it is safest to treat it as a one-shot migration.
  • Do not run both modes on the same file. If a stream loop is already present, add-await-result will skip that call (and vice versa).
Detection notes:
  • Most import styles are detected: import mellea, from mellea import MelleaSession, from mellea.stdlib.functional import aact, module aliases, etc.
  • Calls that are already followed by await r.avalue(), await r.astream(), or a while not r.is_computed() loop are automatically skipped, even when nested inside if/try/for blocks.
Output: Modifies Python source files in place (unless --dry-run). Prints a summary of fixed call sites with file paths and line numbers. Example:

m fix genslots

Rewrite genslot imports and class names to genstub equivalents. Scans Python source files and replaces deprecated GenerativeSlot imports and class references with their GenerativeStub replacements.
Prerequisites: Mellea installed (uv add mellea).
Arguments: Options: Rewrites:
  • mellea.stdlib.components.genslot → mellea.stdlib.components.genstub
  • GenerativeSlot → GenerativeStub
  • SyncGenerativeSlot → SyncGenerativeStub
  • AsyncGenerativeSlot → AsyncGenerativeStub
Best practices:
  • Run with —dry-run first to review what will be changed.
  • The tool is idempotent — running it twice on the same file is safe.
Output: Modifies Python source files in place (unless --dry-run). Prints a summary of rewritten references with file paths and line numbers. Example:

m serve

Serve a Mellea program as an OpenAI-compatible HTTP endpoint. Loads a Python file containing a serve function and exposes it via a FastAPI server implementing the OpenAI chat completions API. The server accepts POST /v1/chat/completions requests.
Prerequisites:
  • Mellea installed with server dependency group (uv add 'mellea[server]').
  • The python file being loaded must have a serve function.
Arguments: Options: Output: Starts a long-running HTTP server on the specified host and port. The /v1/chat/completions endpoint accepts OpenAI-format chat completion requests and returns ChatCompletion JSON responses. Example:
See also: M Serve