serving-and-cli
Operate Mellea 0.8.0.dev0's m CLI and OpenAI-compatible server safely, including serving, routing, response schemas, streaming, decomposition, migration, evaluation routing, and bounded adapter commands.
- License 许可
- Apache-2.0
- 最近更新
- 2026-10-08
- Stars
- ★ 11
- Forks
- 3
01 前言 Front Matter
- name
- serving-and-cli
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Operate Mellea 0.8.0.dev0's m CLI and OpenAI-compatible server safely, including serving, routing, response schemas, streaming, decomposition, migration, evaluation routing, and bounded adapter commands.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/cli-reference.md10.4 KB
- 参考文档references/deployment-and-config.md7.6 KB
- 参考文档references/serving-api.md11.6 KB
- 参考文档references/troubleshooting.md13.1 KB
03 SKILL.md 正文
Serving and CLI
Use this route for the m entry point, m serve,
POST /v1/chat/completions, GET /health, OpenAI-compatible clients, model
routing, response formats, SSE streaming, m decompose, m fix, or the
bounded CLI aspects of m alora and m eval. The operating contract is for
Mellea 0.8.0.dev0 and Python 3.11+.
Route the task
- Run the safe bundled checker before invoking a side-effectful command:
python scripts/check_cli_surface.py --mode static. To render installed help without executing a callback, use--mode help --target <name>. - Read CLI reference for exact command families, current defaults, output files, prerequisites, and side effects.
- For
m serve, request/response fields, structured output, routing, streaming, multimodal messages, and error envelopes, read Serving API. - Before binding a socket or exposing a process, read Deployment and configuration.
- For missing extras, schema failures, port conflicts, backend errors, partial output, or command-safety recovery, read Troubleshooting.
Safety gates
- Help and static inspection are safe.
m serveimports user code and starts a blocking server;m decomposeandm evalcall models and write files;m fix genslotswrites unless--dry-run; aLoRA commands may download a model, consume substantial compute, overwrite local files, prompt, or upload to Hugging Face Hub. - Require an explicit decision before a public bind, provider call, model download, training run, remote upload, or non-dry-run rewrite. Never use a side-effectful command as an installation probe.
- Prefer
127.0.0.1over them servewildcard default. The built-in service has no authentication, TLS, rate limiting, or authorization layer. - Treat request
modelas untrusted routing metadata. Route only through a fixed allowlist; never derive a provider URL, import, credential, or arbitrary model loader directly from it. - Validate
json_schemabefore generation. A response schema affects output only when the served function acceptsformatand passes it into Mellea. - True incremental streaming needs an uncomputed thunk and a streaming-capable backend. A computed result becomes one SSE content chunk.
Minimal workflows
Plan a serving request
- Choose a local host and an unused port; prefer
127.0.0.1:8080. - Confirm the app's
servesignature and backend prerequisites without importing untrusted, side-effectful application code. - Draft one minimal request with
modeland a user message. - Add exactly one advanced feature at a time:
stream,response_format, tools, multimodal content, or model routing. - Check
/health, then send the bounded request and inspect the response or SSE[DONE]marker.
Plan a CLI migration or pipeline
- Render the exact nested help surface and check paths/credentials first.
- For
fix, run--dry-runand review every match before writing. - For
decomposeoreval, bound model/token/timeout settings and use a new output path; these commands make provider calls and files. - Inspect generated Python, validators, and result counts before executing or treating a run as successful.
- Record which operations were deferred because they need a live backend, training resources, or remote write approval.
Route a difficult request
- Structured-output endpoint with routing and streaming: read all of Serving API, use a fixed route allowlist, validate the JSON schema, and ensure the streaming branch returns an uncomputed thunk.
- Missing server extra: run help/static checks, install
server, and repeat help; do not start Uvicorn as a dependency test. - Decompose/fix misuse: read the failure table in Troubleshooting, preserve generated or rewritten artifacts, and recover with a narrower, reviewable operation.
Ownership boundaries
Route provider selection, model identifiers, credentials, backend extras, and
provider failures to ../backends-and-models/SKILL.md. Route evaluation design,
judge validity, and sampling semantics to
../sampling-and-evaluation/SKILL.md. Route tool execution, tool-call loops,
and MCP to ../tools-and-agents/SKILL.md when that route is available; this
skill covers only the HTTP envelope and CLI boundary for tools.
04 同仓库更多 Skills
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
obsidian-clipper-template-creator
Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.
python-api
Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP/mAP semantics, and source-style import diagnostics.
file-evaluation
Folder-based PASCAL VOC AP/mAP evaluation from ground-truth and detection text files.
object-detection-metrics
Guides legacy Object-Detection-Metrics PASCAL VOC AP/mAP evaluation from detection text folders and direct Python API classes.
nx-workspace-patterns
Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.