Skip to content

fix: validate structured output with strict models - #16

Merged
varin-nair-factory merged 1 commit into
mainfrom
fix/python-structured-output-validation
Aug 20, 2026
Merged

fix: validate structured output with strict models#16
varin-nair-factory merged 1 commit into
mainfrom
fix/python-structured-output-validation

Conversation

@varin-nair-factory

Copy link
Copy Markdown
Contributor

Summary

  • thaw immutable structured-output containers before Pydantic validation while retaining the frozen raw result
  • add streaming regression coverage for strict nested models and list fields
  • make the structured-output example deterministic, tool-free, and bounded to 60 seconds

Why

Structured output notifications are frozen into mappingproxy and tuple containers before local adaptation. Strict Pydantic models reject those container types even when the JSON values are valid. The previous example prompt also invited a repository review, causing tool loops and timeouts instead of a bounded demonstration.

Validation

  • pytest tests/test_v5_public_models.py tests/test_v5_streaming_core.py -q (131 passed, 4 skipped)
  • full pytest -q (1498 passed, 15 skipped)
  • ruff check .
  • mypy
  • pyright
  • live examples/structured_output_model.py against production
  • live strict nested-model structured-output probe against production

Thaw immutable JSON containers before Pydantic validation while preserving the frozen raw result. Make the live example deterministic and add strict nested streaming coverage.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
@varin-nair-factory varin-nair-factory self-assigned this Aug 20, 2026
@varin-nair-factory
varin-nair-factory merged commit 754e7b5 into main Aug 20, 2026
@varin-nair-factory
varin-nair-factory deleted the fix/python-structured-output-validation branch August 20, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants