feat: support china region deployment #538
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)
Description
This pull request introduces support for Amazon SageMaker models in the project's infrastructure and lambda functions. The changes include modifications to the CLI, API, model management, UI, and user constructs to accommodate SageMaker model integration. Additionally, new files have been added to handle SageMaker chat and embedding models within the LangChain integration.
The motivation behind this change is to leverage the power of Amazon SageMaker for deploying and serving machine learning models, enabling the project to benefit from scalable and efficient model hosting capabilities.
Dependencies required for this change include the AWS SDK for Python (Boto3) and the LangChain library.
Type of change
File Stats Summary
File number involved in this PR: 16, unfold to see the details:
The file changes summary is as follows:
CN_NORTH_1
andCN_NORTHWEST_1
, to theSupportedRegion
enum for supporting regions in China.modelRegion
property from the provided configuration, handling the image URL domain and ECR account for China regions, and adding an EventBridge rule to trigger a Lambda function.🤖 AI-Generated PR Description (Powered by Amazon Bedrock)
Description
This pull request includes changes to integrate Amazon SageMaker models for text generation and embedding tasks within the application. The key changes are:
source/lambda/online/common_logic/langchain_integration/models/chat_models/sagemaker_models.py
to support Amazon SageMaker text generation models for chat functionality.source/lambda/online/common_logic/langchain_integration/models/embedding_models/__init__.py
andsource/lambda/online/common_logic/langchain_integration/models/embedding_models/sagemaker_embeddings.py
to integrate Amazon SageMaker embedding models.source/portal/src/pages/chatbot/ChatBot.tsx
,source/portal/src/pages/chatbotManagement/ChatbotDetail.tsx
,source/portal/src/pages/customService/CustomerService.tsx
, andsource/portal/src/pages/intention/IntentionDetail.tsx
) to support the new SageMaker model integration.source/infrastructure/cli/magic-config.ts
,source/infrastructure/lib/api/model-management.ts
,source/infrastructure/lib/model/model-construct.ts
,source/infrastructure/lib/shared/types.ts
,source/infrastructure/lib/ui/ui-portal.ts
,source/infrastructure/lib/ui/ui-stack.ts
,source/infrastructure/lib/user/user-construct.ts
, andsource/infrastructure/package.json
) to accommodate the SageMaker model integration.source/script/build.sh
) to include the new changes.This change requires updating the application documentation to reflect the new SageMaker model integration and usage instructions.
Type of change
File Stats Summary
File number involved in this PR: 20, unfold to see the details:
The file changes summary is as follows:
enteredTextLabel
prop to theSelect
component, which allows customizing the label for the entered text value.CN_NORTH_1
andCN_NORTHWEST_1
, to theSupportedRegion
enum, likely for supporting China regions.deployRegion
prop to theUserConstruct
and updating theCfnOutput
to directly referenceuserConstruct.userPoolId
instead ofuserConstruct.userPool.userPoolId
.enableKeyboardNavigation
prop from the table component, remove thewrapLinesPreference
,stripedRowsPreference
,contentDensityPreference
, andcontentDisplayPreference
props, and modify thestickyColumnsPreference
prop.deployRegion
to theUserProps
interface, and conditionally sets up either Cognito resources (UserPool, UserPoolDomain, UserPoolClient, etc.) or custom OIDC resources based on whether thedeployRegion
starts withcn-
(China region).modelRegion
property to be initialized from the provided configuration, and set themodelImageUrlDomain
andmodelPublicEcrAccount
based on whether the deployment region is in China or not.enableKeyboardNavigation
prop from theTable
component, remove thewrapLinesPreference
,stripedRowsPreference
,contentDensityPreference
, andcontentDisplayPreference
props from thePreferences
component, and modify thestickyColumnsPreference
prop.🤖 AI-Generated PR Description (Powered by Amazon Bedrock)
Description
This pull request introduces a new feature that integrates Amazon SageMaker models for both chat and embedding capabilities into the existing infrastructure. The key changes include:
sagemaker_models.py
to support SageMaker chat models.sagemaker_embeddings.py
to incorporate SageMaker embedding models.model-construct.ts
,ui-portal.ts
,ui-stack.ts
, anduser-construct.ts
, to accommodate the new SageMaker model integration.ChatBot.tsx
,ChatbotDetail.tsx
,CustomerService.tsx
, andIntentionDetail.tsx
, to reflect the new SageMaker model functionality.build.sh
and package dependencies inpackage.json
.This change requires the installation of the necessary SageMaker dependencies and the provisioning of SageMaker resources (models, endpoints, etc.) for the integration to work correctly.
Type of change
File Stats Summary
File number involved in this PR: 20, unfold to see the details:
The file changes summary is as follows:
ModelConstruct
class to dynamically set the deployment region using a configuration property, and handle the appropriate ECR account and image URL domain for China regions.enteredTextLabel
prop to theSelect
component, which allows customizing the label displayed for the entered text value in the dropdown.deployRegion
property to theUserConstruct
and updates theCfnOutput
to export theuserPoolId
directly from theUserConstruct
instead of accessing it through theuserPool
property.enableKeyboardNavigation
prop from the table component, remove thewrapLinesPreference
,stripedRowsPreference
,contentDensityPreference
, andcontentDisplayPreference
props, and modify thestickyColumnsPreference
prop.typing
module, imports the module at the beginning, renames a model provider constant, and improves code readability with better formatting and line breaks.enableKeyboardNavigation
prop from the table component, simplifies thecontentDisplayPreference
prop by removing unnecessary options, and removes thewrapLinesPreference
,stripedRowsPreference
, andcontentDensityPreference
props.