Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Accept valid bare JSON in structured response recipes

Đã đóng
#971 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@lipikaramaswamy đang làm issue này rồi.

Từ ngày 30/9/2026.

  • #972 của @lipikaramaswamy — đang mở

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
78/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
backend-api-design

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
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.1 and 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 use LLMResponseParser with merge_text_blocks and deserialize_json_code, then select a StructuredDataBlock before schema validation.
  • In packages/data-designer-engine/src/data_designer/engine/models/parsers/postprocessors.py, deserialize_json_code processes only CodeBlock objects whose language is json. 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
Ngôn ngữ chính
Python
Star
2.4k
Fork
241
Merge trung bình
1 ngày 19 phút
Pull request đã merge (30 ngày)
84

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của NVIDIA-NeMo/DataDesigner

Tất cả issue của NVIDIA-NeMo/DataDesigner

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.