Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 18, 2025

Implements Mistral codestral-embed model support with OpenAI-compatible API integration for improved performance and cost efficiency.

Changes

  • Added Mistral as a new embedding provider option
  • Implemented MistralEmbedder class wrapping OpenAICompatibleEmbedder
  • Added Mistral configuration support throughout the system
  • Updated UI components to support Mistral provider selection
  • Added comprehensive test coverage for MistralEmbedder
  • Updated type definitions across all relevant modules

Features

  • Uses Mistral codestral-embed model (1024 dimensions)
  • OpenAI-compatible API integration at https://api.mistral.ai/v1
  • Free tier availability for cost-effective embedding generation
  • Superior benchmark performance compared to existing options

Fixes #5932


Important

Adds Mistral as a new embedding provider for codebase indexing, including configuration, UI updates, and test coverage.

  • Behavior:
    • Adds Mistral as a new embedding provider option in codebase-index.ts and config-manager.ts.
    • Implements MistralEmbedder class in mistral.ts wrapping OpenAICompatibleEmbedder.
    • Integrates Mistral configuration in service-factory.ts and CodeIndexPopover.tsx.
    • Updates UI components in CodeIndexPopover.tsx to support Mistral provider selection.
  • Configuration:
    • Updates codebaseIndexConfigSchema and codebaseIndexProviderSchema in codebase-index.ts to include Mistral.
    • Adds Mistral API key handling in config-manager.ts.
  • Testing:
    • Adds comprehensive test coverage for MistralEmbedder in mistral.spec.ts.
  • Constants:
    • Defines MISTRAL_MAX_ITEM_TOKENS in constants/index.ts.
  • Models:
    • Adds Mistral model profile to embeddingModels.ts with codestral-embed model.

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

roomote added 4 commits July 18, 2025 23:45
- Add Mistral as a new embedding provider option
- Support for codestral-embed model with 1024 dimensions
- OpenAI-compatible API integration at https://api.mistral.ai/v1
- Free tier availability for cost-effective embedding generation
- Comprehensive test coverage for MistralEmbedder class
- Configuration support in service factory and config manager

Resolves #5932
- Add Mistral option to provider dropdown
- Add Mistral API key configuration UI
- Add Mistral model selection dropdown
- Add validation schema for Mistral provider
- Handle Mistral API key in secret management
- Add mistral to WebviewMessage type definition
- Add mistral to codebase-index schema in types package
- Fixes TypeScript compilation errors
- Add mistral to codebaseIndexModelsSchema
- Add codebaseIndexMistralApiKey to codebaseIndexProviderSchema
- Fixes TypeScript compilation errors in webview component
const openAiCompatibleBaseUrl = codebaseIndexConfig.codebaseIndexOpenAiCompatibleBaseUrl ?? ""
const openAiCompatibleApiKey = this.contextProxy?.getSecret("codebaseIndexOpenAiCompatibleApiKey") ?? ""
const geminiApiKey = this.contextProxy?.getSecret("codebaseIndexGeminiApiKey") ?? ""
const mistralApiKey = this.contextProxy?.getSecret("mistralApiKey") ?? ""
Copy link
Contributor

Choose a reason for hiding this comment

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

The secret key for the Mistral API is fetched using getSecret("mistralApiKey"), but elsewhere (e.g. in the zod schema and UI) the mistral key is referred to as codebaseIndexMistralApiKey. Consider aligning the secret key naming for consistency to avoid potential mismatches.

Suggested change
const mistralApiKey = this.contextProxy?.getSecret("mistralApiKey") ?? ""
const mistralApiKey = this.contextProxy?.getSecret("codebaseIndexMistralApiKey") ?? ""

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. enhancement New feature or request labels Jul 18, 2025
@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 19, 2025
@shariqriazz
Copy link
Contributor

Please fix the dimension to 1536 @roomote-agent

@roomote
Copy link
Contributor Author

roomote bot commented Jul 19, 2025

Hi @shariqriazz, I see your request to fix the dimension to 1536. I'm working on this change now and will update the PR shortly.

@roomote
Copy link
Contributor Author

roomote bot commented Jul 19, 2025

Hi @shariqriazz, I've successfully updated the Mistral codestral-embed dimension from 1024 to 1536 as requested.

Changes made:

All tests are passing and CI checks have completed successfully. The changes are ready for review.

@daniel-lxs
Copy link
Member

Mistral doesn't seem to be OpenAI compatible

@daniel-lxs daniel-lxs closed this Jul 19, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 19, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 19, 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 Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. 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.

Add Mistral embedding provider for improved codebase indexing performance and cost efficiency

5 participants