Skip to content

Conversation

@mr-ryan-james
Copy link
Contributor

@mr-ryan-james mr-ryan-james commented Apr 24, 2025

Summary

This PR introduces the "Enable Reasoning Effort" setting specifically for the "OpenAI Compatible" provider configuration.

Motivation

Some OpenAI-compatible endpoints (ie Azure) support a reasoning_effort parameter to influence model behavior, potentially affecting response quality, latency, and cost. This setting was missing for the generic "OpenAI Compatible" provider, limiting user control when interacting with such endpoints through Roo-Code. I found this particularly useful for my own workflows.

Changes

  • UI: Added a checkbox ("Enable Reasoning Effort") and a dropdown (ReasoningEffort component) to the "OpenAI Compatible" provider settings section in webview-ui/src/components/settings/ApiOptions.tsx.
  • Logic:
    • The ReasoningEffort dropdown is only shown when the checkbox is enabled.
    • When enabled, the selected value (low, medium, high, auto) is stored in apiConfiguration.openAiCustomModelInfo.reasoningEffort.
    • When disabled (checkbox unchecked), the reasoningEffort property is explicitly removed from apiConfiguration.openAiCustomModelInfo to ensure no parameter is sent.
    • The OpenAiHandler (src/api/providers/openai.ts) now reads this setting and includes the reasoning_effort parameter in the API request payload only if enableReasoningEffort is true and a value is set.
  • Testing:
    • Added UI unit tests to webview-ui/src/components/settings/__tests__/ApiOptions.test.tsx to verify the checkbox and dropdown logic updates the configuration state correctly.
    • Added integration tests to src/api/providers/__tests__/openai.test.ts to verify that the reasoning_effort parameter is correctly included or excluded from the mocked API request payload based on the configuration.

Impact for Users

  • This change is opt-in. Users who do not check the "Enable Reasoning Effort" box will experience no change in behavior; the reasoning_effort parameter will not be sent.
  • Users connecting to OpenAI-compatible endpoints that support reasoning effort can now configure this parameter via the Roo-Code settings UI.

All tests pass.


Important

Add "Enable Reasoning Effort" setting to OpenAI Compatible provider, with UI, logic, and tests for handling the parameter.

  • UI:
    • Added "Enable Reasoning Effort" checkbox and ReasoningEffort dropdown to OpenAI Compatible provider settings in ApiOptions.tsx.
  • Logic:
    • ReasoningEffort dropdown appears only when checkbox is checked.
    • Selected value stored in apiConfiguration.openAiCustomModelInfo.reasoningEffort.
    • Unchecking removes reasoningEffort from apiConfiguration.openAiCustomModelInfo.
    • OpenAiHandler in openai.ts includes reasoning_effort in API request if enabled.
  • Testing:
    • Added unit tests in ApiOptions.test.tsx for checkbox and dropdown logic.
    • Added integration tests in openai.test.ts for API request payload validation.

This description was created by Ellipsis for eecd314f33c2ad753b25596324e1bfc24dccaa99. You can customize this summary. It will automatically update as commits are pushed.

@changeset-bot
Copy link

changeset-bot bot commented Apr 24, 2025

🦋 Changeset detected

Latest commit: c2c8075

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
roo-cline Minor

Not sure what this means? Click here to learn what changesets are.

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

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 24, 2025
@ellipsis-dev
Copy link
Contributor

ellipsis-dev bot commented Apr 24, 2025

The changes in this pull request are cohesive and related to the addition of the "Reasoning Effort" feature for the OpenAI Compatible provider. Therefore, it does not need to be split into smaller pull requests. The changes include updates to settings, tests, and UI components, all of which are part of implementing this new feature.

@dosubot dosubot bot added the enhancement New feature or request label Apr 24, 2025
@mr-ryan-james mr-ryan-james force-pushed the feat-reasoning_effort_openai_compatible branch from eecd314 to 25fcad6 Compare April 24, 2025 07:11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made changes to this, but now that I think about it, i did not regression test the one other use case that was already using it, but all the unit tests pass, so I am relying on those passing to ensure I didn't cause any regressions

I did not test this usage:

			{REASONING_MODELS.has(selectedModelId) && (
				<ReasoningEffort
					apiConfiguration={apiConfiguration}
					setApiConfigurationField={setApiConfigurationField}
				/>
			)}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if other languages' translations are required prior to merge

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice. We get around to it eventually. Thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I used AI to add the missing translations to the various internationalization files

@adamhill
Copy link
Contributor

Thanks for the great description!

@mr-ryan-james mr-ryan-james force-pushed the feat-reasoning_effort_openai_compatible branch from 25fcad6 to 5cb8f16 Compare April 24, 2025 07:35
@mr-ryan-james
Copy link
Contributor Author

mr-ryan-james commented Apr 24, 2025

Looking into the failing unit tests, will update the PR

Update: all tests passing now

@mr-ryan-james mr-ryan-james force-pushed the feat-reasoning_effort_openai_compatible branch from 5cb8f16 to e8efe1f Compare April 24, 2025 07:45
Copy link
Contributor Author

@mr-ryan-james mr-ryan-james Apr 24, 2025

Choose a reason for hiding this comment

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

I added this in order to get it to pass the windows extension tests, otherwise this change is not related to the core functionality I added

@mr-ryan-james mr-ryan-james force-pushed the feat-reasoning_effort_openai_compatible branch from e8efe1f to 4ee6a29 Compare April 24, 2025 08:34
@cte
Copy link
Collaborator

cte commented Apr 24, 2025

Nice! This looks pretty good to me. I'll test it out and merge if everything looks 👌

@mr-ryan-james mr-ryan-james force-pushed the feat-reasoning_effort_openai_compatible branch 2 times, most recently from 9872ade to f860a42 Compare April 26, 2025 13:53
@mr-ryan-james mr-ryan-james force-pushed the feat-reasoning_effort_openai_compatible branch from f860a42 to 04f5332 Compare April 26, 2025 14:01
@mrubens
Copy link
Collaborator

mrubens commented Apr 28, 2025

@cte mind checking this today so we can get it into the release? Thank you!

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Apr 28, 2025
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Apr 28, 2025
@dosubot dosubot bot removed the size:XL This PR changes 500-999 lines, ignoring generated files. label Apr 28, 2025
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Apr 28, 2025
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 28, 2025
@cte cte merged commit 2075f26 into RooCodeInc:main Apr 28, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap Apr 28, 2025
@hannesrudolph
Copy link
Collaborator

@mr-ryan-james are you on discord?

@mr-ryan-james
Copy link
Contributor Author

@hannesrudolph Yes, I am on Discord. My username is ryan.james
Feel free to reach out if you need something

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:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants