Skip to content

Commit 71aa87e

Browse files
Jérémy Vancoilliejvancoillie
authored andcommitted
feat(aibundle): add support for the albert platform configuration
1 parent 4845bbd commit 71aa87e

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

src/ai-bundle/config/options.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@
2929
->children()
3030
->arrayNode('platform')
3131
->children()
32+
->arrayNode('albert')
33+
->children()
34+
->stringNode('api_key')->isRequired()->end()
35+
->stringNode('base_url')->isRequired()->end()
36+
->stringNode('http_client')
37+
->defaultValue('http_client')
38+
->info('Service ID of the HTTP client to use')
39+
->end()
40+
->end()
41+
->end()
3242
->arrayNode('anthropic')
3343
->children()
3444
->stringNode('api_key')->isRequired()->end()

src/ai-bundle/src/AiBundle.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
use Symfony\AI\Chat\Bridge\Meilisearch\MessageStore as MeilisearchMessageStore;
3939
use Symfony\AI\Chat\Bridge\Pogocache\MessageStore as PogocacheMessageStore;
4040
use Symfony\AI\Chat\MessageStoreInterface;
41+
use Symfony\AI\Platform\Bridge\Albert\PlatformFactory as AlbertPlatformFactory;
4142
use Symfony\AI\Platform\Bridge\Anthropic\PlatformFactory as AnthropicPlatformFactory;
4243
use Symfony\AI\Platform\Bridge\Azure\OpenAi\PlatformFactory as AzureOpenAiPlatformFactory;
4344
use Symfony\AI\Platform\Bridge\Cerebras\PlatformFactory as CerebrasPlatformFactory;
@@ -415,6 +416,25 @@ private function processPlatformConfig(string $type, array $platform, ContainerB
415416
return;
416417
}
417418

419+
if ('albert' === $type) {
420+
$platformId = 'ai.platform.albert';
421+
$definition = (new Definition(Platform::class))
422+
->setFactory(AlbertPlatformFactory::class.'::create')
423+
->setLazy(true)
424+
->addTag('proxy', ['interface' => PlatformInterface::class])
425+
->setArguments([
426+
$platform['api_key'],
427+
$platform['base_url'],
428+
new Reference($platform['http_client'], ContainerInterface::NULL_ON_INVALID_REFERENCE),
429+
new Reference('event_dispatcher'),
430+
])
431+
->addTag('ai.platform', ['name' => 'albert']);
432+
433+
$container->setDefinition($platformId, $definition);
434+
435+
return;
436+
}
437+
418438
if ('openrouter' === $type) {
419439
$platformId = 'ai.platform.openrouter';
420440
$definition = (new Definition(Platform::class))

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2774,6 +2774,10 @@ private function getFullConfig(): array
27742774
'anthropic' => [
27752775
'api_key' => 'anthropic_key_full',
27762776
],
2777+
'albert' => [
2778+
'api_key' => 'albert-test-key',
2779+
'base_url' => 'https://albert.api.etalab.gouv.fr/v1',
2780+
],
27772781
'azure' => [
27782782
'my_azure_instance' => [
27792783
'api_key' => 'azure_key_full',

0 commit comments

Comments
 (0)