Skip to content

Commit 60cd625

Browse files
committed
Add bundle integration for Voyage
1 parent 899ca12 commit 60cd625

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

src/ai-bundle/config/options.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,11 @@
8181
->scalarNode('api_key')->isRequired()->end()
8282
->end()
8383
->end()
84+
->arrayNode('voyage')
85+
->children()
86+
->scalarNode('api_key')->isRequired()->end()
87+
->end()
88+
->end()
8489
->end()
8590
->end()
8691
->arrayNode('agent')

src/ai-bundle/src/AiBundle.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Symfony\AI\Platform\Bridge\Ollama\PlatformFactory as OllamaPlatformFactory;
3636
use Symfony\AI\Platform\Bridge\OpenAi\PlatformFactory as OpenAiPlatformFactory;
3737
use Symfony\AI\Platform\Bridge\OpenRouter\PlatformFactory as OpenRouterPlatformFactory;
38+
use Symfony\AI\Platform\Bridge\Voyage\PlatformFactory as VoyagePlatformFactory;
3839
use Symfony\AI\Platform\Model;
3940
use Symfony\AI\Platform\ModelClientInterface;
4041
use Symfony\AI\Platform\Platform;
@@ -353,6 +354,23 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
353354
return;
354355
}
355356

357+
if ('voyage' === $type && isset($platform['api_key'])) {
358+
$platformId = 'ai.platform.voyage';
359+
$definition = (new Definition(Platform::class))
360+
->setFactory(VoyagePlatformFactory::class.'::create')
361+
->setLazy(true)
362+
->addTag('proxy', ['interface' => PlatformInterface::class])
363+
->setArguments([
364+
$platform['api_key'],
365+
new Reference('http_client', ContainerInterface::NULL_ON_INVALID_REFERENCE),
366+
])
367+
->addTag('ai.platform');
368+
369+
$container->setDefinition($platformId, $definition);
370+
371+
return;
372+
}
373+
356374
throw new InvalidArgumentException(\sprintf('Platform "%s" is not supported for configuration via bundle at this point.', $type));
357375
}
358376

src/ai-bundle/tests/DependencyInjection/AiBundleTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,9 @@ private function getFullConfig(): array
326326
'cerebras' => [
327327
'api_key' => 'cerebras_key_full',
328328
],
329+
'voyage' => [
330+
'api_key' => 'voyage_key_full',
331+
],
329332
],
330333
'agent' => [
331334
'my_chat_agent' => [

0 commit comments

Comments
 (0)