AGENT SKILL

outlines

Operate the Outlines structured-output library across output types, local models, provider integrations, and prompt workflows.

License 许可
Apache-2.0
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
outlines
license
Apache 2.0
metadata
{ "disco-role": "operating" }
description
Operate the Outlines structured-output library across output types, local models, provider integrations, and prompt workflows.
disable-model-invocation
true

02 资源文件 6

03 SKILL.md 正文

Outlines Repo Skill

Use this repo skill when a task involves Outlines as a Python package for structured outputs from large language models: defining schemas or regex/CFG constraints, wrapping local or hosted models, rendering prompt templates, composing chat/multimodal inputs, and troubleshooting package/provider/runtime behavior.

This skill is self-contained. Do not reopen the source checkout to use it. The source repository was used only as evidence for these bundled routes, references, and scripts.

Install and Import Check

Base install:

pip install outlines

Optional integrations are installed separately; choose only the backend/provider you need. Examples:

pip install transformers torch       # local Transformers path
pip install llama-cpp-python         # llama.cpp path
pip install vllm                     # vLLM offline/server client path as appropriate
pip install openai                   # OpenAI, SGLang, vLLM server SDK clients
pip install huggingface_hub          # TGI client

Minimal import check:

import outlines
from outlines import Generator, Template
from outlines.inputs import Chat, Image
from outlines.types import JsonSchema, Regex, CFG, Choice

Important: in this source revision, Chat is imported from outlines.inputs, not from the top-level outlines namespace.

Route by Task

Task signal Read
JSON/Pydantic/dataclass/TypedDict/GenSON output, Literal/Enum/Choice, regex, CFG, Generator, backend selection, custom logits processor, parsing generated JSON sub-skills/structured-generation/SKILL.md
Local/offline model setup with Transformers, Transformers multimodal, llama.cpp, MLX-LM, vLLM offline, tokenizers, device dtype, CUDA/MPS/VRAM, local batch/stream behavior sub-skills/local-models/SKILL.md
Hosted or server-based providers: OpenAI/Azure, Anthropic, Gemini, Mistral, Ollama, LM Studio, SGLang, TGI, vLLM server, Dottxt; credentials/endpoints; provider exceptions sub-skills/remote-providers/SKILL.md
Prompt templates, Application, Chat, Image/Audio/Video, Jinja filters, cache controls, safe self-consistency/task-loop recipes sub-skills/prompt-workflows/SKILL.md

Repo-Level References

Safe Helper Scripts

  • scripts/inspect_outlines_api.py: read-only import/signature smoke for a local Python environment.
  • sub-skills/structured-generation/scripts/validate_structure.py: local JSON Schema or regex validator.
  • sub-skills/local-models/scripts/check_local_model_prereqs.py: no-network optional module/device probe.
  • sub-skills/remote-providers/scripts/check_provider_prereqs.py: no-network provider SDK/env-var probe with secrets redacted.
  • sub-skills/prompt-workflows/scripts/render_template.py: local Template renderer.

Operating Rules

  1. Keep output-type design separate from model/provider selection. First define the structure, then pick a compatible execution route.
  2. Treat Outlines generation outputs as raw strings unless a provider wrapper explicitly returns something else; parse or validate after generation.
  3. Do not install broad extras or GPU stacks unless the task explicitly needs that runtime.
  4. Do not call provider services, download models, or start long-running servers during planning or static troubleshooting.
  5. Never execute model-generated code (eval, exec, shell) while using this skill. Validate with schemas, regex, parsers, and bounded tests.
  6. For remote errors, catch outlines.exceptions.APIError subclasses and use retryable, provider, status_code, request_id, and hint to decide recovery.
  7. For local hardware, verify the actual framework/backend runtime before claiming CUDA, MPS, vLLM, or llama.cpp acceleration works.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351