Skip to content

Fix ReAct parser keyword detection#22148

Draft
onyx679 wants to merge 1 commit into
run-llama:mainfrom
onyx679:codex/fix-react-parser-keyword-detection
Draft

Fix ReAct parser keyword detection#22148
onyx679 wants to merge 1 commit into
run-llama:mainfrom
onyx679:codex/fix-react-parser-keyword-detection

Conversation

@onyx679

@onyx679 onyx679 commented Jun 26, 2026

Copy link
Copy Markdown

Summary

  • Anchor ReAct parser keyword detection to line starts for Thought:, Action:, and Answer:
  • Add a regression test for final-answer parsing when the thought text contains the phrase Action:

Why

ReActOutputParser.parse() intended to detect properly formatted keywords at line boundaries, but the regex searched for keywords anywhere in the output. A thought like The phrase Action: is part of this thought could be misclassified as a tool call and fail parsing.

Tests

  • python -m pytest llama-index-core/tests/agent/react/test_react_output_parser.py -q
  • python -m pytest llama-index-core/tests/agent/react -q

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.

1 participant