Skip to content

Releases: mistralai/mistral-common

v1.9.1 Patch Release

12 Feb 10:51
a54e57f

Choose a tag to compare

Refactor online streaming processing and allow for dynamic streaming delay

What's Changed

New Contributors

Full Changelog: v1.9.0...v1.9.1

v1.9.0 - Stream my audio 🎙️

03 Feb 16:17
e5f8f24

Choose a tag to compare

Mistral-Common can now process streaming requests

import numpy as np

from mistral_common.audio import Audio
from mistral_common.protocol.instruct.chunk import RawAudio
from mistral_common.protocol.transcription.request import (
    StreamingMode,
    TranscriptionRequest,
)
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer

# 1. Load the tokenizer with audio support
tokenizer = MistralTokenizer.from_hf_hub(
    "mistralai/Voxtral-Mini-4B-Realtime-2602"
)

# 2. Create sample audio data (or load from a file)
sampling_rate = 16_000
duration_s = 2.0
audio_array = np.random.uniform(-1, 1, size=int(duration_s * sampling_rate)).astype(np.float32)

audio = Audio(
    audio_array=audio_array,
    sampling_rate=sampling_rate,
    format="wav",
)

# 3. Create the streaming transcription request
request = TranscriptionRequest(
    audio=RawAudio(
        data=audio.to_base64("wav"),
        format="wav",
    ),
    streaming=StreamingMode.ONLINE,  # or StreamingMode.OFFLINE
    language=None,
)

# 4. Encode the request
tokenized = tokenizer.encode_transcription(request)

# 5. Access the results
print(f"Tokens: {tokenized.tokens}")
print(f"Number of tokens: {len(tokenized.tokens)}")
print(f"Number of audio segments: {len(tokenized.audios)}")

See https://huggingface.co/mistralai/Voxtral-Mini-4B-Realtime-2602 for more info.

What's Changed

New Contributors

Full Changelog: v1.8.7...v1.9.0

v1.8.8: Backward comp

22 Dec 10:52

Choose a tag to compare

What's Changed

Full Changelog: v1.8.7...v1.8.8

v1.8.7: Refactoring and bug fixes.

22 Dec 09:41
bd80f0e

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.8.6...v1.8.7

v1.8.6: rm Python 3.9, bug fixes.

30 Nov 22:02
c9c189c

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.8.5...v1.8.6

v1.8.5: Patch Release

12 Sep 06:50
5921a03

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.8.4...v1.8.5

v1.8.4: optional dependencies and allow random padding on ChatCompletionResponseStreamResponse

20 Aug 07:26
51e3728

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.8.3...v1.8.4

v1.8.3: Add an experimental REST API

25 Jul 16:16
f47fb16

Choose a tag to compare

What's Changed

We released an experimental REST API leveraging Fast API to handle requests from tokenization, through generation via calls to an engine, to detokenization.

For a detailed documentation see [https://mistralai.github.io/mistral-common/usage/experimental/].

Here is how to launch the server:

pip install mistral-common[server]

mistral_common serve mistralai/Magistral-Small-2507 \
--host 127.0.0.1 --port 8000 \
--engine-url http://127.0.0.1:8080 --engine-backend llama_cpp \
--timeout 60

Then you can see the Swagger at: http://localhost:8000.

Full Changelog: v1.8.2...v1.8.3

v1.8.2: Add ThinkChunk

24 Jul 08:42
4b55642

Choose a tag to compare

What's Changed

Now you can use TextChunk and ThinkChunk in your SystemMessage or AssistantMessage:

from mistral_common.protocol.instruct.messages import SystemMessage, TextChunk, ThinkChunk

system_message = SystemMessage(
    content = [
        TextChunk(text="First draft your thinking process (inner monologue) until you arrive at a response. Format your response using Markdown, and use LaTeX for any mathematical equations. Write both your thoughts and the response in the same language as the input.\n\nYour thinking process must follow the template below:"),
        ThinkChunk(
            thinking="Your thoughts or/and draft, like working through an exercise on scratch paper. Be as casual and as long as you want until you are confident to generate the response. Use the same language as the input.",
            closed=True,
        ),
        TextChunk(text="Here, provide a self-contained response.")
    ],
)

Full Changelog: v1.8.1...v1.8.2

v1.8.1: Add AudioURLChunk

16 Jul 11:20
a153ac8

Choose a tag to compare

What's Changed

Now you can use http(s) URLs, file paths and base64 string (without specifying format) in your content chunks thanks to AudioURLChunk !

from mistral_common.protocol.instruct.messages import AudioURL, AudioURLChunk, TextChunk, UserMessage
from mistral_common.protocol.instruct.request import ChatCompletionRequest
from mistral_common.tokens.tokenizers.mistral import MistralTokenizer

repo_id = "mistralai/Voxtral-Mini-3B-2507"
tokenizer = MistralTokenizer.from_hf_hub(repo_id)

text_chunk = TextChunk(
    text="Wat do you think about this audio?"
)
user_msg = UserMessage(
    content=[
        AudioURLChunk(audio_url=AudioURL(url="https://freewavesamples.com/files/Ouch-6.wav")),
        text_chunk,
    ]
)

request = ChatCompletionRequest(messages=[user_msg])
tokenized = tokenizer.encode_chat_completion(request)

# pass tokenized.tokens to your favorite audio model
print(tokenized.tokens)
print(tokenized.audios)

# print text to visually see tokens
print(tokenized.text)

Full Changelog: v1.8.0...v1.8.1