core-composition
Build GenAI Processors pipelines with content, streams, routing, caching, and tracing.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- core-composition
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Build GenAI Processors pipelines with content, streams, routing, caching, and tracing.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md4.5 KB
- 参考文档references/troubleshooting.md2.4 KB
- 参考文档references/workflows.md3.2 KB
- 脚本scripts/smoke_core.py1.4 KB
03 SKILL.md 正文
Core composition
Use this sub-skill for the mechanics of GenAI Processors: content wrappers, custom processors, stream transformations, branching, caching, and debugging.
Read when
- The task asks how to create a
ProcessororPartProcessor. - The task mentions
ProcessorPart,ProcessorContent,ContentStream, MIME types, roles, metadata, or substreams. - The task needs
+,//,parallel_concat,Switch,PartSwitch,streams.split,streams.merge, or queue-based stream wiring. - The task needs
CachedProcessor,CachedPartProcessor,SqlCache, tracing, or a safe local smoke check.
Boundaries
This sub-skill owns library plumbing and reusable processor patterns. It does not own model credentials, audio/video device setup, or full example app wiring:
- Route model wrappers and tool calling to
../model-backends/. - Route audio/video/PDF/web/Drive/GitHub sources to
../multimodal-i-o/. - Route CLI demos, AI Studio applets, and full applications to
../examples-and-apps/.
Core workflow
- Start with content shape: text-only, multimodal, dataclass/proto, function call/response, or device/document parts.
- Pick
Processorfor stream-wide/stateful logic, orPartProcessorfor independent per-part logic. - Accept broad inputs at call sites; implement against
processor.ProcessorStream. - Use
+for sequential chains and//only for independent part processors. - Use
parallel_concatorstreams.split/mergeonly when the ordering and concurrency behavior matches the user-visible result. - Add
Switch/PartSwitchfor substream or mimetype routing. - Add cache/tracing last, after the uncached pipeline is correct.
- Validate with
scripts/smoke_core.pyor the rootscripts/check_install.py.
References and scripts
references/api-reference.mdlists the public core classes, decorators, stream utilities, and helper modules.references/workflows.mdgives end-to-end patterns for custom processors, stream routing, caching, and tracing.references/troubleshooting.mdcovers common mistakes with MIME types,.text, caches, task groups, and trace size.scripts/smoke_core.pyruns a safe in-process processor/stream smoke test.
Native evidence anchors
Behavior is backed by the core package source and tests such as
content_api_test.py, processor_test.py, streams_test.py, switch_test.py,
cache_test.py, sql_cache_test.py, map_processor_test.py,
mime_types_test.py, context_test.py, debug_test.py, preamble_test.py,
constrained_decoding_test.py, and trace_file_test.py.
Usability checkpoints
A good answer using this sub-skill should:
- Preserve multimodal parts unless the user explicitly wants text only.
- State when an operation buffers a stream versus preserving streaming behavior.
- Show concrete imports and processor composition code.
- Include validation steps that do not require remote models or hardware.
- Link to sibling sub-skills only when the task crosses into models, I/O, or complete examples.
04 同仓库更多 Skills
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.
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.
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.
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.
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.
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).