Skip to content

Require doc_type and summary in the AI output schema - #5

Merged
ridaken merged 1 commit into
mainfrom
require-doctype-summary
Jul 2, 2026
Merged

Require doc_type and summary in the AI output schema#5
ridaken merged 1 commit into
mainfrom
require-doctype-summary

Conversation

@ridaken

@ridaken ridaken commented Jul 2, 2026

Copy link
Copy Markdown
Owner

Fixes doc_type (and summary) coming back empty. Both were in the response schema but not in required, so the model omitted them under constrained generation and pydantic defaulted them to empty strings.

Change

  • Every property is now required (also makes the schema OpenAI strict-mode compliant, so it's portable to cloud providers).
  • doc_type and summary get minLength: 1 so the model can't satisfy the constraint with an empty string.
  • date stays nullable; tags may be empty.
  • Prompt updated to flag both as required (never empty).

Verified live

Against a vision-enabled llama-server (Qwen3.6-35B-A3B + mmproj), doc_type is now populated (drawing / receipt / invoice) where it was previously blank on every run. summary is enforced the same way; the dateless drawing correctly has a null date.

107 tests, 96% coverage, ruff clean.

🤖 Generated with Claude Code

Both were in the schema but not required, so the model omitted them under constrained generation and pydantic defaulted them to empty strings. Mark every field required (also makes the schema OpenAI strict-mode compliant / portable to cloud providers) and add minLength 1 to doc_type and summary so the model cannot satisfy the constraint with an empty string. date stays nullable; tags may be empty. Prompt updated to flag both as required.

Verified live against a vision-enabled llama-server (Qwen3.6-35B + mmproj): doc_type now populated as drawing/receipt/invoice where it was previously blank.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@ridaken
ridaken merged commit 0850516 into main Jul 2, 2026
4 checks passed
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.

1 participant