Skip to content

Conversation

@lightrabbit
Copy link
Contributor

@lightrabbit lightrabbit commented Mar 11, 2025

Context

Implemented parsing support for think tags output by openai-compatible API.

Similar to PR #1080, not only the deepseek-r1:* models in Ollama use think tags to output reasoning content, but the QwQ model will also use the same approach to output reasoning content. When using vendors like Alibaba Cloud Baolian or VolcEngine, these providers will directly output content containing think tags instead of placing them in the reasoning field. Therefore, it's also necessary for OpenAI-compatible APIs to support processing think tags.

Implementation

Similar to PR #1080, I added XmlMatcher to src/api/providers/openai.ts, and it now works properly.

Screenshots

Provider Settings

before after
Before After

How to Test

  • Add support for OpenAI-compatible API providers that support deepseek-r1 or QwQ models.
  • Ask the model a question that triggers its reasoning.

Get in Touch


Important

Adds support for parsing think tags in OpenAI-compatible APIs using XmlMatcher in openai.ts for deepseek-r1 and QwQ models.

  • Behavior:
    • Adds support for parsing think tags in OpenAI-compatible APIs for deepseek-r1 and QwQ models.
    • Uses XmlMatcher in OpenAiHandler in openai.ts to differentiate between reasoning and text content.
  • Implementation:
    • Integrates XmlMatcher to process streamed content, yielding reasoning or text based on think tags.
    • Updates createMessage() in OpenAiHandler to utilize XmlMatcher for processing streamed responses.
  • Misc:
    • No changes to non-streaming message handling.

This description was created by Ellipsis for 7114cef. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Mar 11, 2025

⚠️ No Changeset found

Latest commit: 7114cef

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. enhancement New feature or request labels Mar 11, 2025
Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

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

Thanks!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Mar 12, 2025
@mrubens mrubens merged commit c8b3095 into RooCodeInc:main Mar 12, 2025
16 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants