Skip to content

Conversation

@HahaBill
Copy link
Contributor

@HahaBill HahaBill commented Jun 5, 2025

The PR will allow developers to set the maximum value of the context window in configuration profile, only for Gemini.

Related GitHub Issue

Closes: #3717

Description

Test Procedure

Type of Change

  • 🐛 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

  • 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

Max Context Window in Configuration Profile

Screenshot 2025-06-06 at 01 26 40

Displaying Gemini's Max Context Window

Screenshot 2025-06-09 at 14 29 56

Testing Max Context Window with Intelligent Context Condensing

The set maximum context window is 32 000 tokens. Allowed tokens is: const allowedTokens = contextWindow * (1 - TOKEN_BUFFER_PERCENTAGE) - reservedTokens, which in our case would be around ~22 000 tokens. Which proves that this PR works since the condensing was activated at 25 255 tokens.

Screenshot 2025-06-09 at 14 33 19

Documentation Updates

Additional Notes

Get in Touch


Important

Adds a configurable maxContextWindow setting for the Gemini API provider, updating schema, UI components, and tests to support this feature.

  • Behavior:
    • Adds maxContextWindow setting to geminiSchema in provider-settings.ts.
    • Updates GeminiHandler in gemini.ts to use maxContextWindow if set.
    • Modifies Task in Task.ts to respect maxContextWindow for Gemini.
  • UI Components:
    • Adds MaxContextWindowControl component in MaxContextWindowControl.tsx.
    • Updates ApiOptions.tsx to include MaxContextWindowControl for Gemini.
    • Updates ModelInfoView.tsx to display maxContextWindow.
  • Testing:
    • Adds test for maxContextWindow in Task.test.ts.
    • Adds test for MaxContextWindowControl in MaxContextWindowControl.test.tsx.
  • Localization:
    • Updates localization files to include maxContextWindow related strings in multiple languages.

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

- added `MaxContextWindowControl.tsx`
- added maxContextWindow in `settings.json`
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jun 5, 2025
@daniel-lxs daniel-lxs moved this from Triage to PR [Draft / In Progress] in Roo Code Roadmap Jun 5, 2025
@hannesrudolph hannesrudolph added PR - Draft / In Progress and removed Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. labels Jun 5, 2025
@HahaBill HahaBill marked this pull request as ready for review June 9, 2025 13:18
@HahaBill HahaBill requested review from cte, jr and mrubens as code owners June 9, 2025 13:18
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Enhancement New feature or request labels Jun 9, 2025
HahaBill and others added 2 commits June 9, 2025 14:37
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
HahaBill and others added 8 commits June 9, 2025 14:37
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
…l.tsx

Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
Co-authored-by: ellipsis-dev[bot] <65095814+ellipsis-dev[bot]@users.noreply.github.com>
@HahaBill
Copy link
Contributor Author

HahaBill commented Jun 9, 2025

Hi! I think something is wrong with the GitHub Actions for platform-unit-test (windows-latest), I am seeing the same/similar error for latest PRs too:

Screenshot 2025-06-09 at 15 50 55

When I changed this PR to from draft to ready to review, then there were not issues with GitHub Action. Once I added my changes because of ellipsis-bot review, then I started to encounter the error in the GitHub Action (windows machine).

@daniel-lxs daniel-lxs marked this pull request as draft June 10, 2025 23:48
@hannesrudolph
Copy link
Collaborator

stale

@github-project-automation github-project-automation bot moved this from PR [Draft / In Progress] to Done in Roo Code Roadmap Jul 7, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 7, 2025
@hannesrudolph hannesrudolph reopened this Jul 7, 2025
@github-project-automation github-project-automation bot moved this from Done to New in Roo Code Roadmap Jul 7, 2025
@github-project-automation github-project-automation bot moved this from Done to Triage in Roo Code Roadmap Jul 7, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 7, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 7, 2025
},
"maxContextWindow": {
"maxContextWindow": "Janela de Contexto Máxima",
"useCustom": "Usar janela de contexto máximo personalizada",
Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical: 'Usar janela de contexto máximo personalizada' should use 'máxima' instead of 'máximo' for grammatical agreement with 'janela' (feminine), e.g. 'Usar janela de contexto máxima personalizada'.

Suggested change
"useCustom": "Usar janela de contexto máximo personalizada",
"useCustom": "Usar janela de contexto máxima personalizada",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement New feature or request PR - Draft / In Progress size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Allow setting a custom max context window for Google Gemini API provider (and/or universal max context window)

2 participants