选项
首页首页 Skill 数据库管理 nemo-data-designer-plugin

nemo-data-designer-plugin

NVIDIA/skills NVIDIA/skills

使用 Data Designer 库构建合成数据集和数据生成管道。

...展开全部
1
更新时间 2026-09-27

开始之前

请不要先探索工作区。该工作流中的“学习”步骤已为您提供了所需的一切。

目标

使用 Data Designer 库构建一个符合以下描述的合成数据集:

$ARGUMENTS

工作流

如果用户暗示不希望回答问题——例如,他们说“请有主见”、“由你决定”、“做出合理的假设”、“直接构建”、“给我一个惊喜”等——请使用“自动驾驶”模式。否则,请使用“交互式”模式(默认)。

仅读取与所选模式匹配的工作流文件,然后按照该文件执行:

  • 交互式 → 读取 workflows/interactive.md
  • 自动驾驶 → 读取 workflows/autopilot.md

规则

  • 默认保留输出中的所有列。唯一可以删除列的情况是:(1) 用户明确要求,或 (2) 该列是仅用于推导其他列的辅助列(例如,用于提取姓名、城市等的抽样人员对象)。如有疑问,请保留该列。
  • 不要建议或询问种子数据集。仅当用户明确提供种子数据或要求基于现有记录构建时才使用种子数据集。使用种子数据集时,请阅读 references/seed-datasets.md.
  • 当数据集需要人员数据(姓名、人口统计信息、地址)时,请阅读 references/person-sampling.md.
  • 如果已经存在与数据集描述相匹配的数据集脚本,请询问用户是编辑现有脚本还是创建新脚本。
  • 对于本 NeMo 平台插件特有的命令和上下文(例如,从 IGW 提供商获取模型配置,或脚本中的 ModelConfig,安装或发布 Nemotron Personas 语言包,以及平台侧资源指针),请参阅 references/nemo-platform-plugin-additions.md.

使用提示与常见陷阱

  • 采样器和验证列都需要指定类型和参数。例如: sampler_type="category" 配合 params=dd.CategorySamplerParams(...).
  • Jinja2 模板中 prompt, system_prompt,以及 expr 字段:引用包含 {{ column_name }},嵌套字段使用 {{ column_name.field }}.
  • **SamplerColumnConfig:** 接受 params,而非 sampler_params.
  • LLM评委评分访问: LLMJudgeColumnConfig 生成一个嵌套字典,其中每个评分名称映射到 {reasoning: str, score: int}。要获取数值分数,请使用 .score 属性。例如,对于名为 quality ,且其评分名为 correctness,请使用 {{ quality.correctness.score }}。使用 {{ quality.correctness }} 将返回完整的字典,而非数值分数。

故障排除

  • **nemo data-designer 未找到 CLI:** 告知用户 nemo data-designer 未安装在当前环境中(需要 Python >= 3.11)。询问用户是否希望由您创建虚拟环境并进行安装,或者他们更愿意自行操作。未经用户许可,请勿安装任何内容。
  • 预览期间出现网络错误:沙箱环境可能正在阻止出站请求。请征得用户许可,在禁用沙箱的情况下重试该命令。仅在万不得已的情况下(即在沙箱外重试仍失败时),才告知用户自行运行该命令。

输出模板

在当前目录中创建一个 Python 文件,其中包含一个 load_config_builder() 函数,该函数返回一个 DataDesignerConfigBuilder。为文件命名时应具有描述性(例如, customer_reviews.py)。请使用 PEP 723 规范的内联元数据声明依赖项。

# /// script
# dependencies = [
#   "data-designer", # always required
#   "pydantic", # only if this script imports from pydantic
#   # add additional dependencies here
# ]
# ///
import data_designer.config as dd
from pydantic import BaseModel, Field


# Use Pydantic models when the output needs to conform to a specific schema
class MyStructuredOutput(BaseModel):
    field_one: str = Field(description="...")
    field_two: int = Field(description="...")


# Use custom generators when built-in column types aren't enough
@dd.custom_column_generator(
    required_columns=["col_a"],
    side_effect_columns=["extra_col"],
)
def generator_function(row: dict) -> dict:
    # add custom logic here that depends on "col_a" and update row in place
    row["name_in_custom_column_config"] = "custom value"
    row["extra_col"] = "extra value"
    return row


def load_config_builder() -> dd.DataDesignerConfigBuilder:
    config_builder = dd.DataDesignerConfigBuilder(
        # Declaring model configs programmatically here is the portable path:
        # it works for both local `run` and cluster `submit`, while the local
        # YAML registry alternative only works for `run`. The provider below
        # is a common default created during `nemo setup` — confirm it (or
        # discover others) with `nemo inference providers list`. See
        # references/nemo-platform-plugin-additions.md for the local-YAML alternative.
        model_configs=[
            dd.ModelConfig(
                alias="text",
                model="...",
                provider="default/nvidia-build",
                inference_parameters=dd.ChatCompletionInferenceParams(),
            ),
        ],
    )

    # Seed dataset (only if the user explicitly mentions a seed dataset path)
    # config_builder.with_seed_dataset(dd.LocalFileSeedSource(path="path/to/seed.parquet"))

    # config_builder.add_column(...)
    # config_builder.add_processor(...)

    return config_builder

仅在任务需要时才包含 Pydantic 模型、自定义生成器、种子数据集和额外依赖项。当数据集使用 LLM 列时,建议在脚本中声明 model_configs ——在脚本中声明该依赖可确保配置在本地 run 和集群 submit,而本地 YAML 注册表的替代方案仅适用于 run.

在 GitHub 上查看
---
name: nemo-data-designer-plugin
description: Build synthetic datasets and data generation pipelines using the Data Designer library.
license: Apache-2.0
---

