feat(ai): structured outputs — response_format json_schema for JSON-returning calls where the provider supports it
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 25/100
Research direction
Start in config/ActiveModelSettings.java to see how per-model flags are declared, then look at the @RegisterAiService request options on PrReviewer, FindingVerifier and PrSummarizer. Add the structured-outputs flag with a default of off and an unchanged prompt path when it is off. Done means a flagged run against a supporting provider produces no salvage activations in tests, and startup rejects the flag on unsupported endpoints.
Written by the indexing model from the issue text.
Description
Split out of #668 so each deliverable can be scheduled and closed independently.
Problem Statement
Every JSON-returning call (review, verifier, summary — and the resolution check once #667 lands) spends significant prompt space specifying output shape: "Respond ONLY with valid JSON…", full schemas, field rules. And because the shape is only requested, malformed output needs the parse-salvage paths and TruncatedResponseSalvager machinery. With the multi-call decomposition (#669) multiplying calls, this boilerplate is paid on every one of them.
Proposed Solution
Where the configured OpenAI-compatible provider supports response_format: json_schema, request it for the JSON-returning calls via LangChain4j request options:
- Per-model capability flag:
thrillhousebot.ai.models.<model>.structured-outputs(default off), following the existing per-model settings pattern inActiveModelSettings. - Prompt-side format instructions shrink to intent only; the schema moves into the request.
- Graceful degradation: flag off or provider unsupported → current prompt-specified JSON + salvage paths, byte-identical behavior.
- Truncation salvage stays regardless —
finish_reason=lengthcan still cut a schema-valid stream mid-array.
Interacts with #30 (native multi-provider support), which needs the same per-provider capability surface; whichever lands first should establish it.
Touchpoints
config/ThrillhouseConfig.java / config/ActiveModelSettings.java (capability flag), the @RegisterAiService request options for PrReviewer / FindingVerifier / PrSummarizer, review/DiffBudgetPlanner.java (overhead estimation shrinks when format boilerplate leaves the prompts).
Acceptance criteria
- With the flag on against a supporting provider: zero parse-salvage activations in tests; measured prompt-token reduction on every JSON-returning call.
- With the flag off or an unsupported provider: behavior unchanged.
- Startup validation rejects the flag on models where the endpoint reports no support, rather than failing at review time.
Alternatives Considered
- Keep prompt-specified JSON everywhere — simplest, but the boilerplate and salvage complexity now multiply across the decomposed pipeline.
- Dominant language
- Java
- Stars
- 35
- Forks
- 7
- Avg merge
- 9h 23m
- Merged PRs (30d)
- 154
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from devops-thiago/ThrillhouseBot
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
devops-thiago/ThrillhouseBot#1093 ·
Maintainers usually reply within 1 day
-
documentation enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
devops-thiago/ThrillhouseBot#321 ·
Maintainers usually reply within 1 day
-
documentation
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
devops-thiago/ThrillhouseBot#46 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 58/100
devops-thiago/ThrillhouseBot#1095 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 4/5 3-5 days Newbie friendliness 58/100
devops-thiago/ThrillhouseBot#1094 ·
Maintainers usually reply within 1 day
All issues in devops-thiago/ThrillhouseBot
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
bug new windows
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
GantMan/jail-monkey#380 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
objectionary/jucs#145 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
objectionary/lints#1559 ·
Maintainers usually reply within 2 days