Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.

// Remove leading and trailing whitespace
text = text.trim();

Expand Down