Skip to content

Commit 869174c

Browse files
committed
feature #508 [Platform][Mistral] Add support for Voxtral models with audio input and tool-calling (Andreas van Hulst)
This PR was squashed before being merged into the main branch. Discussion ---------- [Platform][Mistral] Add support for Voxtral models with audio input and tool-calling | Q | A | ------------- | --- | Bug fix? | no | New feature? | Yes | Docs? | no | Issues | -- | License | MIT This pull request extends the Mistral integration to add support for the `VOXTRAL` models, which are specialized for processing audio data. This enables the transcription of audio files through the Mistral platform. **Key Changes:** * **New Model Constants:** In the `Mistral` class, the constants `VOXTRAL_SMALL` and `VOXTRAL_MINI` have been added. * **Audio Capability:** The `Capability::INPUT_AUDIO` is now correctly assigned to the models when one of the VOXTRAL models is selected. * **Usage Example:** A new `ai:mistral` command has been created to demonstrate the functionality. It shows how to send an audio file (`audio.mp3`) to the `VOXTRAL_SMALL` model for transcription. **Usage Example (`AiMistralCommand.php`):** ```php // ... // Select the VOXTRAL_SMALL model $model = new Mistral(Mistral::VOXTRAL_SMALL); // ... // Call the agent with a system message and an audio file as user input $messages = new MessageBag( Message::forSystem('You are an assistant for audio transcriptions.'), Message::ofUser( 'Please give me the content of the audio file', Audio::fromFile(dirname(__DIR__, 2).'/audio.mp3'), ), ); $result = $agent->call($messages)->getContent(); // ... ``` Commits ------- 55e78d1 [Platform][Mistral] Add support for Voxtral models with audio input and tool-calling
2 parents 9003e50 + 55e78d1 commit 869174c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/platform/src/Bridge/Mistral/Mistral.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ final class Mistral extends Model
2929
public const MINISTRAL_8B = 'mistral-8b-latest';
3030
public const PIXSTRAL_LARGE = 'pixstral-large-latest';
3131
public const PIXSTRAL = 'pixstral-12b-latest';
32+
public const VOXTRAL_SMALL = 'voxtral-small-latest';
33+
public const VOXTRAL_MINI = 'voxtral-mini-latest';
3234

3335
/**
3436
* @param array<string, mixed> $options
@@ -48,6 +50,10 @@ public function __construct(
4850
$capabilities[] = Capability::INPUT_IMAGE;
4951
}
5052

53+
if (\in_array($name, [self::VOXTRAL_SMALL, self::VOXTRAL_MINI], true)) {
54+
$capabilities[] = Capability::INPUT_AUDIO;
55+
}
56+
5157
if (\in_array($name, [
5258
self::CODESTRAL,
5359
self::MISTRAL_LARGE,
@@ -57,6 +63,8 @@ public function __construct(
5763
self::MINISTRAL_8B,
5864
self::PIXSTRAL,
5965
self::PIXSTRAL_LARGE,
66+
self::VOXTRAL_MINI,
67+
self::VOXTRAL_SMALL,
6068
], true)) {
6169
$capabilities[] = Capability::TOOL_CALLING;
6270
}

0 commit comments

Comments
 (0)