|
53 | 53 | use Symfony\AI\Platform\Bridge\Albert\PlatformFactory as AlbertPlatformFactory; |
54 | 54 | use Symfony\AI\Platform\Bridge\Anthropic\PlatformFactory as AnthropicPlatformFactory; |
55 | 55 | use Symfony\AI\Platform\Bridge\Azure\OpenAi\PlatformFactory as AzureOpenAiPlatformFactory; |
| 56 | +use Symfony\AI\Platform\Bridge\Bedrock\PlatformFactory as BedrockFactory; |
56 | 57 | use Symfony\AI\Platform\Bridge\Cartesia\PlatformFactory as CartesiaPlatformFactory; |
57 | 58 | use Symfony\AI\Platform\Bridge\Cerebras\PlatformFactory as CerebrasPlatformFactory; |
58 | 59 | use Symfony\AI\Platform\Bridge\Decart\PlatformFactory as DecartPlatformFactory; |
@@ -408,6 +409,31 @@ private function processPlatformConfig(string $type, array $platform, ContainerB |
408 | 409 | return; |
409 | 410 | } |
410 | 411 |
|
| 412 | + if ('bedrock' === $type) { |
| 413 | + if (!ContainerBuilder::willBeAvailable('symfony/ai-bedrock-platform', BedrockFactory::class, ['symfony/ai-bundle'])) { |
| 414 | + throw new RuntimeException('Bedrock platform configuration requires "symfony/ai-bedrock-platform" package. Try running "composer require symfony/ai-bedrock-platform".'); |
| 415 | + } |
| 416 | + |
| 417 | + foreach ($platform as $name => $config) { |
| 418 | + $platformId = 'ai.platform.bedrock_'.$name; |
| 419 | + $definition = (new Definition(Platform::class)) |
| 420 | + ->setFactory(BedrockFactory::class.'::create') |
| 421 | + ->setLazy(true) |
| 422 | + ->addTag('proxy', ['interface' => PlatformInterface::class]) |
| 423 | + ->setArguments([ |
| 424 | + $config['bedrock_runtime_client'] ? new Reference($config['bedrock_runtime_client'], ContainerInterface::NULL_ON_INVALID_REFERENCE) : null, |
| 425 | + $config['model_catalog'] ? new Reference($config['model_catalog']) : new Reference('ai.platform.model_catalog.bedrock'), |
| 426 | + null, |
| 427 | + new Reference('event_dispatcher'), |
| 428 | + ]) |
| 429 | + ->addTag('ai.platform', ['name' => 'bedrock_'.$name]); |
| 430 | + |
| 431 | + $container->setDefinition($platformId, $definition); |
| 432 | + } |
| 433 | + |
| 434 | + return; |
| 435 | + } |
| 436 | + |
411 | 437 | if ('cache' === $type) { |
412 | 438 | foreach ($platform as $name => $cachedPlatformConfig) { |
413 | 439 | $definition = (new Definition(CachedPlatform::class)) |
|
0 commit comments