Use when creating new pipeline templates (YAML + seed files) for DataGenFlow. Guides through block selection, YAML authoring, seed file creation, and validation. Use for any task involving lib/templates/ directory, adding new template use cases, or creating seed files that match pipeline variables.
Templates are YAML definitions + seed files in lib/templates/. Auto-discovered on startup by TemplateRegistry (lib/templates/__init__.py).
.yamlseed_<template_id>.json or seed_<template_id>.mdname: Template Display Name
description: What this template generates
blocks:
- type: BlockClassName # must match class name exactly
config:
param1: value1 # must match __init__ parameter names exactly
user_prompt: "{{ var }}" # Jinja2 references to seed metadata
- type: AnotherBlock
config:
field_name: generated
JSON (most templates):
[
{"repetitions": 3, "metadata": {"content": "input text here"}}
]
Markdown (only for MarkdownMultiplierBlock as first block):
seed_<template_id>.md[{"repetitions": 1, "metadata": {"file_content": "<content>"}}]| Block | Category | Key Outputs | Notes |
|-------|----------|-------------|-------|
| TextGenerator | generators | assistant, system, user | free-text via LLM |
| StructuredGenerator | generators | generated | JSON via LLM with schema |
| SemanticInfiller | generators | dynamic | complete skeleton records |
| StructureSampler | seeders | skeletons, _seed_samples | multiplier, must be first |
| MarkdownMultiplierBlock | seeders | content | multiplier, must be first |
| ValidatorBlock | validators | text, valid, assistant | text rules |
| JSONValidatorBlock | validators | valid, parsed_json | JSON parse + validate |
| DuplicateRemover | validators | generated_samples | embedding similarity |
| DiversityScore | metrics | diversity_score | lexical diversity |
| CoherenceScore | metrics | coherence_score | text coherence |
| RougeScore | metrics | rouge_score | ROUGE comparison |
| RagasMetrics | metrics | ragas_scores | RAGAS QA evaluation |
| FieldMapper | utilities | dynamic | Jinja2 field expressions |
| LangfuseBlock | observability | langfuse_trace_url | trace logging |
# simple generation + validation
StructuredGenerator → JSONValidatorBlock
# document processing (multiplier first)
MarkdownMultiplierBlock → TextGenerator → StructuredGenerator → JSONValidatorBlock
# data augmentation
StructureSampler → SemanticInfiller → DuplicateRemover
# generation + metrics
StructuredGenerator → FieldMapper → RagasMetrics
# generation + review-friendly output
StructuredGenerator → FieldMapper (flatten for review)
The Review page displays records from the last block's accumulated_state. Only first-level keys are shown as primary/secondary fields. Nested objects (e.g. generated.confirmed_dependencies) appear as raw JSON strings and can't be configured as separate review fields.
Always add a FieldMapper as the last block to surface the fields reviewers need at the top level.
Without a FieldMapper, the accumulated_state after a StructuredGenerator looks like:
{
"input_field": "...",
"generated": {
"question": "...",
"answer": "...",
"contexts": ["..."]
}
}
The review UI sees input_field and generated (a blob). Reviewers can't configure question or answer as primary fields.
Add a FieldMapper as the last block (or last before metrics/observability blocks):
- type: FieldMapper
config:
mappings:
# Flatten nested fields to top level
question: "{{ generated.question }}"
answer: "{{ generated.answer }}"
# tojson is safe only for structured data (IDs, numbers, short labels)
# avoid tojson on arrays/objects with free-text — newlines/quotes break JSON parsing
context_count: "{{ generated.contexts | length }}"
# Carry forward useful seed metadata
source: "{{ source_document }}"
| tojson for arrays/objects — FieldMapper auto-parses JSON strings back to objects, so the review UI can display them properly. Exception: tojson on arrays/objects whose values contain unescaped quotes or newlines (e.g. free-text descriptions) will break FieldMapper JSON parsing. In that case, map only scalar summaries (counts, IDs) and let the array flow through as an existing first-level key.| length for counts — gives reviewers a quick numeric summary without expanding lists| default('') for optional fields — prevents Jinja2 errors when a field is missingfolder_path, _usage, _seed_samples etc. Only map what's useful for human reviewlib/templates/<template_id>.yaml{{ variables }} in YAML to metadata keysuv run python -c "
from lib.templates import template_registry
for t in template_registry.list_templates():
print(f'{t[\"id\"]}: {t[\"name\"]}')
"
uv run python -c "
from lib.blocks.registry import BlockRegistry
registry = BlockRegistry()
for name, cls in registry._blocks.items():
schema = cls.get_schema()
print(f'{name}: {list(schema.get(\"config_schema\", {}).get(\"properties\", {}).keys())}')
"
# create pipeline from template
curl -s -X POST http://localhost:8000/api/pipelines/from_template/<template_id> | python -m json.tool
# execute with seed
curl -s -X POST http://localhost:8000/api/pipelines/<id>/execute \
-H 'Content-Type: application/json' \
-d '{"content": "test input"}' | python -m json.tool
| Template | File | Pattern |
|----------|------|---------|
| JSON Generation | json_generation.yaml | StructuredGenerator → JSONValidator |
| Text Classification | text_classification.yaml | StructuredGenerator → JSONValidator |
| Q&A Generation | qa_generation.yaml | Multiplier → Text → Structured → JSONValidator |
| Data Augmentation | data_augmentation.yaml | Sampler → Infiller → DuplicateRemover |
| RAGAS Evaluation | ragas_evaluation.yaml | Structured → FieldMapper → RagasMetrics |
| Mistake | Fix |
|---------|-----|
| Block type doesn't match class name | Check lib/blocks/builtin/ for exact class names |
| Config key doesn't match __init__ param | Read block source, match parameter names |
| Missing seed variable referenced in prompt | Add the variable to seed metadata |
| MarkdownMultiplierBlock not first | Multiplier blocks must always be first |
| Seed file not named seed_<template_id>.* | Template ID must match: foo.yaml → seed_foo.json |
| Nested fields not visible in Review UI | Add a FieldMapper as last block to flatten nested outputs to top-level keys |
| Review shows generated as a JSON blob | Map individual sub-fields: question: "{{ generated.question }}" |
lib/templates/ with correct block types and config keysimplementing-datagenflow-blocks — creating new block typesdebugging-pipelines — troubleshooting template executiontesting-pipeline-templates — thorough end-to-end testingnpx skills add nicofretti/creating-pipeline-templates下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer