Skip to content

Conversation

@d-oit
Copy link
Contributor

@d-oit d-oit commented Mar 19, 2025

Context

The current Mistral API provider has an old MistralSDK implementation that can generate an endless prediction.
https://discord.com/channels/1332146336664915968/1351883070550315009/1351915996931293204

Implementation

  1. Mistral API Integration:
    • Enhanced rate limit handling with detailed user messages
    • Improved error management with quota warnings
    • Added pattern detection and loop prevention
    • Optimized streaming performance

SDK update: "@mistralai/mistralai": "^1.3.6" > ^1.5.2",

  1. Mistral Model Updates:

    • Increased token limits to 32K for mistral-small-latest
    • Added support for mistral-saba-latest model
    • Enabled image support for mistral-small-latest
  2. Code Quality:

    • Removed deprecated rateLimitSeconds concept
    • Added extensive rate limiting tests
    • Improved debugging tools for Mistral API

Screenshots

before after
image
 |

How to Test

Get a codestral API key, setup codestral as model for the provider. Enable Debug in the VS Code Settings UI.

Prompt:

Create a modern calculator using TypeScript with the following requirements:

  • Tech Stack: Vanilla TypeScript (no frameworks), Jest for unit testing, and Playwright for end-to-end (E2E) testing.
  • Features: Basic arithmetic operations (addition, subtraction, multiplication, division), clear/reset functionality, and keyboard support.
  • UI: Minimalistic and responsive design with a focus on usability.
  • Testing:
    • Unit tests (Jest): Ensure correct calculation logic.
    • E2E tests (Playwright): Verify UI interactions, keyboard input, and overall functionality.
  • Performance: Lightweight and optimized for smooth user experience.
  • Code Quality: Modular and maintainable with proper TypeScript typings.

codestral:
https://www.dropbox.com/scl/fi/hd22oj4sn9t9qpns1q5tx/Screen-Recording-2025-03-19-190140.mp4?rlkey=h67iuls81d99ur5vppbjb3q3s&st=6fgr9hwi&dl=0

mistral-small:
https://www.dropbox.com/scl/fi/tz03fz2hfkj3p7mr22gf0/RooCode-mistral-small.mp4?rlkey=npfkv28pxoaorz438y2fsuykq&st=rbiuwzsj&dl=0

Known-Issues:

  • Error: Current ask promise was ignored (general problem with non claude provider)

Get in Touch


Important

Enhances Mistral API integration with improved rate limit handling, error management, and support for new models, alongside SDK updates and code quality improvements.

  • Mistral API Integration:
    • Enhanced rate limit handling using HTTP headers in mistral.ts.
    • Improved error management with quota warnings and pattern detection.
    • Added support for mistral-saba-latest and increased token limits for mistral-small-latest.
    • Updated SDK version to ^1.5.2 in package.json.
  • Code Quality:
    • Removed deprecated rateLimitSeconds concept in base-provider.ts.
    • Added extensive rate limiting tests in mistral.test.ts and Cline.rateLimiting.test.ts.
    • Improved debugging tools for Mistral API in mistral.ts.
  • Misc:
    • Added delay() function in promises.ts for handling asynchronous delays.
    • Updated ApiOptions.tsx to include new Mistral settings.

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

d-oit added 4 commits March 19, 2025 18:12
This commit includes several major improvements:

1. Mistral API Integration:
   - Enhanced rate limit handling with detailed user messages
   - Improved error management with quota warnings
   - Added pattern detection and loop prevention
   - Optimized streaming performance

2. Mistral Model Updates:
   - Increased token limits to 32K for mistral-small-latest
   - Added support for mistral-saba-latest model
   - Enabled image support for mistral-small-latest

3. Git Workflow Enhancements:
   - Added comprehensive Git workflow guide
   - Created tidy-commits script for commit cleanup
   - Added npm run tidy-commits command

4. Code Quality:
   - Removed deprecated rateLimitSeconds concept
   - Added extensive rate limiting tests
   - Improved debugging tools for Mistral API
@changeset-bot
Copy link

changeset-bot bot commented Mar 19, 2025

⚠️ No Changeset found

Latest commit: 8ce72ad

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

