计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
pipelines-and-workflows【效率与协作】Compose deterministic txtai pipelines and workflows for extraction, transformation, batching, streaming, YAML task configuration, and schedules.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task is to choose txtai pipelines, wire them into deterministic Workflow task chains, convert between Python and YAML workflow definitions, debug lazy workflow execution, or validate pipeline/workflow configuration without deploying a service.
Route elsewhere when the user is asking for:
from txtai.workflow import Task, Workflow
workflow = Workflow([
Task(lambda rows: [row.strip() for row in rows]),
Task(lambda rows: [row.upper() for row in rows]),
], batch=2)
results = list(workflow([" first ", "second", " third "]))
Important behavior:
Workflow(tasks, batch=100, workers=None, name=None, stream=None) returns a lazy generator from workflow(elements); nothing runs until the generator is iterated or wrapped in list(...).Task(action) receives a batch/list of elements and should return one output per input unless deliberately performing one-to-many expansion.Task(...); pure Python callables are safer for smoke tests because default ML pipelines often download models.(id, data, tags) tuples depending on downstream tasks.txtai.Application configuration with named pipelines and reusable named workflows.workflow extra and valid cron syntax.scripts/workflow_smoke.py when you need a no-download, deterministic check of Python workflow execution and YAML template shape.from txtai.workflow import Task, Workflow
normalize = Task(lambda rows: [row.lower() for row in rows])
annotate = Task(lambda rows: [{"text": row, "length": len(row)} for row in rows])
workflow = Workflow([normalize, annotate], batch=100)
for row in workflow(["A Text", "Another Text"]):
print(row)
For file processing, use FileTask(action, select=r"\.pdfquot;) to accept existing local files matching a regex. For image paths, use ImageTask(...) when Pillow is installed. For URL/local retrieval, use RetrieveTask(...), but treat remote URLs as network-dependent and avoid them in offline validation.
YAML pipelines are top-level sections named by lower-case pipeline class names. Workflows live under workflow and contain named workflows with tasks.
summary:
translation:
workflow:
summarize-translate:
tasks:
- action: summary
- action: translation
args: [fr]
Application(config).workflow("summarize-translate", elements) returns a generator, just like direct Python workflows. YAML action resolution is:
summary, translation, textractor, segmentation, labels, or llm.index, upsert, search, or transform when the application has an embeddings configuration.mypackage.module.function.references/pipeline-catalog.md: pipeline families, common classes, extras, and input/output caveats.references/workflow-configuration.md: Workflow, Task, task subclasses, YAML keys, batching, streaming, schedule configuration, and action resolution.references/troubleshooting.md: generator consumption, missing extras, offline/model-download behavior, selector regexes, YAML callable resolution, schedules, and heavy pipeline families.scripts/workflow_smoke.py: deterministic no-download smoke helper with Python workflow checks and optional YAML template output.Application, scheduled, or API-served; route API serving to api-and-deployment.all unless the user explicitly wants the full environment.list(...), a for loop, or an indexing/search sink; otherwise no work happens.Summary, Translation, Transcription, Caption, LLM, and similar classes can trigger model downloads.action, and use fully qualified Python paths for custom callables.txtai[workflow], a cron expression, schedule.elements, and a running process that calls app.wait() or otherwise stays alive.