| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…nses Adds `if not response.choices: raise ValueError(...)` before every unguarded `.choices[0]` access in four files, preventing IndexError crashes when an LLM returns an empty choices list (ref issue algorithmicsuperintelligence#292). Files fixed: - optillm/plugins/deep_research/research_engine.py (7 sites) - optillm/plugins/spl/evaluation.py (2 sites) - optillm/mars/agent.py (3 sites) - optillm/plugins/coc_plugin.py (4 sites) Verified with pact_sheaf: all 16 openai-chat#choices-nonempty violations resolved (Ȟ¹ = 0, Z3 UNSAT certificate on fixed files).
|
|
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Summary
Fixes unguarded .choices[0] accesses in four files that crash with IndexError when an LLM returns an empty choices list. This addresses the class of errors reported in #292 (json response error — the choices list can be empty on API errors, rate-limit responses, or model refusals).
Each fix adds an explicit guard immediately before the first .choices[0] access in each call-site:
This turns a cryptic IndexError: list index out of range into a clear, actionable error message.
Files changed
Total: 16 unguarded access sites eliminated.
Verification
Fixes were verified with pact_sheaf, a sheaf-cohomological contract checker:
Before fix: pact reported h1_semantic = 7, 3, 3, 3 across the four files.
After fix: h1_semantic = 0, 0, 0, 0 for choices-spec violations.
Test plan