Skip to content

feat: add mistral AI as LLM provider #2496

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

NightClover-code
Copy link
Contributor

Description

This PR adds Mistral AI as a new LLM provider to mem0-ts, allowing users to leverage Mistral's language models as an alternative to OpenAI, Anthropic, and other supported providers. The implementation follows the existing pattern for LLM providers and properly handles Mistral's response format including content type handling.

Key changes:

  • Added MistralLLM class that implements the LLM interface
  • Updated factory.ts to include Mistral as a provider option
  • Added Mistral to exports in index.ts
  • Added example for testing the Mistral implementation
  • Updated package.json with Mistral SDK dependency

This addition gives mem0-ts users more flexibility in choosing LLM providers and aligns with the project's goal of supporting multiple AI services.

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

  • Test Script (please provide)

I created a test script at mem0-ts/src/oss/examples/llms/mistral-example.ts that tests both basic chat completion and tool calling functionality. The test validates that the Mistral API integration works correctly for different use cases.

The test can be run with:

cd mem0-ts/src/oss
pnpm exec ts-node examples/llms/mistral-example.ts

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Made sure Checks passed

@CLAassistant
Copy link

CLAassistant commented Apr 2, 2025

CLA assistant check
All committers have signed the CLA.

@whysosaket
Copy link
Collaborator

Hi @NightClover-code,
The PR looks good to me, could you please update the Docs at: docs/components/llms/models/mistral_AI.mdx ?

Then we're good to go! Thanks for Contributing....

@NightClover-code
Copy link
Contributor Author

@whysosaket Done man! Let me know if there's anything else to add. Thanks again :)

@whysosaket whysosaket merged commit d9236de into mem0ai:main Apr 11, 2025
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants