-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable query to pixtral model with exemple request + example vLLM inf…
…erence.
- Loading branch information
1 parent
8461918
commit 19d66ce
Showing
3 changed files
with
136 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?php | ||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use Partitech\PhpMistral\MistralClient; | ||
use Partitech\PhpMistral\MistralClientException; | ||
use Partitech\PhpMistral\Messages; | ||
|
||
// export MISTRAL_API_KEY=your_api_key | ||
$apiKey = getenv('MISTRAL_API_KEY'); | ||
$client = new MistralClient($apiKey); | ||
|
||
$contents = [ | ||
['type' => 'text', 'text' => 'Describe this image in detail please.'], | ||
['type' => 'image_url', 'image_url' => 'https://s3.amazonaws.com/cms.ipressroom.com/338/files/201808/5b894ee1a138352221103195_A680%7Ejogging-edit/A680%7Ejogging-edit_hero.jpg'], | ||
['type' => 'text', 'text' => 'and this one as well. Answer in French.'], | ||
['type' => 'image_url', 'image_url' => 'https://www.wolframcloud.com/obj/resourcesystem/images/a0e/a0ee3983-46c6-4c92-b85d-059044639928/6af8cfb971db031b.png'] | ||
]; | ||
|
||
|
||
$messages = new Messages(); | ||
$messages->addMixedContentUserMessage($contents); | ||
try { | ||
$result = $client->chat( | ||
$messages, | ||
[ | ||
'model' => 'Pixtral-12B-2409', | ||
'max_tokens' => 1024, | ||
] | ||
); | ||
} catch (MistralClientException $e) { | ||
echo $e->getMessage(); | ||
exit(1); | ||
} | ||
|
||
print($result->getMessage()); | ||
|
||
// Dans cette image, on voit une famille de cinq personnes posant pour une photo. Ils sont tous vêtus de chemises rouges assorties et sont allongés sur le ventre sur une surface blanche devant un fond blanc. Les membres de la famille sourient et semblent être dans une pose détendue et joyeuse, les mains jointes devant eux. La famille semble former un groupe uni et heureux, et l'ambiance générale de la photo est chaleureuse et accueillante. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters