Skip to content

[fix][plan] Fix parsing exception in ChatModelAction#634

Merged
wenjin272 merged 3 commits intoapache:mainfrom
twosom:clean_markdown_block
Apr 22, 2026
Merged

[fix][plan] Fix parsing exception in ChatModelAction#634
wenjin272 merged 3 commits intoapache:mainfrom
twosom:clean_markdown_block

Conversation

@twosom
Copy link
Copy Markdown
Contributor

@twosom twosom commented Apr 18, 2026

Linked issue: #633

Purpose of change

The ChatModelAction currently fails with a JsonParseException when an LLM returns a structured output wrapped in Markdown code blocks (e.g., json ... ). This happens because Jackson's ObjectMapper expects a valid JSON start character ({ or [) but encounters a backtick (`) instead.
so, I added a utility method to extract raw JSON string from LLM responses that include Markdown decorators.

Tests

Added some unit tests for clean llm response

API

Documentation

  • doc-needed
  • doc-not-needed
  • doc-included

@github-actions github-actions Bot added doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue. labels Apr 18, 2026
@twosom twosom force-pushed the clean_markdown_block branch from 1c567d0 to 18f2803 Compare April 18, 2026 02:46
@wenjin272
Copy link
Copy Markdown
Collaborator

Hi, @twosom, thanks for you work, LGTM.

Could you also add similar logic for the Python chat model action? We should maintain consistent behavior across built-in actions to avoid unexpected outcomes.

@twosom
Copy link
Copy Markdown
Contributor Author

twosom commented Apr 21, 2026

Could you also add similar logic for the Python chat model action? We should maintain consistent behavior across built-in actions to avoid unexpected outcomes.

Thank you for your comment @wenjin272. Yes, I will add similar logic to Python and write test cases as well.

@wenjin272
Copy link
Copy Markdown
Collaborator

LGTM

@wenjin272 wenjin272 merged commit 785c5f9 into apache:main Apr 22, 2026
23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc-not-needed Your PR changes do not impact docs fixVersion/0.3.0 The feature or bug should be implemented/fixed in the 0.3.0 version. priority/major Default priority of the PR or issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants