Skip to content

Conversation

mludvig
Copy link
Contributor

@mludvig mludvig commented Oct 7, 2025

In some organisations the SCP may restrict global inference profiles while allowing the regional ones (e.g. US businesses may allow cross region inference in us-- but not global inference outside of the US). This patch adds support for enableBedrockGlobalInference that works the same as the existing enableBedrockCrossRegionInference. By default it's enabled so no change for the existing users.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@Yukinobu-Mine
Copy link
Contributor

Yukinobu-Mine commented Oct 11, 2025

@mludvig Thank you for your contribution! Could you please also change the unit test for get_model_id()?

@mludvig
Copy link
Contributor Author

mludvig commented Oct 12, 2025

Added test for global inference:

tests/test_bedrock.py::TestGetModelId::test_get_model_id_with_cross_region_supported_model PASSED
tests/test_bedrock.py::TestGetModelId::test_get_model_id_with_global_inference_priority PASSED
tests/test_bedrock.py::TestGetModelId::test_get_model_id_with_regional_fallback PASSED
tests/test_bedrock.py::TestGetModelId::test_get_model_id_with_unsupported_region_fallback PASSED
tests/test_bedrock.py::TestGetModelId::test_get_model_id_with_unsupported_region_for_cross_region PASSED
tests/test_bedrock.py::TestGetModelId::test_get_model_id_without_cross_region PASSED
tests/test_bedrock.py::TestGetModelId::test_get_model_id_without_global_with_cross_region_inference_priority PASSED
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

@Yukinobu-Mine
Copy link
Contributor

Yukinobu-Mine commented Oct 14, 2025

@mludvig It looks like CDK test failed. Could you please fix it?
https://github.com/aws-samples/bedrock-chat/actions/runs/18450423965/job/52750604817#step:4:1

@mludvig
Copy link
Contributor Author

mludvig commented Oct 15, 2025

@Yukinobu-Mine CDK tests fixed, please review again.

@statefb
Copy link
Contributor

statefb commented Oct 15, 2025

@mludvig Could you revert file name modifications (test_conversation_schema.py and test_bot_usecase.py) ? This is because this change affects entire naming rule of this project.

@mludvig
Copy link
Contributor Author

mludvig commented Oct 15, 2025

Oops, sorry @statefb, I didn't mean to include it in the push.

I'm unable to run pytest without it though, it keeps failing with name collisions. But that's a debate for another day.


// Bedrock configuration
bedrockRegion: z.string().default("us-east-1"),
enableBedrockGlobalInference: z.boolean().default(true),
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you add this option into cdk.json as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants