Skip to content

fix: parse last XML answer in message completions - #2450

Open
zakazaka95 wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
zakazaka95:fix/xml-parser-message-last-answer
Open

fix: parse last XML answer in message completions#2450
zakazaka95 wants to merge 1 commit into
PrimeIntellect-ai:mainfrom
zakazaka95:fix/xml-parser-message-last-answer

Conversation

@zakazaka95

@zakazaka95 zakazaka95 commented Aug 26, 2026

Copy link
Copy Markdown

Summary

  • make XMLParser.parse_answer consistently select the last matching answer block for string and message completions
  • add regression coverage for multiple answer tags within one assistant message

Fixes #2447

Testing

  • pytest tests/test_xml_parser.py — 19 passed
  • Ruff check and format check passed for both changed files

Note

Fix XMLParser.parse_answer to use last <answer> tag in message completions

In parse_answer, assistant message content is now parsed with last=True, so the last matching answer tag is returned instead of the first. Adds a test confirming 45 is extracted from a message with multiple <answer> tags.

Macroscope summarized fcd1cdd.

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.

XMLParser.parse_answer is inconsistent between string and message completions

1 participant