Agent SkillsOpenDCAI/DataFlow-WebUI › random-domain-knowledge-row-generator

random-domain-knowledge-row-generator

GitHub

用于将LLM生成的领域特定内容写入DataFrame指定列的算子。适用于已有种子DataFrame且需批量填充新列的场景,通过构建提示词调用LLM并返回结果列表。

skills/canonical/core_text/generate/random-domain-knowledge-row-generator/SKILL.md OpenDCAI/DataFlow-WebUI

Trigger Scenarios

需要向现有DataFrame批量生成领域相关文本数据 使用LLM进行单列数据的自动化填充

Install

npx skills add OpenDCAI/DataFlow-WebUI --skill random-domain-knowledge-row-generator -g -y
More Options

Non-standard path

npx skills add https://github.com/OpenDCAI/DataFlow-WebUI/tree/main/skills/canonical/core_text/generate/random-domain-knowledge-row-generator -g -y

Use without installing

npx skills use OpenDCAI/DataFlow-WebUI@random-domain-knowledge-row-generator

指定 Agent (Claude Code)

npx skills add OpenDCAI/DataFlow-WebUI --skill random-domain-knowledge-row-generator -a claude-code -g -y

安装 repo 全部 skill

npx skills add OpenDCAI/DataFlow-WebUI --all -g -y

预览 repo 内 skill

npx skills add OpenDCAI/DataFlow-WebUI --list

SKILL.md

Frontmatter
{
    "name": "random-domain-knowledge-row-generator",
    "description": "Reference documentation for the RandomDomainKnowledgeRowGenerator operator.\n[Purpose] Calls an LLM repeatedly with the same domain-generation prompt and writes the generated results into one column of an existing DataFrame.\n[When to use] Use it when you already have a seed DataFrame with the exact target row count and want to fill one output column with domain-specific generated content. If you need to build prompts from existing row fields, use PromptedGenerator or FormatStrPromptedGenerator instead."
}

RandomDomainKnowledgeRowGenerator Operator Reference

RandomDomainKnowledgeRowGenerator does not read any input column values, but it still reads the input DataFrame itself. The operator builds generation_num prompts from domain_keys, calls llm_serving.generate_from_input(...), and assigns the returned list into dataframe[output_key].

See examples/good.md for a runnable example and examples/bad.md for common failure cases.


1. Import

from dataflow.operators.core_text import RandomDomainKnowledgeRowGenerator
from dataflow.prompts.general_text import SFTFromScratchGeneratorPrompt

2. Constructor

RandomDomainKnowledgeRowGenerator(
    llm_serving=llm,
    generation_num=200,
    domain_keys="machine learning, deep learning, neural networks",
    prompt_template=SFTFromScratchGeneratorPrompt(),
)
Parameter Required Default Description
llm_serving Yes None LLM serving object. It must implement generate_from_input(user_inputs, ...). Examples in dataflow.serving include APILLMServing_request, LiteLLMServing, and LocalModelLLMServing_vllm.
generation_num Yes None Number of prompts to build and number of outputs expected from the LLM call.
domain_keys Yes None Domain description passed directly into SFTFromScratchGeneratorPrompt.build_prompt(domain_keys). The source annotation is str, so use a string such as "finance, accounting, tax".
prompt_template No in signature, but effectively required None Prompt object used for every generation call. In practice you must pass an instantiated SFTFromScratchGeneratorPrompt() or another prompt allowed by @prompt_restrict(...). Leaving it as None will fail before generation starts.

Important Constructor Notes

  1. prompt_template=None is not a safe fallback. The code calls self.prompt_template.build_prompt(self.domain_keys) directly, so None raises AttributeError.
  2. The default prompt class is SFTFromScratchGeneratorPrompt, and its build_prompt() method expects domain_keys: str.
  3. The prompt asks the LLM to output a single-line JSON object containing fields such as instruction, input, output, and domain.

3. run() Signature

output_key = op.run(
    storage=self.storage.step(),
    output_key="generated_content",
)
Parameter Required Default Description
storage Yes None DataFlowStorage / FileStorage step object. The operator reads a DataFrame from here and writes the updated DataFrame back.
output_key No "generated_content" Column name used to store generated results.

Return Value

The method returns the string output_key.


4. Actual Runtime Logic

The source code behavior is:

  1. Read the current DataFrame from storage.read("dataframe").
  2. Ignore all column values in that DataFrame.
  3. Build generation_num prompts by repeatedly calling prompt_template.build_prompt(domain_keys).
  4. Call llm_serving.generate_from_input(llm_inputs).
  5. Assign the returned list to dataframe[output_key].
  6. Write the updated DataFrame back to storage and return output_key.

5. Critical Constraints

  1. len(dataframe) should match generation_num. Otherwise dataframe[output_key] = generated_outputs can fail with a pandas length-mismatch error.
  2. An empty seed file plus generation_num > 0 is not safe for the current implementation. The operator still writes back into the existing DataFrame instead of creating rows.

6. Usage Guidance

Use this operator when:

  • You want one generated sample per existing seed row.
  • The row contents are irrelevant, and you only need the row count plus an output column.
  • You want the default SFTFromScratchGeneratorPrompt behavior for domain-focused SFT sample generation.

Do not use this operator when:

  • You need prompts built from existing columns.
  • You expect the operator to create rows from an empty DataFrame.
  • You need per-row domain variation based on different input fields.

Version History

  • 2e95d40 Current 2026-08-27 09:04

Same Skill Collection

skills/canonical/core_text/eval/bench-dataset-evaluator-question/SKILL.md
skills/canonical/core_text/eval/bench-dataset-evaluator/SKILL.md
skills/canonical/core_text/eval/prompted-evaluator/SKILL.md
skills/canonical/core_text/eval/text2qa-sample-evaluator/SKILL.md
skills/canonical/core_text/eval/unified-bench-dataset-evaluator/SKILL.md
skills/canonical/core_text/filter/general-filter/SKILL.md
skills/canonical/core_text/filter/kcentergreedy-filter/SKILL.md
skills/canonical/core_text/filter/prompted-filter/SKILL.md
skills/canonical/core_text/generate/bench-answer-generator/SKILL.md
skills/canonical/core_text/generate/chunked-prompted-generator/SKILL.md
skills/canonical/core_text/generate/embedding-generator/SKILL.md
skills/canonical/core_text/generate/format-str-prompted-generator/SKILL.md
skills/canonical/core_text/generate/prompted-generator/SKILL.md
skills/canonical/core_text/generate/retrieval-generator/SKILL.md
skills/canonical/core_text/generate/text2multihopqa-generator/SKILL.md
skills/canonical/core_text/refine/pandas-operator/SKILL.md
skills/canonical/core_text/refine/prompted-refiner/SKILL.md
skills/canonical/core_text/SKILL.md
skills/canonical/dataflow-dev/SKILL.md
skills/canonical/dataflow-operator-builder/SKILL.md
skills/canonical/generating-dataflow-pipeline/SKILL.md
skills/canonical/prompt-template-builder/SKILL.md

Metadata

Files
0
Version
2e95d40
Hash
b89ea121
Indexed
2026-08-27 09:04

Accueil - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-27 22:41
浙ICP备14020137号-1 $Carte des visiteurs$