|
26 | 26 | use Symfony\AI\Chat\ChatInterface; |
27 | 27 | use Symfony\AI\Chat\ManagedStoreInterface as ManagedMessageStoreInterface; |
28 | 28 | use Symfony\AI\Chat\MessageStoreInterface; |
| 29 | +use Symfony\AI\Platform\Bridge\ElevenLabs\PlatformFactory; |
29 | 30 | use Symfony\AI\Platform\Bridge\Ollama\OllamaApiCatalog; |
30 | 31 | use Symfony\AI\Platform\Capability; |
31 | 32 | use Symfony\AI\Platform\Model; |
| 33 | +use Symfony\AI\Platform\PlatformInterface; |
32 | 34 | use Symfony\AI\Store\Bridge\Azure\SearchStore as AzureStore; |
33 | 35 | use Symfony\AI\Store\Bridge\ChromaDb\Store as ChromaDbStore; |
34 | 36 | use Symfony\AI\Store\Bridge\ClickHouse\Store as ClickhouseStore; |
@@ -1576,6 +1578,125 @@ public function testToolboxWithoutExplicitToolsDefined() |
1576 | 1578 | $this->assertTrue($foundOutput, 'Default tool processor should have output tag with full agent ID'); |
1577 | 1579 | } |
1578 | 1580 |
|
| 1581 | + public function testElevenLabsPlatformCanBeRegistered() |
| 1582 | + { |
| 1583 | + $container = $this->buildContainer([ |
| 1584 | + 'ai' => [ |
| 1585 | + 'platform' => [ |
| 1586 | + 'elevenlabs' => [ |
| 1587 | + 'api_key' => 'foo', |
| 1588 | + ], |
| 1589 | + ], |
| 1590 | + ], |
| 1591 | + ]); |
| 1592 | + |
| 1593 | + $this->assertTrue($container->hasDefinition('ai.platform.elevenlabs')); |
| 1594 | + |
| 1595 | + $definition = $container->getDefinition('ai.platform.elevenlabs'); |
| 1596 | + |
| 1597 | + $this->assertTrue($definition->isLazy()); |
| 1598 | + $this->assertSame([PlatformFactory::class, 'create'], $definition->getFactory()); |
| 1599 | + |
| 1600 | + $this->assertCount(6, $definition->getArguments()); |
| 1601 | + $this->assertSame('foo', $definition->getArgument(0)); |
| 1602 | + $this->assertSame('https://api.elevenlabs.io/v1', $definition->getArgument(1)); |
| 1603 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 1604 | + $this->assertSame('http_client', (string) $definition->getArgument(2)); |
| 1605 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(3)); |
| 1606 | + $this->assertSame('ai.platform.model_catalog.elevenlabs', (string) $definition->getArgument(3)); |
| 1607 | + $this->assertNull($definition->getArgument(4)); |
| 1608 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(5)); |
| 1609 | + $this->assertSame('event_dispatcher', (string) $definition->getArgument(5)); |
| 1610 | + |
| 1611 | + $this->assertTrue($definition->hasTag('proxy')); |
| 1612 | + $this->assertSame([['interface' => PlatformInterface::class]], $definition->getTag('proxy')); |
| 1613 | + $this->assertTrue($definition->hasTag('ai.platform')); |
| 1614 | + $this->assertSame([['name' => 'elevenlabs']], $definition->getTag('ai.platform')); |
| 1615 | + |
| 1616 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
| 1617 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 1618 | + } |
| 1619 | + |
| 1620 | + public function testElevenLabsPlatformWithCustomEndpointCanBeRegistered() |
| 1621 | + { |
| 1622 | + $container = $this->buildContainer([ |
| 1623 | + 'ai' => [ |
| 1624 | + 'platform' => [ |
| 1625 | + 'elevenlabs' => [ |
| 1626 | + 'api_key' => 'foo', |
| 1627 | + 'host' => 'https://api.elevenlabs.io/v2', |
| 1628 | + ], |
| 1629 | + ], |
| 1630 | + ], |
| 1631 | + ]); |
| 1632 | + |
| 1633 | + $this->assertTrue($container->hasDefinition('ai.platform.elevenlabs')); |
| 1634 | + |
| 1635 | + $definition = $container->getDefinition('ai.platform.elevenlabs'); |
| 1636 | + |
| 1637 | + $this->assertTrue($definition->isLazy()); |
| 1638 | + $this->assertSame([PlatformFactory::class, 'create'], $definition->getFactory()); |
| 1639 | + |
| 1640 | + $this->assertCount(6, $definition->getArguments()); |
| 1641 | + $this->assertSame('foo', $definition->getArgument(0)); |
| 1642 | + $this->assertSame('https://api.elevenlabs.io/v2', $definition->getArgument(1)); |
| 1643 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 1644 | + $this->assertSame('http_client', (string) $definition->getArgument(2)); |
| 1645 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(3)); |
| 1646 | + $this->assertSame('ai.platform.model_catalog.elevenlabs', (string) $definition->getArgument(3)); |
| 1647 | + $this->assertNull($definition->getArgument(4)); |
| 1648 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(5)); |
| 1649 | + $this->assertSame('event_dispatcher', (string) $definition->getArgument(5)); |
| 1650 | + |
| 1651 | + $this->assertTrue($definition->hasTag('proxy')); |
| 1652 | + $this->assertSame([['interface' => PlatformInterface::class]], $definition->getTag('proxy')); |
| 1653 | + $this->assertTrue($definition->hasTag('ai.platform')); |
| 1654 | + $this->assertSame([['name' => 'elevenlabs']], $definition->getTag('ai.platform')); |
| 1655 | + |
| 1656 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
| 1657 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 1658 | + } |
| 1659 | + |
| 1660 | + public function testElevenLabsPlatformWithCustomHttpClientCanBeRegistered() |
| 1661 | + { |
| 1662 | + $container = $this->buildContainer([ |
| 1663 | + 'ai' => [ |
| 1664 | + 'platform' => [ |
| 1665 | + 'elevenlabs' => [ |
| 1666 | + 'api_key' => 'foo', |
| 1667 | + 'http_client' => 'foo', |
| 1668 | + ], |
| 1669 | + ], |
| 1670 | + ], |
| 1671 | + ]); |
| 1672 | + |
| 1673 | + $this->assertTrue($container->hasDefinition('ai.platform.elevenlabs')); |
| 1674 | + |
| 1675 | + $definition = $container->getDefinition('ai.platform.elevenlabs'); |
| 1676 | + |
| 1677 | + $this->assertTrue($definition->isLazy()); |
| 1678 | + $this->assertSame([PlatformFactory::class, 'create'], $definition->getFactory()); |
| 1679 | + |
| 1680 | + $this->assertCount(6, $definition->getArguments()); |
| 1681 | + $this->assertSame('foo', $definition->getArgument(0)); |
| 1682 | + $this->assertSame('https://api.elevenlabs.io/v1', $definition->getArgument(1)); |
| 1683 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(2)); |
| 1684 | + $this->assertSame('foo', (string) $definition->getArgument(2)); |
| 1685 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(3)); |
| 1686 | + $this->assertSame('ai.platform.model_catalog.elevenlabs', (string) $definition->getArgument(3)); |
| 1687 | + $this->assertNull($definition->getArgument(4)); |
| 1688 | + $this->assertInstanceOf(Reference::class, $definition->getArgument(5)); |
| 1689 | + $this->assertSame('event_dispatcher', (string) $definition->getArgument(5)); |
| 1690 | + |
| 1691 | + $this->assertTrue($definition->hasTag('proxy')); |
| 1692 | + $this->assertSame([['interface' => PlatformInterface::class]], $definition->getTag('proxy')); |
| 1693 | + $this->assertTrue($definition->hasTag('ai.platform')); |
| 1694 | + $this->assertSame([['name' => 'elevenlabs']], $definition->getTag('ai.platform')); |
| 1695 | + |
| 1696 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface $elevenlabs')); |
| 1697 | + $this->assertTrue($container->hasAlias('Symfony\AI\Platform\PlatformInterface')); |
| 1698 | + } |
| 1699 | + |
1579 | 1700 | #[TestDox('Token usage processor tags use the correct agent ID')] |
1580 | 1701 | public function testTokenUsageProcessorTags() |
1581 | 1702 | { |
@@ -4464,9 +4585,9 @@ private function getFullConfig(): array |
4464 | 4585 | 'version' => '2025-04-16', |
4465 | 4586 | 'http_client' => 'http_client', |
4466 | 4587 | ], |
4467 | | - 'eleven_labs' => [ |
| 4588 | + 'elevenlabs' => [ |
4468 | 4589 | 'host' => 'https://api.elevenlabs.io/v1', |
4469 | | - 'api_key' => 'eleven_labs_key_full', |
| 4590 | + 'api_key' => 'elevenlabs_key_full', |
4470 | 4591 | ], |
4471 | 4592 | 'gemini' => [ |
4472 | 4593 | 'api_key' => 'gemini_key_full', |
|
0 commit comments