Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/ai-bundle/config/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
->scalarNode('api_key')->isRequired()->end()
->end()
->end()
->arrayNode('voyage')
->children()
->scalarNode('api_key')->isRequired()->end()
->end()
->end()
->end()
->end()
->arrayNode('agent')
Expand Down
18 changes: 18 additions & 0 deletions src/ai-bundle/src/AiBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory as OllamaPlatformFactory;
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory as OpenAiPlatformFactory;
use Symfony\AI\Platform\Bridge\OpenRouter\PlatformFactory as OpenRouterPlatformFactory;
use Symfony\AI\Platform\Bridge\Voyage\PlatformFactory as VoyagePlatformFactory;
use Symfony\AI\Platform\Model;
use Symfony\AI\Platform\ModelClientInterface;
use Symfony\AI\Platform\Platform;
Expand Down Expand Up @@ -353,6 +354,23 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
return;
}

if ('voyage' === $type && isset($platform['api_key'])) {
$platformId = 'ai.platform.voyage';
$definition = (new Definition(Platform::class))
->setFactory(VoyagePlatformFactory::class.'::create')
->setLazy(true)
->addTag('proxy', ['interface' => PlatformInterface::class])
->setArguments([
$platform['api_key'],
new Reference('http_client', ContainerInterface::NULL_ON_INVALID_REFERENCE),
])
->addTag('ai.platform');

$container->setDefinition($platformId, $definition);

return;
}

throw new InvalidArgumentException(\sprintf('Platform "%s" is not supported for configuration via bundle at this point.', $type));
}

Expand Down
3 changes: 3 additions & 0 deletions src/ai-bundle/tests/DependencyInjection/AiBundleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,9 @@ private function getFullConfig(): array
'cerebras' => [
'api_key' => 'cerebras_key_full',
],
'voyage' => [
'api_key' => 'voyage_key_full',
],
],
'agent' => [
'my_chat_agent' => [
Expand Down