Skip to content

Conversation

@AlexandruSmirnov
Copy link
Contributor

@AlexandruSmirnov AlexandruSmirnov commented Jun 9, 2025

  • Add checkbox control to enable/disable max tokens in API requests
  • Update OpenAI compatible provider UI with max tokens option
  • Add test coverage for the new max tokens functionality
  • Update localization files across all supported languages

Related GitHub Issue

Closes: #4036

Description

Add max tokens checkbox option for OpenAI compatible provider

  • Add checkbox control to enable/disable max tokens in API requests
  • Update OpenAI compatible provider UI with max tokens option
  • Add test coverage for the new max tokens functionality
  • Update localization files across all supported languages

Test Procedure

Type of Change

  • [x ] 🐛 Bug Fix: Non-breaking change that fixes an issue.
  • New Feature: Non-breaking change that adds functionality.
  • 💥 Breaking Change: Fix or feature that would cause existing functionality to not work as expected.
  • ♻️ Refactor: Code change that neither fixes a bug nor adds a feature.
  • 💅 Style: Changes that do not affect the meaning of the code (white-space, formatting, etc.).
  • 📚 Documentation: Updates to documentation files.
  • ⚙️ Build/CI: Changes to the build process or CI configuration.
  • 🧹 Chore: Other changes that don't modify src or test files.

Pre-Submission Checklist

  • [x ] Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Code Quality:
    • My code adheres to the project's style guidelines.
    • There are no new linting errors or warnings (npm run lint).
    • All debug code (e.g., console.log) has been removed.
  • Testing:
    • New and/or updated tests have been added to cover my changes.
    • All tests pass locally (npm test).
    • The application builds successfully with my changes.
  • Branch Hygiene: My branch is up-to-date (rebased) with the main branch.
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Changeset: A changeset has been created using npm run changeset if this PR includes user-facing changes or dependency updates.
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Documentation Updates

Additional Notes

Get in Touch

sandruarmy


Important

Add a checkbox in the UI to enable/disable max tokens in API requests for OpenAI compatible providers, with corresponding tests and localization updates.

  • UI Changes:
    • Add checkbox to OpenAICompatible.tsx for enabling/disabling max tokens in API requests.
    • Update localization files (settings.json) in multiple languages to include includeMaxOutputTokens and includeMaxOutputTokensDescription.
  • Testing:
    • Add tests in OpenAICompatible.spec.tsx to verify checkbox behavior and state changes.
    • Add tests in openai.spec.ts to ensure API requests include/exclude max tokens based on checkbox state.
  • Functionality:
    • Modify openai.ts to conditionally include max_tokens in API requests based on checkbox state and Azure AI Inference usage.

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

- Add checkbox control to enable/disable max tokens in API requests
- Update OpenAI compatible provider UI with max tokens option
- Add test coverage for the new max tokens functionality
- Update localization files across all supported languages
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. UI/UX UI/UX related or focused labels Jun 9, 2025
@daniel-lxs daniel-lxs added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 9, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Needs Prelim Review] in Roo Code Roadmap Jun 9, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Hey @AlexandruSmirnov, thank you for working on this issue.

I took a look at your PR left a couple of questions and suggestions.
Let me know what you think!

Also I noticed there's a test failing regarding the translations, can you take a look?

@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 9, 2025
- Fixed max_tokens support for O3 models in OpenAI provider
- Refactored OpenAI provider to eliminate code duplication with addMaxTokensIfNeeded helper
- Made Azure AI Inference Service respect the includeMaxTokens checkbox setting
- Applied code optimizations to reduce redundancy
- Added missing translations for includeMaxTokens in Catalan and German locales
- Updated tests to cover new functionality
@daniel-lxs daniel-lxs added PR - Changes Requested and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 9, 2025
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 9, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 9, 2025
- O3 family models (o3-mini, o3) do not support max_tokens parameter
- All other models use max_completion_tokens instead of deprecated max_tokens
- Remove unused isAzureAiInference parameter from addMaxTokensIfNeeded
- Update tests to reflect correct behavior for each model type

Per OpenAI docs: max_tokens is deprecated and not compatible with o-series models
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 10, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 10, 2025
@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 10, 2025
- O3 models now include max_completion_tokens when includeMaxTokens is true
- Updated tests to reflect that O3 models support max_completion_tokens
- This addresses PR feedback that O3 models should use addMaxTokensIfNeeded()
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Changes Requested] in Roo Code Roadmap Jun 10, 2025
- Added more detailed comments explaining that O3 models support the modern max_completion_tokens parameter
- Clarified that this allows O3 models to limit response length when includeMaxTokens is enabled
- Emphasized that max_tokens is deprecated in favor of max_completion_tokens
@AlexandruSmirnov
Copy link
Contributor Author

@daniel-lxs Should look good now.

@daniel-lxs daniel-lxs moved this from PR [Changes Requested] to PR [Needs Prelim Review] in Roo Code Roadmap Jun 12, 2025
Copy link
Member

@daniel-lxs daniel-lxs left a comment

Choose a reason for hiding this comment

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

Hey @AlexandruSmirnov , Thank you for fixing this issue!

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 14, 2025
@daniel-lxs daniel-lxs moved this from PR [Needs Prelim Review] to PR [Needs Review] in Roo Code Roadmap Jun 14, 2025
@mrubens mrubens merged commit bfe2274 into RooCodeInc:main Jun 15, 2025
9 checks passed
@github-project-automation github-project-automation bot moved this from PR [Needs Review] to Done in Roo Code Roadmap Jun 15, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jun 15, 2025
cte pushed a commit that referenced this pull request Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer PR - Needs Review size:XL This PR changes 500-999 lines, ignoring generated files. UI/UX UI/UX related or focused

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

OpenAI Compatible does not submit max tokens to the API

4 participants