NVIDIA-NeMo / NVIDIA-NeMo/DataDesigner

DataDesigner.validate raises ValueError for valid Jinja prompts containing literal braces

Open Beginner friendly
#904 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
2.2k
Forks
211
Avg merge
2d 6h
Merged PRs (30d)
40

Description

Priority Level

Medium (Annoying but has workaround)

Describe the bug

DataDesigner.validate() raises an uncaught ValueError when an LLM prompt or system prompt contains an unmatched literal brace that is valid as Jinja text.

Validation passes each prompt through string.Formatter().parse() to detect f-string-style references. Python's formatter rejects unmatched braces before Data Designer can return its normal validation result.

Example error:

ValueError: Single '}' encountered in format string

Steps/Code to reproduce bug

from pathlib import Path

from data_designer.config.column_configs import LLMTextColumnConfig, SamplerColumnConfig
from data_designer.config.config_builder import DataDesignerConfigBuilder
from data_designer.config.models import ChatCompletionInferenceParams, ModelConfig, ModelProvider
from data_designer.config.sampler_params import CategorySamplerParams, SamplerType
from data_designer.engine.secret_resolver import PlaintextResolver
from data_designer.interface.data_designer import DataDesigner


builder = DataDesignerConfigBuilder(
    model_configs=[
        ModelConfig(
            alias="stub-model",
            model="stub-model",
            provider="stub-provider",
            inference_parameters=ChatCompletionInferenceParams(),
        )
    ]
)
builder.add_column(
    SamplerColumnConfig(
        name="topic",
        sampler_type=SamplerType.CATEGORY,
        params=CategorySamplerParams(values=["science"]),
    )
)
builder.add_column(
    LLMTextColumnConfig(
        name="story",
        model_alias="stub-model",
        prompt="Write about {{ topic }}. End with a literal } brace.",
    )
)

designer = DataDesigner(
    artifact_path=Path("artifacts"),
    model_providers=[
        ModelProvider(
            name="stub-provider",
            endpoint="https://example.invalid/v1",
            api_key="unused",
        )
    ],
    secret_resolver=PlaintextResolver(),
)

designer.validate(builder)

No provider request is required. The call raises ValueError: Single '}' encountered in format string.

Expected behavior

Literal braces that are valid Jinja text should not break the f-string-reference advisory check. Validation should either succeed or return a normal Data Designer validation violation, not leak an exception from string.Formatter.

Agent Diagnostic / Prior Investigation

Reproduced through the public DataDesigner.validate() method on the current main branch. A normal Jinja prompt such as Write about {{ topic }}. succeeds as a negative control.

packages/data-designer-engine/src/data_designer/engine/validation.py calls _get_string_formatter_references() for each prompt. That helper iterates over Formatter().parse(template) without handling ValueError, so the advisory check can abort the full validation path.

The issue tracker was searched for Formatter().parse, unmatched braces, literal braces, and prompt validation. Related Jinja validation issues concern different failure modes and are not duplicates.

Additional context

The f-string advisory is secondary validation and should not reject syntax accepted by the configured Jinja renderer. Regression coverage should include both { and } literals in prompts and system prompts through the public validation API.

Checklist

  • I reproduced this issue or provided a minimal example
  • I searched the docs/issues myself, or had my agent do so
  • If I used an agent, I included its diagnostics above

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/data-designer-engine/src/data_designer/engine/validation.py, especially _get_string_formatter_references(), and trace how it is called by the public DataDesigner.validate() API. Add regression coverage for literal { and } in prompts and system prompts; done means validation returns normally without leaking Formatter ValueError.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.