Skip to content

fix: normalize Python-style booleans in LLM JSON responses#1374

Open
JasonOA888 wants to merge 2 commits intomicrosoft:mainfrom
JasonOA888:fix/issue-916-python-bool-json
Open

fix: normalize Python-style booleans in LLM JSON responses#1374
JasonOA888 wants to merge 2 commits intomicrosoft:mainfrom
JasonOA888:fix/issue-916-python-bool-json

Conversation

@JasonOA888
Copy link
Copy Markdown

@JasonOA888 JasonOA888 commented Apr 1, 2026

Fixes #916

Some LLM providers (e.g. Volcengine) return Python-style booleans (True/False/None) instead of JSON-standard (true/false/null). This causes json.loads to fail with JSONDecodeError.

Changes:

  • rdagent/core/utils.py: Pre-process responses in parse_json() to normalize Python-style literals before parsing
  • rdagent/log/utils/init.py: Same normalization in extract_json()

📚 Documentation preview 📚: https://RDAgent--1374.org.readthedocs.build/en/1374/

…consumers

Messages tagged with 'evolving code' were stored under the full msg.tag
key (e.g. 'development.evoving code') but downstream code reads from
state.msgs[round]['evolving code']. This caused the UI to always show
an empty evolving code list.

Fixes microsoft#1021
Some LLM providers (e.g. Volcengine) return Python-style booleans
(True/False/None) instead of JSON-standard (true/false/null). This
causes json.loads to fail with JSONDecodeError.

Fixes microsoft#916
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.

Json loads failed when LLM outputs contain boolean value

2 participants