30
30
use Symfony \AI \Platform \Bridge \Gemini \PlatformFactory as GeminiPlatformFactory ;
31
31
use Symfony \AI \Platform \Bridge \LmStudio \PlatformFactory as LmStudioPlatformFactory ;
32
32
use Symfony \AI \Platform \Bridge \Mistral \PlatformFactory as MistralPlatformFactory ;
33
+ use Symfony \AI \Platform \Bridge \Ollama \PlatformFactory as OllamaPlatformFactory ;
33
34
use Symfony \AI \Platform \Bridge \OpenAi \PlatformFactory as OpenAiPlatformFactory ;
34
35
use Symfony \AI \Platform \Bridge \OpenRouter \PlatformFactory as OpenRouterPlatformFactory ;
35
36
use Symfony \AI \Platform \Model ;
@@ -271,7 +272,7 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
271
272
if ('lmstudio ' === $ type ) {
272
273
$ platformId = 'symfony_ai.platform.lmstudio ' ;
273
274
$ definition = (new Definition (Platform::class))
274
- ->setFactory (LmStudioPlatformFactory::class.'::create ' )
275
+ ->setFactory (LmStudioPlatformFactory::class.'::create ' )
275
276
->setLazy (true )
276
277
->addTag ('proxy ' , ['interface ' => PlatformInterface::class])
277
278
->setArguments ([
@@ -286,6 +287,25 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
286
287
return ;
287
288
}
288
289
290
+ if ('ollama ' === $ type ) {
291
+ $ platformId = 'ai.platform.ollama ' ;
292
+ $ definition = (new Definition (Platform::class))
293
+ ->setFactory (MistralPlatformFactory::class.'::create ' )
294
+ ->setFactory (OllamaPlatformFactory::class.'::create ' )
295
+ ->setLazy (true )
296
+ ->addTag ('proxy ' , ['interface ' => PlatformInterface::class])
297
+ ->setArguments ([
298
+ 0 => $ platform ['host_url ' ],
299
+ 2 => new Reference ('http_client ' , ContainerInterface::NULL_ON_INVALID_REFERENCE ),
300
+ 3 => new Reference ('ai.platform.contract.ollama ' ),
301
+ ])
302
+ ->addTag ('ai.platform ' );
303
+
304
+ $ container ->setDefinition ($ platformId , $ definition );
305
+
306
+ return ;
307
+ }
308
+
289
309
throw new InvalidArgumentException (\sprintf ('Platform "%s" is not supported for configuration via bundle at this point. ' , $ type ));
290
310
}
291
311
0 commit comments