Pull requests / #1804
#1804 structured: one-string-field json_schema answered as plain text (opt-in), progress in structured keep-alives
open · @gt50 · 0 コメント · GitHub で見る
Setup & installServer & APIAMD / HIPDocumentationWindows
本文
## Title
Structured output: a one-string-field schema answered as plain text (opt-in), and progress in structured keep-alives
## Summary
Split out of #1789 (which now only carries the Windows AMD images), as AGENTS.md asks: one change per PR, a new feature opt-in.
## What changed
- **`"structured_plain_string": true` (opt-in):** a `json_schema` that is one required string field, with an optional description/title and no enum, pattern or length limit, is answered as plain text, and the server builds the object around it.
- Measured on a scanned rent roll (UD-IQ4_XS, temperature 0, a "write out every word on this page" prompt):
| Asked for | Result |
| --- | --- |
| `{"text": ...}` | the table inside the string, then the escaped newline 256 times instead of the page's last lines and the closing quote |
| plain text | the whole page in 165 tokens, ending on its own |
- A model that writes the JSON object anyway is taken at its word, and that object is validated as before; an invalid one is still an error. Not with tools.
- **Structured SSE keep-alives** now say how far the answer is (`: keep-alive: structured output buffered until it is validated, N pieces (M characters) written so far`), so a long answer can be told from a stuck one. They are SSE comments, which clients ignore.
- **Docs:** `docs/DETAILS.md`.
## Extra Notes
- **Default path:** without the setting, `prepare_format` writes the same directive and `validated_json` validates as before.
- **The one change everyone gets:** the text of the structured-stream keep-alive comments, once content has been written. It is comment text only; data lines and the result are unchanged. Happy to put that behind the setting too if you prefer.
- **Tests:** `serve/test_structured.py` covers the wrap (streamed and not), JSON-anyway, off by default, which schemas qualify, and the progress notes. All `serve` and setup test files pass on `main` fb58e0d.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
関連リンク
インストール・モデル・リリースへの站内リンク。