Skip to content

Conversation

@uerka
Copy link
Contributor

@uerka uerka commented Dec 18, 2025

Q A
Bug fix? yes
New feature? yes
Docs? no
Issues
License MIT

Currently it seems not possible to define bedrock as a platform.
Added configuration for this platform with support of multiple instances (for example per AWS region). Added tests for model clients. Changed Bedrock's PlatformFactory to have nullable BedrockRuntimeClient

So now the AWS bedrock can be configured together with other platforms as follows:

ai:
    platform:
        bedrock:
            default: ~
            us:
                bedrock_runtime_client: 'async_aws.client.bedrock_runtime_us'
    agent:
        default:
            platform: 'ai.platform.bedrock_default'
            model:
                name: 'claude-sonnet-4-5-20250929'

Also fixed some smaller bugs for Nova model (exception of sending model name).

@uerka
Copy link
Contributor Author

uerka commented Dec 18, 2025

It seems like to run tests successfully for ai-bundle link call would be needed (at least it helped for me locally). Is it possible or should i search for another approach?
Also not sure i understand why demo tests are failing - as far as i see there is nothing related bedrock.

could someone help me out with those ?

PS big thanks for quick merge of previous issue, it was my first one contribution, so pardon me for silly questions))

@OskarStark OskarStark changed the title [AI Bundle] [Platform] allow configure bedrock platform via bundle config [AI Bundle][Platform] allow configure bedrock platform via bundle config Dec 18, 2025
@uerka uerka force-pushed the feat/bedrock-platform-config branch from 0fb4ea9 to 6b5ad59 Compare December 19, 2025 09:36
Copy link
Member

@chr-hertel chr-hertel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @uerka for picking up here 👍

Comment on lines 413 to 415
if (!ContainerBuilder::willBeAvailable('symfony/ai-bedrock-platform', BedrockFactory::class, ['symfony/ai-bundle'])) {
throw new RuntimeException('Bedrock platform configuration requires "symfony/ai-bedrock-platform" package. Try running "composer require symfony/ai-bedrock-platform".');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs a check for [] === $type['bedrock'] or to be moved into foreach

see #1214 for similar

@carsonbot carsonbot changed the title [AI Bundle][Platform] allow configure bedrock platform via bundle config allow configure bedrock platform via bundle config Dec 19, 2025
@chr-hertel chr-hertel added Platform Issues & PRs about the AI Platform component AI Bundle Issues & PRs about the AI integration bundle labels Dec 19, 2025
@carsonbot carsonbot changed the title allow configure bedrock platform via bundle config [AI Bundle][Platform] allow configure bedrock platform via bundle config Dec 19, 2025
@uerka uerka force-pushed the feat/bedrock-platform-config branch from 8ff4030 to fd18c26 Compare December 19, 2025 11:58
@uerka uerka marked this pull request as ready for review December 19, 2025 12:22
@uerka uerka requested a review from OskarStark as a code owner December 19, 2025 12:22
@carsonbot carsonbot added Bug Something isn't working Feature New feature labels Dec 19, 2025
@carsonbot
Copy link
Collaborator

It looks like you unchecked the "Allow edits from maintainer" box. That is fine, but please note that if you have multiple commits, you'll need to squash your commits into one before this can be merged. Or, you can check the "Allow edits from maintainers" box and the maintainer can squash for you.

Cheers!

Carsonbot

model: 'text-to-speech'
tools: false
nova:
platform: 'ai.platform.bedrock_default
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
platform: 'ai.platform.bedrock_default
platform: 'ai.platform.bedrock_default

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

guess it was about missing quote mark, fixed)

@nicodemuz
Copy link

I noticed your tests are failing cause of similar reasons as in my PR: #1139

Any idea how to fix these type of issues? Do we need to add new method parameters as last to avoid breaking BC?

{
public static function create(
BedrockRuntimeClient $bedrockRuntimeClient = new BedrockRuntimeClient(),
?BedrockRuntimeClient $bedrockRuntimeClient = null,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this change needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh - not sure about this one.
When its nullable we can pass null as first argument in this line that feels like a better idea than creating BedrockRuntimeClient in the config.
i moved creating client later in code, so i dont really see the problem of having it nullable from now - except of failing tests atm.

i dont mind to have it as required argument and always require it for configuring bedrock platform, but seems like creating client on the fly should work also fine (as soon as creds can be resolved through env vars).

would appreciate your input on this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

understood - let's keep it like that, but go with explicit null check below:

if (null === $bedrockRuntimeClient) {

throw new RuntimeException('Bedrock platform configuration requires "symfony/ai-bedrock-platform" package. Try running "composer require symfony/ai-bedrock-platform".');
}

$platformId = 'ai.platform.bedrock_'.$name;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chr-hertel should we go with

Suggested change
$platformId = 'ai.platform.bedrock_'.$name;
$platformId = 'ai.platform.bedrock.'.$name;

?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, would be more consistent - see azure

return new RawBedrockResult($this->bedrockRuntimeClient->invokeModel(new InvokeModelRequest($request)));
}

public function convert(InvokeModelResponse $bedrockResponse): ToolCallResult|TextResult
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why removing this?

->method('invokeModel')
->with($this->callback(function ($arg) {
$this->assertInstanceOf(InvokeModelRequest::class, $arg);
$this->assertEquals('application/json', $arg->getContentType());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assertSame where possible please

Comment on lines +291 to +310
'claude-opus-4-5-20251101' => [
'class' => Claude::class,
'capabilities' => [
Capability::INPUT_MESSAGES,
Capability::INPUT_IMAGE,
Capability::OUTPUT_TEXT,
Capability::OUTPUT_STREAMING,
Capability::TOOL_CALLING,
],
],
'claude-sonnet-4-5-20250929' => [
'class' => Claude::class,
'capabilities' => [
Capability::INPUT_MESSAGES,
Capability::INPUT_IMAGE,
Capability::OUTPUT_TEXT,
Capability::OUTPUT_STREAMING,
Capability::TOOL_CALLING,
],
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OskarStark OskarStark changed the title [AI Bundle][Platform] allow configure bedrock platform via bundle config [AI Bundle][Platform] Allow configure Bedrock platform via bundle config Dec 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI Bundle Issues & PRs about the AI integration bundle Bug Something isn't working Feature New feature Platform Issues & PRs about the AI Platform component Status: Needs Review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants