Accept valid bare JSON in structured response recipes
メンテナーはふだん 1 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start with packages/data-designer-engine/src/data_designer/engine/models/recipes/response_recipes.py and trace LLMResponseParser through packages/data-designer-engine/src/data_designer/engine/models/parsers/postprocessors.py, especially merge_text_blocks and deserialize_json_code. Run the reproduction in the issue for both recipes. Done means valid bare JSON is accepted and schema-validated as a fallback, while fenced JSON and invalid or prose-embedded responses retain their existing behavior.
索引モデルが issue の本文から書いたものです。
説明
Priority Level
Medium (Annoying but has workaround)
Describe the bug
While using Data Designer 0.9.1 for structured-output columns in NeMo Anonymizer, we encountered model responses containing valid bare JSON that were rejected because they were not wrapped in a Markdown json code fence. Wrapping the same response in a fence made it parse successfully.
This is reproducible with both PydanticResponseRecipe and StructuredResponseRecipe, without making any model calls. A formatting-only difference can therefore cause a valid structured response to fail parsing.
Steps/Code to reproduce bug
With data-designer==0.9.1 installed:
from pydantic import BaseModel
from data_designer.engine.models.recipes.response_recipes import (
PydanticResponseRecipe,
StructuredResponseRecipe,
)
class Result(BaseModel):
answer: int
raw = '{"answer": 42}'
recipes = (
PydanticResponseRecipe(data_type=Result),
StructuredResponseRecipe(json_schema=Result.model_json_schema()),
)
for recipe in recipes:
for label, response in (
("bare", raw),
("fenced", f"```json\n{raw}\n```"),
):
try:
print(type(recipe).__name__, label, "OK", recipe.parse(response))
except Exception as exc:
print(type(recipe).__name__, label, type(exc).__name__, str(exc))
Actual output:
PydanticResponseRecipe bare ParserException No parsable JSON structure within ```json markdown fence.
PydanticResponseRecipe fenced OK answer=42
StructuredResponseRecipe bare ParserException No parsable JSON structure within ```json markdown fence.
StructuredResponseRecipe fenced OK {'answer': 42}
Expected behavior
Both recipes should accept a response consisting entirely of valid bare JSON as a fallback when fenced JSON parsing finds no usable JSON block. The parsed value must still pass the recipe's existing schema validation.
Existing fenced JSON behavior should continue to work. This request does not require extracting JSON embedded in arbitrary prose or accepting schema-invalid responses.
Agent Diagnostic / Prior Investigation
- An agent ran the reproduction above against
data-designer-engine==0.9.1and confirmed the output for both recipes. - Inspected the tagged v0.9.3 source and the local main checkout at
d2470a43dcaf8c5d3babbc0fd2f8631139d40509; both recipes retain the fenced-block parsing path. - In
packages/data-designer-engine/src/data_designer/engine/models/recipes/response_recipes.py, both recipes useLLMResponseParserwithmerge_text_blocksanddeserialize_json_code, then select aStructuredDataBlockbefore schema validation. - In
packages/data-designer-engine/src/data_designer/engine/models/parsers/postprocessors.py,deserialize_json_codeprocesses onlyCodeBlockobjects whose language isjson. Bare JSON remains a text block, leaving no structured block for the recipe to validate. - Searched the current documentation and GitHub issues/PRs for bare JSON and code-fence parsing; no matching issue or documented bare-JSON fallback was found.
Additional context
We will implement the fallback and contribute a PR with regression tests for both recipes.
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
- 主要言語
- Python
- スター
- 2.3k
- フォーク
- 219
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 38
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
NVIDIA-NeMo/DataDesigner のほかの issue
-
docs: required_columns description is incomplete for LLM and multimodal columns対応中かも @nightcityblade が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
NVIDIA-NeMo/DataDesigner#1002 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
NVIDIA-NeMo/DataDesigner#995 ·
メンテナーはふだん 1 日以内に返信
-
enforce \from future import annotations` via ruff FA102 rule`対応中かも @chethanuk が 28 日前に担当しました。 オープンtask
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NVIDIA-NeMo/DataDesigner#760 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 63/100
NVIDIA-NeMo/DataDesigner#1001 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 53/100
NVIDIA-NeMo/DataDesigner#996 ·
メンテナーはふだん 1 日以内に返信
NVIDIA-NeMo/DataDesigner の issue をすべて見る
似ている issue
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
ansys/pydpf-core#3547 ·
メンテナーはふだん 1 日以内に返信
-
core
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
vectorize-io/hindsight#5457 ·
メンテナーはふだん 1 日以内に返信
-
[Bug]: LangChain drops OpenAI Responses text blocks from session recording対応中かも @ktz03 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
volcengine/OpenViking#5806 ·
メンテナーはふだん 1 日以内に返信
-
HTML: <template> content is extracted as document text対応中かも @ryanmeowy が今日担当しました。 オープンbug html
難易度 1/5 1時間未満 初心者へのやさしさ 82/100
docling-project/docling#4714 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
APIv2 event data accepts a non-string reply and a NaN upper_bound対応中かも @awss1i が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
freedomofpress/securedrop#7946 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信