refactor: migrate make_assumptions and distill_assumptions to structured output#168
Merged
neoneye merged 1 commit intoPlanExeOrg:mainfrom Mar 7, 2026
Merged
Conversation
…red output Remove manual json.loads(chat_response.message.content) calls in favor of using chat_response.raw (the Pydantic model returned by as_structured_llm). - make_assumptions.py: use ExpertDetails from chat_response.raw directly - distill_assumptions.py: use AssumptionDetails.model_dump() from chat_response.raw repair_json_util.py is now unreferenced by any task file.
Member
|
looks good |
HejEgonBot
pushed a commit
to VoynichLabs/PlanExe2026
that referenced
this pull request
Mar 7, 2026
…tions PR PlanExeOrg#168 migrated make_assumptions.py and distill_assumptions.py from json.loads(chat_response.message.content) to chat_response.raw (Pydantic model). However, when a local/small model echoes the schema instead of producing valid JSON (the schema-echo failure mode seen with GLM 4.7 Flash and Qwen 3.5-35B), as_structured_llm may return None for .raw. With the old code a clear ValueError('Invalid JSON response from LLM.') was raised and logged. With the new code, None.question_assumption_list raises AttributeError with no log entry, causing a silent exit-0 that leaves no output files and no error in the pipeline log. Fix: add an explicit None-guard immediately after reading chat_response.raw in both files, raising ValueError with a descriptive message that names the model compatibility issue. This restores the explicit failure signal so operators can diagnose which model is incompatible rather than seeing a silent stop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates two task files from manual JSON parsing to structured output using the existing
as_structured_llm+chat_response.rawpattern already used throughout the codebase (e.g.premise_attack.py,identify_potential_levers.py).Changes
make_assumptions.pyjson.loads(chat_response.message.content)with try/except blockchat_response.raw(typed asExpertDetails) directlyassumption_listfrom Pydantic model attributes instead of dict key accessexpert_details.model_dump()forjson_responsedistill_assumptions.pyjson.loads(chat_response.message.content)with try/except blockchat_response.raw.model_dump()directlyResult
repair_json_util.pyis now unreferenced by any task file. All assumption-related tasks now use the consistent structured output pattern.