@d-oit d-oit marked this pull request as ready for review March 19, 2025 22:15
@d-oit d-oit requested review from cte and mrubens as code owners March 19, 2025 22:15
@dosubot dosubot bot added size:XXL This PR changes 1000+ lines, ignoring generated files. enhancement New feature or request labels Mar 19, 2025
@ellipsis-dev
Copy link
Contributor

ellipsis-dev bot commented Mar 19, 2025

This pull request is quite large, with 13 files changed and over 1300 lines added. It might be beneficial to split it into smaller, more manageable pull requests if the changes are not closely related.

Here are some suggestions on how the changes could be split:

  1. Configuration and Dependency Updates: Changes in package.json and any related configuration files.
  2. Testing Enhancements: All changes related to testing, such as those in src/api/providers/__tests__/mistral.test.ts and src/core/__tests__/Cline.rateLimiting.test.ts.
  3. Rate Limiting and Retry Logic: Changes in src/api/providers/mistral.ts and src/core/Cline.ts that deal with rate limiting and retry logic.
  4. Styling and UI Updates: Changes in webview-ui/src/components/settings/ApiOptions.tsx and any other UI-related files.

Please consider splitting the pull request if these changes are not interdependent. This will make it easier to review and ensure each part is thoroughly tested.

…ve UI elements, wrong merge. defaultModel removed
@d-oit
Copy link
Contributor Author

d-oit commented Mar 20, 2025

This pull request is quite large, with 13 files changed and over 1300 lines added. It might be beneficial to split it into smaller, more manageable pull requests if the changes are not closely related.

Here are some suggestions on how the changes could be split:

  1. Configuration and Dependency Updates: Changes in package.json and any related configuration files.
    mistral sdk updates and debug option
  2. Testing Enhancements: All changes related to testing, such as those in src/api/providers/__tests__/mistral.test.ts and src/core/__tests__/Cline.rateLimiting.test.ts.
    tests are part of the PR
  3. Rate Limiting and Retry Logic: Changes in src/api/providers/mistral.ts and src/core/Cline.ts that deal with rate limiting and retry logic.
    @mrubens yes i could split this - but it is easier for me to finish the job in one step
  4. Styling and UI Updates: Changes in webview-ui/src/components/settings/ApiOptions.tsx and any other UI-related files.

Please consider splitting the pull request if these changes are not interdependent. This will make it easier to review and ensure each part is thoroughly tested.
ApiOptions.tsx is not necessary anymore after the latest merge. no defaultModel for the select.
@mrubens messed up with the merge and recognize too late the removed of defaultModel for the select in the ui
ApiOptions.tsx = no changes after merge

@cte i am not sure about the tests. you can take a look at the test to see if it fits. the format is taken from cline.
npx jest "api/providers/tests/mistral.test.ts|api/transform/tests/mistral-format.test.ts"

@hannesrudolph hannesrudolph moved this from New to PR [Pre Approval Review] in Roo Code Roadmap Mar 21, 2025
@d-oit d-oit mentioned this pull request Apr 26, 2025
@hannesrudolph hannesrudolph linked an issue Apr 29, 2025 that may be closed by this pull request
@hannesrudolph
Copy link
Collaborator

@d-oit @mrubens what does it take to get this landed? We have an open issue that has been "in progress" for way too long. Either this PR is going through or not...

@@ -0,0 +1,8 @@
/**
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we've been using the delay npm package for this.

/**
* Base class for API providers that implements common functionality
*/
import * as vscode from "vscode"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this import used?

}
},
{
"title": "Roo Code > Debug",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not sure this is worth adding unless it's more generic.

@cte
Copy link
Collaborator

cte commented May 8, 2025

Thanks for updating the Mistral stuff! I left a few comments.

@d-oit
Copy link
Contributor Author

d-oit commented May 14, 2025

Thanks for updating the Mistral stuff! I left a few comments.

Over two months ago 🙀.
Phuu, maybe better to use the Cline implementation or remove Mistral completely?

Since it wasn't merged, I'm using a completely customized code outside of roo with Mistral.

@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap May 16, 2025
@hannesrudolph hannesrudolph moved this from New to Done in Roo Code Roadmap May 20, 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 size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Mistral API won't work

3 participants