# Before You Start

Do not explore the workspace first. The workflow's Learn step gives you everything you need.

# Goal

Build a synthetic dataset using the Data Designer library that matches this description:

$ARGUMENTS

# Workflow

Use **Autopilot** mode if the user implies they don't want to answer questions — e.g., they say something like "be opinionated", "you decide", "make reasonable assumptions", "just build it", "surprise me", etc. Otherwise, use **Interactive** mode (default).

Read **only** the workflow file that matches the selected mode, then follow it:

- **Interactive** → read `workflows/interactive.md`
- **Autopilot** → read `workflows/autopilot.md`

# Rules

- Keep all columns in the output by default. The only exceptions for dropping a column are: (1) the user explicitly asks, or (2) it is a helper column that exists solely to derive other columns (e.g., a sampled person object used to extract name, city, etc.). When in doubt, keep the column.
- Do not suggest or ask about seed datasets. Only use one when the user explicitly provides seed data or asks to build from existing records. When using a seed, read `references/seed-datasets.md`.
- When the dataset requires person data (names, demographics, addresses), read `references/person-sampling.md`.
- If a dataset script that matches the dataset description already exists, ask the user whether to edit it or create a new one.
- For commands and context specific to this NeMo Platform plugin (e.g., sourcing model configs from IGW providers or in-script `ModelConfig`s, installing or publishing Nemotron Personas locales, platform-side resource pointers), read `references/nemo-platform-plugin-additions.md`.

# Usage Tips and Common Pitfalls

- **Sampler and validation columns need both a type and params.** E.g., `sampler_type="category"` with `params=dd.CategorySamplerParams(...)`.
- **Jinja2 templates** in `prompt`, `system_prompt`, and `expr` fields: reference columns with `{{ column_name }}`, nested fields with `{{ column_name.field }}`.
- `**SamplerColumnConfig`:** Takes `params`, not `sampler_params`.
- **LLM judge score access:** `LLMJudgeColumnConfig` produces a nested dict where each score name maps to `{reasoning: str, score: int}`. To get the numeric score, use the `.score` attribute. For example, for a judge column named `quality` with a score named `correctness`, use `{{ quality.correctness.score }}`. Using `{{ quality.correctness }}` returns the full dict, not the numeric score.

# Troubleshooting

- `**nemo data-designer` CLI not found:** Tell the user that `nemo data-designer` is not installed in this environment (requires Python >= 3.11). Ask if they would like you to create a virtual environment and install it, or if they prefer to do it themselves. Do not install anything without the user's permission.
- **Network errors during preview:** A sandbox environment may be blocking outbound requests. Ask the user for permission to retry the command with the sandbox disabled. Only as a last resort, if retrying outside the sandbox also fails, tell the user to run the command themselves.

# Output Template

Write a Python file to the current directory with a `load_config_builder()` function returning a `DataDesignerConfigBuilder`. Name the file descriptively (e.g., `customer_reviews.py`). Use PEP 723 inline metadata for dependencies.

```python
# /// script
# dependencies = [
#   "data-designer", # always required
#   "pydantic", # only if this script imports from pydantic
#   # add additional dependencies here
# ]
# ///
import data_designer.config as dd
from pydantic import BaseModel, Field


# Use Pydantic models when the output needs to conform to a specific schema
class MyStructuredOutput(BaseModel):
    field_one: str = Field(description="...")
    field_two: int = Field(description="...")


# Use custom generators when built-in column types aren't enough
@dd.custom_column_generator(
    required_columns=["col_a"],
    side_effect_columns=["extra_col"],
)
def generator_function(row: dict) -> dict:
    # add custom logic here that depends on "col_a" and update row in place
    row["name_in_custom_column_config"] = "custom value"
    row["extra_col"] = "extra value"
    return row


def load_config_builder() -> dd.DataDesignerConfigBuilder:
    config_builder = dd.DataDesignerConfigBuilder(
        # Declaring model configs programmatically here is the portable path:
        # it works for both local `run` and cluster `submit`, while the local
        # YAML registry alternative only works for `run`. The provider below
        # is a common default created during `nemo setup` — confirm it (or
        # discover others) with `nemo inference providers list`. See
        # references/nemo-platform-plugin-additions.md for the local-YAML alternative.
        model_configs=[
            dd.ModelConfig(
                alias="text",
                model="...",
                provider="default/nvidia-build",
                inference_parameters=dd.ChatCompletionInferenceParams(),
            ),
        ],
    )

    # Seed dataset (only if the user explicitly mentions a seed dataset path)
    # config_builder.with_seed_dataset(dd.LocalFileSeedSource(path="path/to/seed.parquet"))

    # config_builder.add_column(...)
    # config_builder.add_processor(...)

    return config_builder
```

Only include Pydantic models, custom generators, seed datasets, and extra dependencies when the task requires them. Prefer including `model_configs` when the dataset uses LLM columns — declaring it in the script keeps the config portable between local `run` and cluster `submit`, while the local YAML registry alternative only works for `run`.

安装 nemo-data-designer-plugin

下载技能文件并将其解压到 .claude/skills/ 目录中。

下载ZIP

克隆仓库并复制技能文件到您的项目中。

git clone https://github.com/NVIDIA/skills/tree/main/skills/nemo-data-designer-plugin # Copy SKILL.md to your .claude/skills/ directory

复制 复制
快速设置: 将技能文件夹复制到 .claude/skills/ Claude 会自动检测并使用该技能
仓库 NVIDIA/skills

相关技能

microservices-patterns
更新时间 2026-06-29
jpa-patterns
更新时间 2026-06-30
fabric-lakehouse
更新时间 2026-06-30
prisma-expert
更新时间 2026-06-29
OR