twosom opened a new issue, #633: URL: https://github.com/apache/flink-agents/issues/633
### Search before asking - [x] I searched in the [issues](https://github.com/apache/flink-agents/issues) and found nothing similar. ### Description In `ChatModelAction.generateStructuredOutput`, the agent attempts to parse the LLM's response using Jackson's `ObjectMapper`. However, if the LLM includes Markdown formatting (e.g., ```json ... ```) in its response, the parser fails with a JsonParseException because it encounters the backtick character instead of a valid JSON start token ({ or [). ## Stack Trace ```text Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('`' (code 96)): expected a valid value (JSON String, Number, Array, Object or token 'null', 'true' or 'false') at [Source: REDACTED; line: 1, column: 1] at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleOddValue(ReaderBasedJsonParser.java:2054) at org.apache.flink.agents.plan.actions.ChatModelAction.generateStructuredOutput(ChatModelAction.java:213) ... ``` At `ChatModelAction`, the code directly passes the raw string from the LLM to `objectMapper.readValue()`. While some LLMs are instructed to return raw JSON, they often default to Markdown-formatted responses. The current implementation lacks a "cleaning" step to strip these common Markdown delimiters. ### How to reproduce use `Gemma4` model ### Version and environment latest dev branch ### Are you willing to submit a PR? - [ ] I'm willing to submit a PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
