3232use Symfony \AI \Platform \Bridge \ElevenLabs \ModelCatalog as ElevenLabsModelCatalog ;
3333use Symfony \AI \Platform \Bridge \ElevenLabs \PlatformFactory as ElevenLabsPlatformFactory ;
3434use Symfony \AI \Platform \Bridge \Ollama \OllamaApiCatalog ;
35+ use Symfony \AI \Platform \CachedPlatform ;
3536use Symfony \AI \Platform \Capability ;
3637use Symfony \AI \Platform \EventListener \TemplateRendererListener ;
3738use Symfony \AI \Platform \Message \TemplateRenderer \ExpressionLanguageTemplateRenderer ;
7475use Symfony \AI \Store \ManagedStoreInterface ;
7576use Symfony \AI \Store \RetrieverInterface ;
7677use Symfony \AI \Store \StoreInterface ;
78+ use Symfony \Component \Clock \ClockInterface ;
79+ use Symfony \Component \Clock \MonotonicClock ;
7780use Symfony \Component \Config \Definition \Exception \InvalidConfigurationException ;
7881use Symfony \Component \DependencyInjection \ContainerBuilder ;
7982use Symfony \Component \DependencyInjection \ContainerInterface ;
@@ -6225,18 +6228,29 @@ public function testCachedPlatformCanBeUsed()
62256228 $ this ->assertTrue ($ container ->hasDefinition ('ai.platform.cache.ollama ' ));
62266229
62276230 $ definition = $ container ->getDefinition ('ai.platform.cache.ollama ' );
6231+
6232+ $ this ->assertSame (CachedPlatform::class, $ definition ->getClass ());
62286233 $ this ->assertTrue ($ definition ->isLazy ());
6229- $ this ->assertCount (3 , $ definition ->getArguments ());
6234+ $ this ->assertCount (4 , $ definition ->getArguments ());
62306235
62316236 $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
62326237 $ platformArgument = $ definition ->getArgument (0 );
62336238 $ this ->assertSame ('ai.platform.ollama ' , (string ) $ platformArgument );
6234-
6239+ $ this -> assertSame (ClockInterface::class, ( string ) $ definition -> getArgument ( 1 ));
62356240 $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (1 ));
6236- $ cacheArgument = $ definition ->getArgument (1 );
6237- $ this ->assertSame ('cache.app ' , (string ) $ cacheArgument );
6241+ $ this ->assertSame ('cache.app ' , (string ) $ definition ->getArgument (2 ));
6242+ $ this ->assertSame ('ollama ' , $ definition ->getArgument (3 ));
6243+
6244+ $ this ->assertSame ([
6245+ ['interface ' => PlatformInterface::class],
6246+ ], $ definition ->getTag ('proxy ' ));
6247+ $ this ->assertTrue ($ definition ->hasTag ('ai.platform ' ));
6248+ $ this ->assertSame ([
6249+ ['name ' => 'cache.ollama ' ],
6250+ ], $ definition ->getTag ('ai.platform ' ));
62386251
6239- $ this ->assertSame ('ollama ' , $ definition ->getArgument (2 ));
6252+ $ this ->assertTrue ($ container ->hasAlias ('.Symfony\AI\Platform\PlatformInterface $cache_ollama ' ));
6253+ $ this ->assertTrue ($ container ->hasAlias ('Symfony\AI\Platform\PlatformInterface $cacheOllama ' ));
62406254 }
62416255
62426256 public function testCachedPlatformCanBeUsedWithoutCustomCacheKey ()
@@ -6260,18 +6274,29 @@ public function testCachedPlatformCanBeUsedWithoutCustomCacheKey()
62606274 $ this ->assertTrue ($ container ->hasDefinition ('ai.platform.cache.ollama ' ));
62616275
62626276 $ definition = $ container ->getDefinition ('ai.platform.cache.ollama ' );
6277+
6278+ $ this ->assertSame (CachedPlatform::class, $ definition ->getClass ());
62636279 $ this ->assertTrue ($ definition ->isLazy ());
6264- $ this ->assertCount (3 , $ definition ->getArguments ());
6280+ $ this ->assertCount (4 , $ definition ->getArguments ());
62656281
62666282 $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (0 ));
62676283 $ platformArgument = $ definition ->getArgument (0 );
62686284 $ this ->assertSame ('ai.platform.ollama ' , (string ) $ platformArgument );
6269-
6285+ $ this -> assertSame (ClockInterface::class, ( string ) $ definition -> getArgument ( 1 ));
62706286 $ this ->assertInstanceOf (Reference::class, $ definition ->getArgument (1 ));
6271- $ cacheArgument = $ definition ->getArgument (1 );
6272- $ this ->assertSame ('cache.app ' , (string ) $ cacheArgument );
6287+ $ this ->assertSame ('cache.app ' , (string ) $ definition ->getArgument (2 ));
6288+ $ this ->assertSame ('ollama ' , $ definition ->getArgument (3 ));
6289+
6290+ $ this ->assertSame ([
6291+ ['interface ' => PlatformInterface::class],
6292+ ], $ definition ->getTag ('proxy ' ));
6293+ $ this ->assertTrue ($ definition ->hasTag ('ai.platform ' ));
6294+ $ this ->assertSame ([
6295+ ['name ' => 'cache.ollama ' ],
6296+ ], $ definition ->getTag ('ai.platform ' ));
62736297
6274- $ this ->assertSame ('ollama ' , $ definition ->getArgument (2 ));
6298+ $ this ->assertTrue ($ container ->hasAlias ('.Symfony\AI\Platform\PlatformInterface $cache_ollama ' ));
6299+ $ this ->assertTrue ($ container ->hasAlias ('Symfony\AI\Platform\PlatformInterface $cacheOllama ' ));
62756300 }
62766301
62776302 public function testCacheMessageStoreCanBeConfiguredWithCustomKey ()
@@ -6987,6 +7012,7 @@ private function buildContainer(array $configuration): ContainerBuilder
69877012 $ container ->setParameter ('kernel.debug ' , true );
69887013 $ container ->setParameter ('kernel.environment ' , 'dev ' );
69897014 $ container ->setParameter ('kernel.build_dir ' , 'public ' );
7015+ $ container ->setDefinition (ClockInterface::class, new Definition (MonotonicClock::class));
69907016
69917017 $ extension = (new AiBundle ())->getContainerExtension ();
69927018 $ extension ->load ($ configuration , $ container );
0 commit comments