Skip to content

Conversation

liugddx
Copy link
Contributor

@liugddx liugddx commented Oct 19, 2025

Close #4650

Thank you for taking time to contribute this pull request!
You might have already read the contributor guide, but as a reminder, please make sure to:

  • Add a Signed-off-by line to each commit (git commit -s) per the DCO
  • Rebase your changes on the latest main branch and squash your commits
  • Add/Update unit tests as needed
  • Run a build and make sure all tests pass prior to submission

For more details, please check the contributor guide.
Thank you upfront!

@nicolaskrier
Copy link
Contributor

nicolaskrier commented Oct 19, 2025

Thanks @liugddx for your contribution on this issue!

Just a heads-up: there’s already an open PR (#3927) addressing the same topic. I tested the changes proposed here, but unfortunately, they didn’t work as expected for the qwen3:14b model running locally on my Ollama instance.

Could you take a look at this comment, which suggests a slightly different approach? It would be great to find a solution that works for both qwen3 and nova models.

@liugddx
Copy link
Contributor Author

liugddx commented Oct 20, 2025

Thanks @liugddx for your contribution on this issue!

Just a heads-up: there’s already an open PR (#3927) addressing the same topic. I tested the changes proposed here, but unfortunately, they didn’t work as expected for the qwen3:14b model running locally on my Ollama instance.

Could you take a look at this comment, which suggests a slightly different approach? It would be great to find a solution that works for both qwen3 and nova models.

Thank you for your reply. I have already made it compatible with Qwen. If possible, please give it another try.

* This allows for a flexible pipeline of text cleaning operations.
*
* @author liugddx
* @since 1.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

It will be probably 1.1.0. To be confirmed.

private static ResponseTextCleaner createDefaultTextCleaner() {
return CompositeResponseTextCleaner.builder()
.addCleaner(new WhitespaceCleaner())
.addCleaner(new ThinkingTagCleaner())
Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure that ThinkingTagCleaner should be added by default, especially for the non-thinking models.


String result = text;
for (Pattern pattern : this.patterns) {
result = pattern.matcher(result).replaceAll("");
Copy link
Contributor

Choose a reason for hiding this comment

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

You could consider breaking once the replacements have been done.

@nicolaskrier
Copy link
Contributor

I have performed new tests with your recent modifications and it works well. Well done!

I have added a few review comments. As a contributor myself, I think it would be good to check with a member of this project to ensure it aligns with the project’s long-term goals. Let me know if you’d like to discuss any of my comments!

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.

BeanOutputConverter does not work with Amazon Nova models

2 participants