2323use PhpLlm \LlmChain \Platform \Bridge \Google \Gemini ;
2424use PhpLlm \LlmChain \Platform \Bridge \Google \PlatformFactory as GooglePlatformFactory ;
2525use PhpLlm \LlmChain \Platform \Bridge \Meta \Llama ;
26+ use PhpLlm \LlmChain \Platform \Bridge \Mistral \Mistral ;
27+ use PhpLlm \LlmChain \Platform \Bridge \Mistral \PlatformFactory as MistralPlatformFactory ;
2628use PhpLlm \LlmChain \Platform \Bridge \OpenAI \Embeddings ;
2729use PhpLlm \LlmChain \Platform \Bridge \OpenAI \GPT ;
2830use PhpLlm \LlmChain \Platform \Bridge \OpenAI \PlatformFactory as OpenAIPlatformFactory ;
@@ -202,6 +204,21 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
202204 return ;
203205 }
204206
207+ if ('mistral ' === $ type ) {
208+ $ platformId = 'llm_chain.platform.mistral ' ;
209+ $ definition = (new Definition (Platform::class))
210+ ->setFactory (MistralPlatformFactory::class.'::create ' )
211+ ->setAutowired (true )
212+ ->setLazy (true )
213+ ->addTag ('proxy ' , ['interface ' => PlatformInterface::class])
214+ ->setArguments (['$apiKey ' => $ platform ['api_key ' ]])
215+ ->addTag ('llm_chain.platform ' );
216+
217+ $ container ->setDefinition ($ platformId , $ definition );
218+
219+ return ;
220+ }
221+
205222 throw new \InvalidArgumentException (sprintf ('Platform "%s" is not supported for configuration via bundle at this point. ' , $ type ));
206223 }
207224
@@ -218,6 +235,7 @@ private function processChainConfig(string $name, array $config, ContainerBuilde
218235 'claude ' => Claude::class,
219236 'llama ' => Llama::class,
220237 'gemini ' => Gemini::class,
238+ 'mistral ' => Mistral::class,
221239 default => throw new \InvalidArgumentException (sprintf ('Model "%s" is not supported. ' , $ modelName )),
222240 };
223241 $ modelDefinition = new Definition ($ modelClass );
0 commit comments