Skip to content

fix(scicode): read assistant text blocks#1381

Merged
Yunnglin merged 2 commits into
modelscope:mainfrom
he-yufeng:fix/scicode-list-content
May 29, 2026
Merged

fix(scicode): read assistant text blocks#1381
Yunnglin merged 2 commits into
modelscope:mainfrom
he-yufeng:fix/scicode-list-content

Conversation

@he-yufeng
Copy link
Copy Markdown
Contributor

Summary

  • use ChatMessage.text when collecting SciCode assistant solutions
  • keep the existing markdown code-fence extraction behavior unchanged
  • add regression coverage for assistant messages whose content is stored as text blocks

Fixes #1380.

To verify

  • python -m py_compile evalscope\benchmarks\scicode\util.py tests\benchmark\test_scicode_util.py
  • python -m pytest tests\benchmark\test_scicode_util.py -q
  • python -m flake8 evalscope\benchmarks\scicode\util.py tests\benchmark\test_scicode_util.py
  • python -m yapf --diff evalscope\benchmarks\scicode\util.py tests\benchmark\test_scicode_util.py
  • git diff --check

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request simplifies the code extraction logic in evalscope/benchmarks/scicode/util.py by accessing message.text directly instead of casting message.content to a string. It also adds a unit test in tests/benchmark/test_scicode_util.py to verify that get_generated_code correctly handles assistant messages with text content blocks. There are no review comments to address, and the changes appear correct and complete.

@he-yufeng he-yufeng force-pushed the fix/scicode-list-content branch from 95ff96d to dad292d Compare May 29, 2026 09:49
Copy link
Copy Markdown
Collaborator

@Yunnglin Yunnglin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Fixed a minor yapf formatting issue and pushed the fix.

@Yunnglin
Copy link
Copy Markdown
Collaborator

I pushed a small formatting fix (yapf) to your branch — the list comprehension in util.py and the test file needed minor style adjustments to pass make lint. Everything else looks good!

@Yunnglin Yunnglin merged commit 846e583 into modelscope:main May 29, 2026
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.

测试数据集scicode报错AttributeError: 'list' object has no attribute 'replace'

2 participants