Skip to content

Update BeanOutputConverter.java #3927

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

chang6666
Copy link

Resolved the exceptional issue of converting the large model deployed locally with Ollama into a Java Bean.

Resolved the exceptional issue of converting the large model deployed locally with Ollama into a Java Bean.

Signed-off-by: James <[email protected]>
@@ -159,6 +159,7 @@ private void generateSchema() {
@Override
public T convert(@NonNull String text) {
try {
text = text.replaceAll("<think>[\\s\\s]*?</think>","")
Copy link
Member

@markpollack markpollack Jul 29, 2025

Choose a reason for hiding this comment

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

I think we are going to have to opt into this 'exclusion' in the output converter. I'd like to make this a pluggable stragtegy, who knows how many ways the thinking response will be done. is this from anthropic or deepseek?. we have to overhaul the whole code base to handle 'thinking' responses in the assistant messgae, but hacks like this are useful.

also missing semicolon

Copy link
Contributor

@YunKuiLu YunKuiLu Jul 29, 2025

Choose a reason for hiding this comment

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

Should it be \s and \S here?

Suggested change
text = text.replaceAll("<think>[\\s\\s]*?</think>","")
text = text.replaceAll("<think>[\\s\\S]*?</think>","");

Although this regex is simple, it's better to have unit tests.

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.

3 participants