|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace PhpLlm\LlmChain\Bridge\Mistral; |
| 6 | + |
| 7 | +use PhpLlm\LlmChain\Model\LanguageModel; |
| 8 | + |
| 9 | +final readonly class Mistral implements LanguageModel |
| 10 | +{ |
| 11 | + public const CODESTRAL = 'codestral-latest'; |
| 12 | + public const CODESTRAL_MAMBA = 'open-codestral-mamba'; |
| 13 | + public const MISTRAL_LARGE = 'mistral-large-latest'; |
| 14 | + public const MISTRAL_SMALL = 'mistral-small-latest'; |
| 15 | + public const MISTRAL_NEMO = 'open-mistral-nemo'; |
| 16 | + public const MISTRAL_SABA = 'mistral-saba-latest'; |
| 17 | + public const MINISTRAL_3B = 'mistral-3b-latest'; |
| 18 | + public const MINISTRAL_8B = 'mistral-8b-latest'; |
| 19 | + public const PIXSTRAL_LARGE = 'pixstral-large-latest'; |
| 20 | + public const PIXSTRAL = 'pixstral-12b-latest'; |
| 21 | + |
| 22 | + public function __construct( |
| 23 | + private string $name = self::MISTRAL_LARGE, |
| 24 | + private array $options = [], |
| 25 | + ) { |
| 26 | + } |
| 27 | + |
| 28 | + public function getName(): string |
| 29 | + { |
| 30 | + return $this->name; |
| 31 | + } |
| 32 | + |
| 33 | + public function getOptions(): array |
| 34 | + { |
| 35 | + return $this->options; |
| 36 | + } |
| 37 | + |
| 38 | + public function supportsAudioInput(): bool |
| 39 | + { |
| 40 | + return false; |
| 41 | + } |
| 42 | + |
| 43 | + public function supportsImageInput(): bool |
| 44 | + { |
| 45 | + return in_array($this->name, [self::PIXSTRAL, self::PIXSTRAL_LARGE, self::MISTRAL_SMALL], true); |
| 46 | + } |
| 47 | + |
| 48 | + public function supportsStreaming(): bool |
| 49 | + { |
| 50 | + return true; |
| 51 | + } |
| 52 | + |
| 53 | + public function supportsStructuredOutput(): bool |
| 54 | + { |
| 55 | + return true; |
| 56 | + } |
| 57 | + |
| 58 | + public function supportsToolCalling(): bool |
| 59 | + { |
| 60 | + return in_array($this->name, [ |
| 61 | + self::CODESTRAL, |
| 62 | + self::MISTRAL_LARGE, |
| 63 | + self::MISTRAL_SMALL, |
| 64 | + self::MISTRAL_NEMO, |
| 65 | + self::MINISTRAL_3B, |
| 66 | + self::MINISTRAL_8B, |
| 67 | + self::PIXSTRAL, |
| 68 | + self::PIXSTRAL_LARGE, |
| 69 | + ], true); |
| 70 | + } |
| 71 | +} |
0 commit comments