|
28 | 28 | use Symfony\AI\Chat\ManagedStoreInterface as ManagedMessageStoreInterface; |
29 | 29 | use Symfony\AI\Chat\MessageStoreInterface; |
30 | 30 | use Symfony\AI\Platform\Bridge\Decart\PlatformFactory as DecartPlatformFactory; |
| 31 | +use Symfony\AI\Platform\Bridge\ElevenLabs\ElevenLabsApiCatalog; |
| 32 | +use Symfony\AI\Platform\Bridge\ElevenLabs\ModelCatalog as ElevenLabsModelCatalog; |
31 | 33 | use Symfony\AI\Platform\Bridge\ElevenLabs\PlatformFactory as ElevenLabsPlatformFactory; |
32 | 34 | use Symfony\AI\Platform\Bridge\Ollama\OllamaApiCatalog; |
33 | 35 | use Symfony\AI\Platform\Capability; |
34 | 36 | use Symfony\AI\Platform\Model; |
| 37 | +use Symfony\AI\Platform\ModelCatalog\ModelCatalogInterface; |
35 | 38 | use Symfony\AI\Platform\PlatformInterface; |
36 | 39 | use Symfony\AI\Store\Bridge\AzureSearch\SearchStore as AzureStore; |
37 | 40 | use Symfony\AI\Store\Bridge\Cache\Store as CacheStore; |
@@ -3849,6 +3852,14 @@ public function testElevenLabsPlatformCanBeRegistered() |
3849 | 3852 |
|
3850 | 3853 | $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
3851 | 3854 | $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 3855 | + |
| 3856 | + $modelCatalogDefinition = $container->getDefinition('ai.platform.model_catalog.elevenlabs'); |
| 3857 | + |
| 3858 | + $this->assertSame(ElevenLabsModelCatalog::class, $modelCatalogDefinition->getClass()); |
| 3859 | + $this->assertTrue($modelCatalogDefinition->isLazy()); |
| 3860 | + |
| 3861 | + $this->assertTrue($modelCatalogDefinition->hasTag('proxy')); |
| 3862 | + $this->assertSame([['interface' => ModelCatalogInterface::class]], $modelCatalogDefinition->getTag('proxy')); |
3852 | 3863 | } |
3853 | 3864 |
|
3854 | 3865 | public function testElevenLabsPlatformWithCustomEndpointCanBeRegistered() |
@@ -3889,6 +3900,14 @@ public function testElevenLabsPlatformWithCustomEndpointCanBeRegistered() |
3889 | 3900 |
|
3890 | 3901 | $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
3891 | 3902 | $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 3903 | + |
| 3904 | + $modelCatalogDefinition = $container->getDefinition('ai.platform.model_catalog.elevenlabs'); |
| 3905 | + |
| 3906 | + $this->assertSame(ElevenLabsModelCatalog::class, $modelCatalogDefinition->getClass()); |
| 3907 | + $this->assertTrue($modelCatalogDefinition->isLazy()); |
| 3908 | + |
| 3909 | + $this->assertTrue($modelCatalogDefinition->hasTag('proxy')); |
| 3910 | + $this->assertSame([['interface' => ModelCatalogInterface::class]], $modelCatalogDefinition->getTag('proxy')); |
3892 | 3911 | } |
3893 | 3912 |
|
3894 | 3913 | public function testElevenLabsPlatformWithCustomHttpClientCanBeRegistered() |
@@ -3929,6 +3948,68 @@ public function testElevenLabsPlatformWithCustomHttpClientCanBeRegistered() |
3929 | 3948 |
|
3930 | 3949 | $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
3931 | 3950 | $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 3951 | + |
| 3952 | + $modelCatalogDefinition = $container->getDefinition('ai.platform.model_catalog.elevenlabs'); |
| 3953 | + |
| 3954 | + $this->assertSame(ElevenLabsModelCatalog::class, $modelCatalogDefinition->getClass()); |
| 3955 | + $this->assertTrue($modelCatalogDefinition->isLazy()); |
| 3956 | + |
| 3957 | + $this->assertTrue($modelCatalogDefinition->hasTag('proxy')); |
| 3958 | + $this->assertSame([['interface' => ModelCatalogInterface::class]], $modelCatalogDefinition->getTag('proxy')); |
| 3959 | + } |
| 3960 | + |
| 3961 | + public function testElevenLabsPlatformWithApiCatalogCanBeRegistered() |
| 3962 | + { |
| 3963 | + $container = $this->buildContainer([ |
| 3964 | + 'ai' => [ |
| 3965 | + 'platform' => [ |
| 3966 | + 'elevenlabs' => [ |
| 3967 | + 'api_key' => 'foo', |
| 3968 | + 'api_catalog' => true, |
| 3969 | + ], |
| 3970 | + ], |
| 3971 | + ], |
| 3972 | + ]); |
| 3973 | + |
| 3974 | + $this->assertTrue($container->hasDefinition('ai.platform.elevenlabs')); |
| 3975 | + $this->assertTrue($container->hasDefinition('ai.platform.model_catalog.elevenlabs')); |
| 3976 | + |
| 3977 | + $definition = $container->getDefinition('ai.platform.elevenlabs'); |
| 3978 | + |
| 3979 | + $this->assertTrue($definition->isLazy()); |
| 3980 | + $this->assertSame([ElevenLabsPlatformFactory::class, 'create'], $definition->getFactory()); |
| 3981 | + |
| 3982 | + $this->assertCount(6, $definition->getArguments()); |
| 3983 | + $this->assertSame('foo', $definition->getArgument(0)); |
| 3984 | + $this->assertSame('https://api.elevenlabs.io/v1', $definition->getArgument(1)); |
| 3985 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 3986 | + $this->assertSame('http_client', (string) $definition->getArgument(2)); |
| 3987 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(3)); |
| 3988 | + $this->assertSame('ai.platform.model_catalog.elevenlabs', (string) $definition->getArgument(3)); |
| 3989 | + $this->assertNull($definition->getArgument(4)); |
| 3990 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(5)); |
| 3991 | + $this->assertSame('event_dispatcher', (string) $definition->getArgument(5)); |
| 3992 | + |
| 3993 | + $this->assertTrue($definition->hasTag('proxy')); |
| 3994 | + $this->assertSame([['interface' => PlatformInterface::class]], $definition->getTag('proxy')); |
| 3995 | + $this->assertTrue($definition->hasTag('ai.platform')); |
| 3996 | + $this->assertSame([['name' => 'elevenlabs']], $definition->getTag('ai.platform')); |
| 3997 | + |
| 3998 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
| 3999 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 4000 | + |
| 4001 | + $modelCatalogDefinition = $container->getDefinition('ai.platform.model_catalog.elevenlabs'); |
| 4002 | + |
| 4003 | + $this->assertSame(ElevenLabsApiCatalog::class, $modelCatalogDefinition->getClass()); |
| 4004 | + $this->assertTrue($modelCatalogDefinition->isLazy()); |
| 4005 | + $this->assertCount(3, $modelCatalogDefinition->getArguments()); |
| 4006 | + $this->assertInstanceOf(Reference::class, $modelCatalogDefinition->getArgument(0)); |
| 4007 | + $this->assertSame('http_client', (string) $modelCatalogDefinition->getArgument(0)); |
| 4008 | + $this->assertSame('foo', $modelCatalogDefinition->getArgument(1)); |
| 4009 | + $this->assertSame('https://api.elevenlabs.io/v1', $modelCatalogDefinition->getArgument(2)); |
| 4010 | + |
| 4011 | + $this->assertTrue($modelCatalogDefinition->hasTag('proxy')); |
| 4012 | + $this->assertSame([['interface' => ModelCatalogInterface::class]], $modelCatalogDefinition->getTag('proxy')); |
3932 | 4013 | } |
3933 | 4014 |
|
3934 | 4015 | #[TestDox('Token usage processor tags use the correct agent ID')] |
|
0 commit comments