Skip to main content

Mistral-common is a library of common utilities for Mistral AI.

Project description

Mistral AI

Mistral-common

PyPI version Tests Documentation Python version License

What is it?

mistral-common is a set of tools to help you work with Mistral AI models.

We open-source the tokenizers, validation and normalization code that can be used with our models.

This ensures that you can take full advantage of our models for the following features:

  • tokenization of text, images and tools calls.
  • validation and normalization of requests, messages, tool calls, and responses. This is built on top of the Pydantic library.

We also version our tokenizers to guarantee backward compatibility for the models that we release.

For who ?

This library is for you if you want to:

  • use our models in your own application.
  • build your own models and want to use the same tokenization and validation code as we do.

How to use it ?

You can install the library using pip:

pip install mistral-common

We propose different dependencies to install depending on your needs:

  • image: to use the image tokenizers.
  • audio: to use the audio tokenizers.
  • hf-hub: to download the tokenizers from the Hugging Face Hub.
  • sentencepiece: to allow the use of SentencePiece tokenizers. This is now optional as we only release Tekken tokenizers for recent models.
  • [Experimental] server: to use our tokenizers in a server mode.

Each dependency is optional and can be installed separately or all together using the following commands:

pip install "mistral-common[image]"
pip install "mistral-common[audio]"
pip install "mistral-common[hf-hub]"
pip install "mistral-common[sentencepiece]"
pip install "mistral-common[server]"
pip install "mistral-common[image,audio,hf-hub,sentencepiece,server]"

For more information, please refer to the documentation.

How to contribute ?

We welcome contributions to this library. All of our features are tested to ensure best usage. But if you encounter a bug, find difficulties in using mistral-common, please open an issue on our GitHub repository.

If you want to contribute to the code, please fork the repository and open a pull request. We will review your changes and merge them if they are relevant to the library.

# Clone the repository
git clone https://github.com/<your_fork_username>/mistral-common.git
cd mistral-common

# Create a virtual environment and install the dependencies
uv venv
source .venv/bin/activate
uv sync --frozen --all-extras --group dev # --group docs if you want to build the documentation

# Install the pre-commit hooks
uv run pre-commit install

License

This library is licensed under the Apache 2.0 License. See the LICENCE file for more information.

You must not use this library or our models in a manner that infringes, misappropriates, or otherwise violates any third party’s rights, including intellectual property rights.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mistral_common-1.10.0.tar.gz (6.4 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mistral_common-1.10.0-py3-none-any.whl (6.5 MB view details)

Uploaded Python 3

File details

Details for the file mistral_common-1.10.0.tar.gz.

File metadata

  • Download URL: mistral_common-1.10.0.tar.gz
  • Upload date:
  • Size: 6.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mistral_common-1.10.0.tar.gz
Algorithm Hash digest
SHA256 e456ff101edbdfc094039ec6c26f7d0f73356729798d628a6e6e96c3917147bc
MD5 61e5ad1bbd91b534986d2d61f2ad9997
BLAKE2b-256 a722f798c1acc3f8cf32b6201b063d96867d79aa39d31dff12478739e1a78979

See more details on using hashes here.

File details

Details for the file mistral_common-1.10.0-py3-none-any.whl.

File metadata

  • Download URL: mistral_common-1.10.0-py3-none-any.whl
  • Upload date:
  • Size: 6.5 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for mistral_common-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c594d1a05202b61e8f0d867ec6064df4c5e5d492c2c2bdb6fd8fb4872c6afd8b
MD5 dc3916c8f45bac9689743d0a1891dcf7
BLAKE2b-256 87c61429a0a3ab40f8530492b62b52eb792266c261b22ed62aa7f25d61d531ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page