23
23
use PhpLlm \LlmChain \Platform \Bridge \Google \Gemini ;
24
24
use PhpLlm \LlmChain \Platform \Bridge \Google \PlatformFactory as GooglePlatformFactory ;
25
25
use PhpLlm \LlmChain \Platform \Bridge \Meta \Llama ;
26
+ use PhpLlm \LlmChain \Platform \Bridge \Mistral \Mistral ;
27
+ use PhpLlm \LlmChain \Platform \Bridge \Mistral \PlatformFactory as MistralPlatformFactory ;
26
28
use PhpLlm \LlmChain \Platform \Bridge \OpenAI \Embeddings ;
27
29
use PhpLlm \LlmChain \Platform \Bridge \OpenAI \GPT ;
28
30
use PhpLlm \LlmChain \Platform \Bridge \OpenAI \PlatformFactory as OpenAIPlatformFactory ;
@@ -202,6 +204,21 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
202
204
return ;
203
205
}
204
206
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
+
205
222
throw new \InvalidArgumentException (sprintf ('Platform "%s" is not supported for configuration via bundle at this point. ' , $ type ));
206
223
}
207
224
@@ -218,6 +235,7 @@ private function processChainConfig(string $name, array $config, ContainerBuilde
218
235
'claude ' => Claude::class,
219
236
'llama ' => Llama::class,
220
237
'gemini ' => Gemini::class,
238
+ 'mistral ' => Mistral::class,
221
239
default => throw new \InvalidArgumentException (sprintf ('Model "%s" is not supported. ' , $ modelName )),
222
240
};
223
241
$ modelDefinition = new Definition ($ modelClass );
0 commit comments