├── source ├── lambda │ ├── chat │ │ ├── handlers │ │ │ └── __init__.py │ │ ├── shared │ │ │ ├── __init__.py │ │ │ ├── callbacks │ │ │ │ └── __init__.py │ │ │ ├── defaults │ │ │ │ └── __init__.py │ │ │ ├── knowledge │ │ │ │ └── __init__.py │ │ │ └── memory │ │ │ │ └── __init__.py │ │ ├── __init__.py │ │ ├── llms │ │ │ ├── __init__.py │ │ │ ├── models │ │ │ │ ├── __init__.py │ │ │ │ └── sagemaker │ │ │ │ │ └── __init__.py │ │ │ ├── rag │ │ │ │ └── __init__.py │ │ │ └── factories │ │ │ │ └── __init__.py │ │ ├── test │ │ │ ├── __init__.py │ │ │ ├── llms │ │ │ │ ├── __init__.py │ │ │ │ ├── models │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── sagemaker │ │ │ │ │ │ └── __init__.py │ │ │ │ └── rag │ │ │ │ │ └── __init__.py │ │ │ ├── utils │ │ │ │ └── __init__.py │ │ │ ├── clients │ │ │ │ ├── __init__.py │ │ │ │ ├── builders │ │ │ │ │ └── __init__.py │ │ │ │ └── factories │ │ │ │ │ └── __init__.py │ │ │ └── shared │ │ │ │ ├── defaults │ │ │ │ └── __init__.py │ │ │ │ ├── knowledge │ │ │ │ ├── __init__.py │ │ │ │ └── mock_bedrock_response.json │ │ │ │ └── memory │ │ │ │ └── __init__.py │ │ ├── utils │ │ │ ├── __init__.py │ │ │ └── custom_exceptions.py │ │ ├── clients │ │ │ ├── __init__.py │ │ │ ├── builders │ │ │ │ └── __init__.py │ │ │ └── factories │ │ │ │ └── __init__.py │ │ └── .gitignore │ ├── custom-authorizer │ │ ├── .gitignore │ │ ├── test │ │ │ └── jest-environment-variables.ts │ │ └── jest.config.js │ ├── layers │ │ ├── aws_boto3 │ │ │ ├── .gitignore │ │ │ └── pyproject.toml │ │ ├── langchain │ │ │ ├── .gitignore │ │ │ └── pyproject.toml │ │ ├── custom_boto3_init │ │ │ ├── test │ │ │ │ ├── __init__.py │ │ │ │ └── conftest.py │ │ │ ├── __init__.py │ │ │ └── .gitignore │ │ ├── aws-sdk-lib │ │ │ ├── index.ts │ │ │ ├── jest.config.js │ │ │ └── tsconfig.json │ │ └── aws-node-user-agent-config │ │ │ └── tsconfig.json │ ├── ext-idp-group-mapper │ │ ├── config │ │ │ └── group_mapping.json │ │ └── __init__.py │ ├── invoke-agent │ │ ├── __init__.py │ │ ├── invoker │ │ │ └── __init__.py │ │ └── utils │ │ │ └── __init__.py │ ├── custom-resource │ │ ├── __init__.py │ │ ├── operations │ │ │ └── __init__.py │ │ ├── test │ │ │ ├── utils │ │ │ │ ├── __init__.py │ │ │ │ └── test_lambda_context_parser.py │ │ │ ├── fixtures │ │ │ │ ├── __init__.py │ │ │ │ ├── gen_uuid_events.py │ │ │ │ ├── gen_domain_prefix_events.py │ │ │ │ ├── gen_ecr_repo_prefix_events.py │ │ │ │ ├── lambda_version_generator_events.py │ │ │ │ ├── cw_log_retention.py │ │ │ │ ├── agentcore_outbound_permissions_events.py │ │ │ │ ├── agentcore_oauth_client_events.py │ │ │ │ ├── update_llm_config.py │ │ │ │ └── admin_policy_events.py │ │ │ ├── operations │ │ │ │ └── __init__.py │ │ │ └── __init__.py │ │ ├── utils │ │ │ ├── __init__.py │ │ │ └── lambda_context_parser.py │ │ └── .gitignore │ ├── agentcore-invocation │ │ ├── test │ │ │ └── __init__.py │ │ └── utils │ │ │ └── __init__.py │ ├── use-case-management │ │ ├── exception │ │ │ └── missing-value-error.ts │ │ ├── utils │ │ │ └── error.ts │ │ ├── model │ │ │ └── commands │ │ │ │ ├── case-command.ts │ │ │ │ ├── workflow-command.ts │ │ │ │ └── agent-builder-command.ts │ │ ├── power-tools-init.ts │ │ └── jest.config.js │ ├── model-info │ │ ├── models │ │ │ └── types.ts │ │ ├── power-tools-init.ts │ │ ├── utils │ │ │ ├── constants.ts │ │ │ └── check-env.ts │ │ └── jest.config.js │ ├── files-management │ │ ├── utils │ │ │ └── error.ts │ │ ├── power-tools-init.ts │ │ └── jest.config.js │ ├── use-case-details │ │ ├── utils │ │ │ └── error.ts │ │ ├── power-tools-init.ts │ │ └── jest.config.js │ ├── files-metadata-management │ │ ├── utils │ │ │ └── error.ts │ │ ├── power-tools-init.ts │ │ └── jest.config.js │ ├── websocket-connectors │ │ ├── power-tools-init.ts │ │ ├── jest.config.js │ │ └── disconnect-handler.ts │ └── feedback-management │ │ ├── power-tools-init.ts │ │ ├── jest.config.js │ │ └── model │ │ └── data-model.ts ├── infrastructure │ ├── test │ │ ├── mock-ui │ │ │ ├── .gitignore │ │ │ ├── public │ │ │ │ └── index.html │ │ │ ├── src │ │ │ │ └── index.jsx │ │ │ ├── index.html │ │ │ └── tsconfig.json │ │ ├── mock-lambda-func │ │ │ ├── typescript-lambda │ │ │ │ ├── .gitignore │ │ │ │ ├── index.ts │ │ │ │ ├── test │ │ │ │ │ └── index.test.ts │ │ │ │ ├── tsconfig.json │ │ │ │ └── package.json │ │ │ ├── .gitignore │ │ │ ├── python-lambda │ │ │ │ ├── __init__.py │ │ │ │ ├── poetry.lock │ │ │ │ ├── function.py │ │ │ │ └── pyproject.toml │ │ │ └── node-lambda │ │ │ │ ├── package-lock.json │ │ │ │ └── package.json │ │ ├── api │ │ │ └── model-schema │ │ │ │ └── shared │ │ │ │ └── utils.ts │ │ └── modifiedCdk.ts │ ├── .gitignore │ ├── jest.config.js │ ├── lib │ │ ├── api │ │ │ └── model-schema │ │ │ │ ├── deployments │ │ │ │ ├── agents │ │ │ │ │ ├── deploy-agent-usecase-response.ts │ │ │ │ │ ├── update-agent-usecase-response.ts │ │ │ │ │ ├── update-agent-usecase-body.ts │ │ │ │ │ └── deploy-agent-usecase-body.ts │ │ │ │ ├── deploy-usecase-response.ts │ │ │ │ ├── update-usecase-response.ts │ │ │ │ ├── mcp │ │ │ │ │ ├── deploy-mcp-usecase-response.ts │ │ │ │ │ └── update-mcp-usecase-response.ts │ │ │ │ └── workflows │ │ │ │ │ ├── update-workflow-usecase-response.ts │ │ │ │ │ └── deploy-workflow-usecase-response.ts │ │ │ │ ├── shared │ │ │ │ └── agent-memory-params.ts │ │ │ │ └── multimodal │ │ │ │ └── files-get-response-body.ts │ │ ├── s3web │ │ │ ├── copy-use-case-ui-assets.ts │ │ │ └── copy-deployment-ui-assets.ts │ │ ├── framework │ │ │ └── bundler │ │ │ │ └── base-asset-options.ts │ │ ├── storage │ │ │ └── deployment-platform-model-info-storage.ts │ │ └── utils │ │ │ ├── cfn-guard-suppressions.ts │ │ │ └── log-group-retention-check-aspect.ts │ ├── jest.setup.ts │ └── tsconfig.json ├── ui-deployment │ ├── .gitignore │ ├── public │ │ ├── robots.txt │ │ ├── favicon.png │ │ └── manifest.json │ ├── src │ │ ├── components │ │ │ ├── useCaseDetails │ │ │ │ ├── types │ │ │ │ │ ├── index.ts │ │ │ │ │ └── types.ts │ │ │ │ ├── agentDetails │ │ │ │ │ └── index.ts │ │ │ │ ├── workflowDetails │ │ │ │ │ └── index.js │ │ │ │ ├── workflowOrchestration │ │ │ │ │ └── index.js │ │ │ │ ├── memory │ │ │ │ │ └── index.ts │ │ │ │ ├── gateway │ │ │ │ │ ├── index.ts │ │ │ │ │ └── GatewayDetails.tsx │ │ │ │ ├── runtime │ │ │ │ │ └── index.ts │ │ │ │ ├── systemPrompt │ │ │ │ │ ├── index.ts │ │ │ │ │ └── SystemPromptDetails.tsx │ │ │ │ ├── targets │ │ │ │ │ ├── index.ts │ │ │ │ │ └── TargetItem.tsx │ │ │ │ ├── mcps │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── ToolItem.tsx │ │ │ │ │ ├── MCPsList.tsx │ │ │ │ │ └── ToolsList.tsx │ │ │ │ ├── knowledgeBase │ │ │ │ │ └── DisabledKnowledgeBase.tsx │ │ │ │ └── model │ │ │ │ │ └── FormattedModelParams.tsx │ │ │ ├── wizard │ │ │ │ ├── Agent │ │ │ │ │ ├── index.ts │ │ │ │ │ └── __tests__ │ │ │ │ │ │ └── Agent.test.tsx │ │ │ │ ├── Prompt │ │ │ │ │ └── index.ts │ │ │ │ ├── AgentBuilder │ │ │ │ │ └── index.ts │ │ │ │ ├── KnowledgeBase │ │ │ │ │ ├── providers │ │ │ │ │ │ ├── Bedrock │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ ├── Bedrock.tsx │ │ │ │ │ │ │ └── __tests__ │ │ │ │ │ │ │ │ └── Bedrock.test.tsx │ │ │ │ │ │ ├── Kendra │ │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ │ ├── KendraResourceRetentionWarning.tsx │ │ │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ │ │ └── KendraResourceRetention.test.tsx │ │ │ │ │ │ │ └── AdditionalKendraOptions.tsx │ │ │ │ │ │ └── index.ts │ │ │ │ │ └── index.ts │ │ │ │ ├── VpcConfig │ │ │ │ │ └── index.ts │ │ │ │ ├── Model │ │ │ │ │ ├── providers │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── Sagemaker.tsx │ │ │ │ │ │ └── __tests__ │ │ │ │ │ │ │ └── Sagemaker.test.tsx │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── AdvancedModelSettings │ │ │ │ │ │ └── index.ts │ │ │ │ │ ├── SagemakerPayloadSchema │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ │ ├── InputSchema.test.tsx │ │ │ │ │ │ │ └── RenderedInputPayload.test.tsx │ │ │ │ │ │ └── SagemakerPayloadSchema.tsx │ │ │ │ │ └── common │ │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── GuardrailVersionInput.test.tsx │ │ │ │ │ │ ├── ModelArnInput.test.tsx │ │ │ │ │ │ ├── GuardrailIdentifierInput.test.tsx │ │ │ │ │ │ └── ProvisionedModelRadio.test.tsx │ │ │ │ │ │ └── VerboseToggle.tsx │ │ │ │ ├── Review │ │ │ │ │ └── index.ts │ │ │ │ ├── UseCase │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── __tests__ │ │ │ │ │ │ ├── UseCaseName.test.tsx │ │ │ │ │ │ ├── UserEmail.test.tsx │ │ │ │ │ │ └── DeployUI.test.tsx │ │ │ │ │ └── UseCaseTypeSelection.tsx │ │ │ │ ├── AgentFlowReview │ │ │ │ │ ├── index.ts │ │ │ │ │ └── __tests__ │ │ │ │ │ │ └── AgentReview.test.tsx │ │ │ │ ├── interfaces │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── UseCaseTypes │ │ │ │ │ │ ├── UseCaseType.tsx │ │ │ │ │ │ └── Agent.tsx │ │ │ │ │ ├── BaseFormComponent.tsx │ │ │ │ │ └── Steps │ │ │ │ │ │ └── BaseWizardStep.tsx │ │ │ │ ├── Workflow │ │ │ │ │ └── index.ts │ │ │ │ └── MCPServer │ │ │ │ │ ├── index.ts │ │ │ │ │ └── SmithyTarget.tsx │ │ │ ├── __tests__ │ │ │ │ └── snapshot_tests │ │ │ │ │ ├── dashboard │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ └── Dashboard.test.tsx.snap │ │ │ │ │ ├── wizard │ │ │ │ │ ├── stepComponents │ │ │ │ │ │ └── __snapshots__ │ │ │ │ │ │ │ ├── Review.test.jsx.snap │ │ │ │ │ │ │ └── KnowledgeBase.test.jsx.snap │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ │ └── WizardView.test.tsx.snap │ │ │ │ │ └── WizardView.test.tsx │ │ │ │ │ └── useCaseDetails │ │ │ │ │ ├── __snapshots__ │ │ │ │ │ ├── UseCaseView.test.tsx.snap │ │ │ │ │ └── Gateway.test.tsx.snap │ │ │ │ │ └── UseCaseView.test.tsx │ │ │ ├── commons │ │ │ │ ├── copy-text │ │ │ │ │ └── styles.css │ │ │ │ ├── breadcrumbs.js │ │ │ │ ├── external-link.tsx │ │ │ │ ├── index.ts │ │ │ │ ├── info-link.tsx │ │ │ │ ├── json-code-view.tsx │ │ │ │ ├── use-local-storage.ts │ │ │ │ ├── use-component-id.ts │ │ │ │ ├── columnDefinitionsHelper.js │ │ │ │ ├── localStorage.ts │ │ │ │ ├── separated-list.tsx │ │ │ │ ├── use-column-widths.js │ │ │ │ └── __tests__ │ │ │ │ │ └── json-code-view.test.tsx │ │ │ └── common │ │ │ │ └── index.ts │ │ ├── contexts │ │ │ ├── index.ts │ │ │ ├── home.context.tsx │ │ │ └── home.state.tsx │ │ ├── i18n-strings │ │ │ ├── text-filter.ts │ │ │ ├── index.ts │ │ │ ├── app-layout.ts │ │ │ ├── flashbar.ts │ │ │ ├── header.ts │ │ │ ├── pagination.ts │ │ │ └── table.ts │ │ ├── App.css │ │ ├── services │ │ │ └── index.ts │ │ ├── utils │ │ │ ├── dateUtils.js │ │ │ ├── index.ts │ │ │ ├── ValueWithLabel.tsx │ │ │ ├── displayUtils.jsx │ │ │ └── linkUtils.js │ │ └── index.css │ ├── setupTests.ts │ ├── index.html │ └── tsconfig.json ├── aws-codeguru-reviewer.yml ├── scripts │ └── v2_migration │ │ ├── requirements.txt │ │ └── pyproject.toml ├── ui-chat │ ├── src │ │ ├── i18n │ │ │ ├── locales │ │ │ │ ├── en.json │ │ │ │ ├── es.json │ │ │ │ └── fr.json │ │ │ └── i18n-strings │ │ │ │ ├── index.ts │ │ │ │ ├── app-layout.ts │ │ │ │ └── split-panel.ts │ │ ├── models │ │ │ ├── user.ts │ │ │ ├── index.ts │ │ │ ├── feedback.ts │ │ │ ├── api │ │ │ │ └── document.ts │ │ │ ├── runtime-config.ts │ │ │ └── message.ts │ │ ├── utils │ │ │ └── index.ts │ │ ├── components │ │ │ ├── tool-usage │ │ │ │ ├── index.ts │ │ │ │ └── ToolUsageList.scss │ │ │ ├── thinking │ │ │ │ ├── index.ts │ │ │ │ └── ExpandableContent.scss │ │ │ └── tools │ │ │ │ ├── index.ts │ │ │ │ └── ToolsContent.tsx │ │ ├── __tests__ │ │ │ ├── server.ts │ │ │ └── pages │ │ │ │ └── chat │ │ │ │ └── components │ │ │ │ └── header │ │ │ │ └── ChatHeader.test.tsx │ │ ├── styles.css │ │ ├── pages │ │ │ └── chat │ │ │ │ └── components │ │ │ │ ├── index.ts │ │ │ │ └── messages │ │ │ │ └── types.ts │ │ ├── store │ │ │ ├── types.ts │ │ │ └── store.ts │ │ ├── App.tsx │ │ ├── contexts │ │ │ └── ToolsContext.tsx │ │ └── setupTests.ts │ ├── .gitignore │ ├── public │ │ ├── favicon.png │ │ └── manifest.json │ ├── tsconfig.node.json │ ├── index.html │ └── .eslintrc.cjs ├── .eslintignore └── model-info │ ├── chat-sagemaker-default.json │ └── chat-bedrock-inference-profile.json ├── deployment ├── cdk-solution-helper │ ├── .gitignore │ ├── package-lock.json │ └── package.json ├── ecr │ ├── gaab-strands-common │ │ ├── test │ │ │ ├── __init__.py │ │ │ └── pytest_plugin.py │ │ ├── pytest.ini │ │ ├── src │ │ │ └── gaab_strands_common │ │ │ │ ├── multimodal │ │ │ │ └── __init__.py │ │ │ │ ├── constants.py │ │ │ │ ├── custom_tools │ │ │ │ └── setup │ │ │ │ │ └── __init__.py │ │ │ │ └── utils │ │ │ │ └── constants.py │ │ ├── pyproject.toml │ │ ├── README.md │ │ └── scripts │ │ │ └── run_unit_tests.sh │ ├── gaab-strands-agent │ │ ├── .dockerignore │ │ └── test │ │ │ ├── run_tests.py │ │ │ └── conftest.py │ ├── gaab-strands-workflow-agent │ │ └── .dockerignore │ └── .dockerignore └── get-cdk-version.js ├── docs ├── architecture │ ├── agent_usecase_architecture.png │ ├── text_usecase_architecture.png │ ├── text_usecase_architecture_vpc.png │ ├── agent_usecase_architecture_vpc.png │ ├── deployment_dashboard_architecture.png │ └── deployment_dashboard_architecture_vpc.png └── sagemaker-ai-payload-examples │ ├── deepseek-r1-distill-llama-3B.md │ └── alexaTM-20B.md ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE │ └── feature_request.md ├── CODE_OF_CONDUCT.md └── SECURITY.md /source/lambda/chat/handlers/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /source/lambda/custom-authorizer/.gitignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /deployment/cdk-solution-helper/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /source/lambda/layers/aws_boto3/.gitignore: -------------------------------------------------------------------------------- 1 | *.dist-info* 2 | jp.py -------------------------------------------------------------------------------- /source/lambda/layers/langchain/.gitignore: -------------------------------------------------------------------------------- 1 | *.dist-info* 2 | jp.py -------------------------------------------------------------------------------- /source/infrastructure/test/mock-ui/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | !src/* 3 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-ui/public/index.html: -------------------------------------------------------------------------------- 1 | Blank test file -------------------------------------------------------------------------------- /source/ui-deployment/.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | public/runtimeConfig.json 3 | 4 | 5 | -------------------------------------------------------------------------------- /source/aws-codeguru-reviewer.yml: -------------------------------------------------------------------------------- 1 | version: 1.0 2 | 3 | excludeFiles: 4 | - '**/dist/**/*.js' 5 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/typescript-lambda/.gitignore: -------------------------------------------------------------------------------- 1 | dist/ 2 | *.d.ts 3 | *.js -------------------------------------------------------------------------------- /source/scripts/v2_migration/requirements.txt: -------------------------------------------------------------------------------- 1 | moto==5.0.18 2 | pytest==8.3.3 3 | pytest-cov==5.0.0 4 | pytest-env==1.1.5 -------------------------------------------------------------------------------- /source/ui-deployment/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/.gitignore: -------------------------------------------------------------------------------- 1 | infrastructure/* 2 | .venv/ 3 | __pycache__/ 4 | *.pyc 5 | node_modules/ -------------------------------------------------------------------------------- /source/ui-chat/src/i18n/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "sidenav": { 3 | "chatOption": "Chat", 4 | "header": "Chat" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /source/ui-chat/src/i18n/locales/es.json: -------------------------------------------------------------------------------- 1 | { 2 | "sidenav": { 3 | "chatOption": "Chat", 4 | "header": "Chat" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /source/lambda/ext-idp-group-mapper/config/group_mapping.json: -------------------------------------------------------------------------------- 1 | { 2 | "group1": "mapped-group1", 3 | "group2": "mapped-group2" 4 | } -------------------------------------------------------------------------------- /source/ui-chat/.gitignore: -------------------------------------------------------------------------------- 1 | # build artifact, used by Mock Service Worker 2 | public/mockServiceWorker.js 3 | **/.vite/ 4 | **/runtimeConfig.json 5 | -------------------------------------------------------------------------------- /source/ui-chat/src/i18n/locales/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "sidenav": { 3 | "chatOption": "Discussion", 4 | "header": "Discussion" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /source/lambda/chat/shared/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/invoke-agent/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/ui-chat/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/source/ui-chat/public/favicon.png -------------------------------------------------------------------------------- /source/lambda/chat/shared/callbacks/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/chat/shared/defaults/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/chat/shared/knowledge/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/chat/shared/memory/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/invoke-agent/invoker/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-ui/src/index.jsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/agentcore-invocation/test/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/operations/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/ui-deployment/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/source/ui-deployment/public/favicon.png -------------------------------------------------------------------------------- /source/lambda/chat/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/operations/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/layers/custom_boto3_init/test/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/chat/llms/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/clients/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/llms/models/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/llms/rag/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/llms/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /docs/architecture/agent_usecase_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/docs/architecture/agent_usecase_architecture.png -------------------------------------------------------------------------------- /docs/architecture/text_usecase_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/docs/architecture/text_usecase_architecture.png -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/python-lambda/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | -------------------------------------------------------------------------------- /source/lambda/chat/clients/builders/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/llms/factories/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/clients/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/llms/models/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/llms/rag/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/utils/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/ext-idp-group-mapper/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /docs/architecture/text_usecase_architecture_vpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/docs/architecture/text_usecase_architecture_vpc.png -------------------------------------------------------------------------------- /source/lambda/chat/clients/factories/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/llms/models/sagemaker/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/clients/builders/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/shared/defaults/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/shared/knowledge/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/shared/memory/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /docs/architecture/agent_usecase_architecture_vpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/docs/architecture/agent_usecase_architecture_vpc.png -------------------------------------------------------------------------------- /source/lambda/chat/test/clients/factories/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /source/lambda/chat/test/llms/models/sagemaker/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | -------------------------------------------------------------------------------- /docs/architecture/deployment_dashboard_architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/docs/architecture/deployment_dashboard_architecture.png -------------------------------------------------------------------------------- /docs/architecture/deployment_dashboard_architecture_vpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aws-solutions/generative-ai-application-builder-on-aws/HEAD/docs/architecture/deployment_dashboard_architecture_vpc.png -------------------------------------------------------------------------------- /source/infrastructure/.gitignore: -------------------------------------------------------------------------------- 1 | *.js 2 | !jest.config.js 3 | !jest.setEnvVars.js 4 | *.d.ts 5 | 6 | # CDK asset staging directory 7 | .cdk.staging 8 | cdk.out 9 | 10 | *tmp* 11 | dist 12 | 13 | -------------------------------------------------------------------------------- /source/ui-chat/src/models/user.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export interface User { 5 | alias: string; 6 | } 7 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/types/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './types'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Agent/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { default } from './Agent'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Prompt/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { default } from './Prompt'; 5 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/test/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | """ 5 | Test package for gaab-strands-common 6 | """ 7 | -------------------------------------------------------------------------------- /source/lambda/layers/aws-sdk-lib/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { AWSClientManager } from './aws-client-manager'; 5 | -------------------------------------------------------------------------------- /source/ui-chat/src/i18n/i18n-strings/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | export * from './app-layout'; 4 | export * from './split-panel'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/AgentBuilder/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { default } from './AgentBuilder'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/Bedrock/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | export * from './Bedrock'; 4 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/dashboard/__snapshots__/Dashboard.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Snapshot test for Dashboard 1`] = `
`; 4 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/Kendra/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './Kendra'; 5 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Issue #, if available:* 2 | 3 | *Description of changes:* 4 | 5 | By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/copy-text/styles.css: -------------------------------------------------------------------------------- 1 | /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | * SPDX-License-Identifier: Apache-2.0 */ 3 | 4 | .custom-wrapping { 5 | word-break: break-all; 6 | } 7 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/agentDetails/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { AgentDetails } from './AgentDetails'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/VpcConfig/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './Vpc'; 5 | export { default } from './Vpc'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/providers/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './Bedrock'; 5 | export * from './Sagemaker'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Review/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './Review'; 5 | export { default } from './Review'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/UseCase/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './UseCase'; 5 | export { default } from './UseCase'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/wizard/stepComponents/__snapshots__/Review.test.jsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Chat > Snapshot test for wizard step 4 1`] = `
`; 4 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/workflowDetails/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { WorkflowDetails } from './WorkflowDetails'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './Kendra'; 5 | export * from './Bedrock'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/wizard/stepComponents/__snapshots__/KnowledgeBase.test.jsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Chat > Snapshot test for wizard step 3 1`] = `null`; 4 | -------------------------------------------------------------------------------- /deployment/get-cdk-version.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | const pkg = require("../source/infrastructure/node_modules/aws-cdk/package.json"); 5 | console.log(pkg.version); 6 | -------------------------------------------------------------------------------- /source/ui-chat/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './constants'; 5 | export * from './API.adapter'; 6 | export * from './construct-api-payload'; 7 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/workflowOrchestration/index.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { WorkflowOrchestration } from './WorkflowOrchestration'; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './KnowledgeBase'; 5 | export { default } from './KnowledgeBase'; 6 | -------------------------------------------------------------------------------- /source/lambda/chat/.gitignore: -------------------------------------------------------------------------------- 1 | aws_lambda_power_tools/* 2 | aws_xray_sdk/* 3 | botocore/* 4 | dateutil/* 5 | jmesopath/* 6 | urllib* 7 | wrapt/* 8 | boto3/* 9 | .coverage 10 | s3transfer/* 11 | *.dist-info 12 | jp.py 13 | THIRD_PARTY-LICENSES 14 | .venv 15 | venv 16 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/.gitignore: -------------------------------------------------------------------------------- 1 | aws_lambda_power_tools/* 2 | aws_xray_sdk/* 3 | botocore/* 4 | dateutil/* 5 | jmesopath/* 6 | urllib* 7 | wrapt/* 8 | boto3/* 9 | .coverage 10 | s3transfer/* 11 | *.dist-info 12 | jp.py 13 | THIRD_PARTY-LICENSES 14 | 15 | 16 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/AgentFlowReview/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './AgentFlowReview'; 5 | export { default } from './AgentFlowReview'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/memory/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { Memory } from './Memory'; 5 | export { MemoryDetails } from './MemoryDetails'; 6 | -------------------------------------------------------------------------------- /source/ui-chat/src/components/tool-usage/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { ToolUsageList } from './ToolUsageList'; 5 | export type { ToolUsageListProps } from './ToolUsageList'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/gateway/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { GatewayDetails } from './GatewayDetails'; 5 | export { Gateway } from './Gateway'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/runtime/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { Runtime } from './Runtime'; 5 | export { RuntimeDetails } from './RuntimeDetails'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/contexts/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './home.context'; 5 | export * from './home.state'; 6 | 7 | export { default } from './home.context'; 8 | -------------------------------------------------------------------------------- /source/ui-deployment/src/i18n-strings/text-filter.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const getTextFilterCounterText = (count: number) => `${count} ${count === 1 ? 'match' : 'matches'}`; 5 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './Model'; 5 | export { default } from './Model'; 6 | 7 | export * from './ModelSelection'; 8 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/interfaces/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './BaseFormComponent'; 5 | export { WorkflowUseCaseType } from './UseCaseTypes/Workflow'; 6 | -------------------------------------------------------------------------------- /source/lambda/custom-authorizer/test/jest-environment-variables.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | process.env = { 5 | USER_POOL_ID: 'fake-user-pool-id', 6 | CLIENT_ID: 'fake-clients-id' 7 | }; 8 | -------------------------------------------------------------------------------- /source/ui-chat/src/components/tool-usage/ToolUsageList.scss: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | .tool-usage-list { 5 | display: flex; 6 | flex-direction: column; 7 | gap: 4px; 8 | margin: 0; 9 | } -------------------------------------------------------------------------------- /source/ui-chat/tsconfig.node.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "composite": true, 4 | "skipLibCheck": true, 5 | "module": "ESNext", 6 | "moduleResolution": "bundler", 7 | "allowSyntheticDefaultImports": true 8 | }, 9 | "include": ["vite.config.ts"] 10 | } 11 | -------------------------------------------------------------------------------- /source/lambda/layers/custom_boto3_init/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from custom_config import custom_usr_agent_config 5 | from helper import get_service_client, get_service_resource, get_session 6 | -------------------------------------------------------------------------------- /source/ui-chat/src/components/thinking/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { ThinkingIndicator } from './ThinkingIndicator'; 5 | export type { ThinkingIndicatorProps } from './ThinkingIndicator'; 6 | -------------------------------------------------------------------------------- /source/ui-chat/src/components/tools/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { ToolUsageIndicator } from './ToolUsageIndicator'; 5 | export type { ToolUsageIndicatorProps } from './ToolUsageIndicator'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/breadcrumbs.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const resourcesBreadcrumbs = [ 5 | { 6 | text: '', 7 | href: '/' 8 | } 9 | ]; 10 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/AdvancedModelSettings/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './AdvancedModelSettings'; 5 | export { default } from './AdvancedModelSettings'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/SagemakerPayloadSchema/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './SagemakerPayloadSchema'; 5 | export { default } from './SagemakerPayloadSchema'; 6 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/systemPrompt/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { SystemPrompt } from './SystemPrompt'; 5 | export { SystemPromptDetails } from './SystemPromptDetails'; 6 | -------------------------------------------------------------------------------- /source/lambda/use-case-management/exception/missing-value-error.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export class MissingValueError extends Error { 5 | constructor(message: string) { 6 | super(message); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /source/lambda/invoke-agent/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from .config_retriever import * 5 | from .constants import * 6 | from .event_processor import * 7 | from .helper import * 8 | from .websocket_handler import * 9 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/targets/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { Targets } from './Targets'; 5 | export { TargetItem } from './TargetItem'; 6 | export { TargetsList } from './TargetsList'; 7 | -------------------------------------------------------------------------------- /source/ui-deployment/src/App.css: -------------------------------------------------------------------------------- 1 | /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | * SPDX-License-Identifier: Apache-2.0 */ 3 | 4 | .amplify-tabs { 5 | display: none; 6 | } 7 | 8 | .signout-button { 9 | position:absolute; 10 | top: 17px; 11 | right: 20px; 12 | } 13 | -------------------------------------------------------------------------------- /source/.eslintignore: -------------------------------------------------------------------------------- 1 | # don't ever lint node_modules 2 | node_modules 3 | cdk.out 4 | # don't lint build output (make sure it's set to your correct build folder name) 5 | dist 6 | # don't lint test folders 7 | test 8 | # don't lint coverage output 9 | coverage 10 | *.config.js 11 | # dont lint eslint config 12 | *.eslint* 13 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/python-lambda/poetry.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Poetry 2.1.3 and should not be changed by hand. 2 | package = [] 3 | 4 | [metadata] 5 | lock-version = "2.1" 6 | python-versions = "^3.13" 7 | content-hash = "f01b553f3895e558c34b4f10542e05acdef39bf0527c8090bd136d914dc73f94" 8 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-ui/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Mock UI page 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /source/lambda/layers/custom_boto3_init/.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | aws_lambda_powertools/ 3 | aws_xray_sdk/ 4 | botocore/ 5 | dateutil/ 6 | jmespath/ 7 | urllib*/ 8 | wrapt/ 9 | boto3/ 10 | six.py 11 | python_dateutil/ 12 | typing_extensions.py 13 | THIRD-PARTY-LICENSES 14 | *.dist-info 15 | *.egg-info 16 | jp.py 17 | s3transfer/* 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | ## Code of Conduct 2 | This project has adopted the [Amazon Open Source Code of Conduct](https://aws.github.io/code-of-conduct). 3 | For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq) or contact 4 | opensource-codeofconduct@amazon.com with any additional questions or comments. 5 | 6 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/python-lambda/function.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import logging 6 | 7 | 8 | def handler(event, _): 9 | logging.debug("Mock lambda implementation for Python runtime") 10 | -------------------------------------------------------------------------------- /source/lambda/model-info/models/types.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /** 5 | * Interface for retry settings 6 | */ 7 | export interface RetrySettings { 8 | maxRetries: number; 9 | backOffRate: number; 10 | initialDelayMs: number; 11 | } -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/mcps/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { MCPs } from './MCPs'; 5 | export { MCPsList } from './MCPsList'; 6 | export { ToolsList } from './ToolsList'; 7 | export { ToolItem } from './ToolItem'; 8 | -------------------------------------------------------------------------------- /deployment/cdk-solution-helper/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@amzn/cdk-solution-helper", 3 | "version": "0.1.0", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@amzn/cdk-solution-helper", 9 | "version": "0.1.0", 10 | "license": "Apache-2.0" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/types/types.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export interface BaseDetailsContainerProps { 5 | loadHelpPanelContent: (id: number) => void; 6 | selectedDeployment: any; 7 | runtimeConfig: any; 8 | } 9 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/pytest.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = test 3 | python_files = test_*.py 4 | python_classes = Test* 5 | python_functions = test_* 6 | addopts = 7 | -v 8 | --strict-markers 9 | --tb=short 10 | markers = 11 | asyncio: marks tests as async (deselect with '-m "not asyncio"') 12 | asyncio_mode = auto 13 | -------------------------------------------------------------------------------- /source/ui-deployment/src/services/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './fetchModelData'; 5 | export * from './fetchUseCaseDetails'; 6 | export * from './fetchMcpData'; 7 | export * from './fetchSchemaUpload'; 8 | export * from './fetchAgentData'; 9 | -------------------------------------------------------------------------------- /source/ui-deployment/src/utils/dateUtils.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const dateOptions = { 5 | weekday: 'short', 6 | year: 'numeric', 7 | month: 'short', 8 | day: 'numeric', 9 | hour: 'numeric', 10 | minute: 'numeric' 11 | }; -------------------------------------------------------------------------------- /deployment/cdk-solution-helper/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@amzn/cdk-solution-helper", 3 | "version": "0.1.0", 4 | "description": "This script performs token replacement as part of the build pipeline", 5 | "license": "Apache-2.0", 6 | "author": { 7 | "name": "Amazon Web Services", 8 | "url": "https://aws.amazon.com/solutions" 9 | } 10 | } -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/node-lambda/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@amzn/node-lambda", 3 | "version": "4.0.2", 4 | "lockfileVersion": 2, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "@amzn/node-lambda", 9 | "version": "4.0.2", 10 | "license": "Apache-2.0" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Workflow/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { default } from './Workflow'; 5 | export { default as WorkflowReview } from './WorkflowReview'; 6 | export { default as WorkflowConfigReview } from './WorkflowConfigReview'; 7 | -------------------------------------------------------------------------------- /source/lambda/files-management/utils/error.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export default class RequestValidationError extends Error { 5 | constructor(readonly message: string) { 6 | super(message); 7 | this.name = 'CustomHttpError'; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /source/ui-chat/src/models/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './message'; 5 | export * from './use-case-config'; 6 | export * from './runtime-config'; 7 | export * from './api/document'; 8 | export * from './api/response'; 9 | export * from './feedback'; 10 | -------------------------------------------------------------------------------- /source/lambda/use-case-details/utils/error.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export default class RequestValidationError extends Error { 5 | constructor(readonly message: string) { 6 | super(message); 7 | 8 | this.name = 'CustomHttpError'; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /source/lambda/use-case-management/utils/error.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export default class RequestValidationError extends Error { 5 | constructor(readonly message: string) { 6 | super(message); 7 | 8 | this.name = 'CustomHttpError'; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/wizard/__snapshots__/WizardView.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Snapshot test 1`] = ` 4 |
13 | `; 14 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/typescript-lambda/index.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | import { Handler } from 'aws-lambda'; 6 | 7 | export const handler: Handler = async (event: any, context: any) => { 8 | console.log('Hello world'); 9 | }; 10 | -------------------------------------------------------------------------------- /source/lambda/agentcore-invocation/utils/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from .constants import * 5 | from .event_processor import * 6 | from .helper import * 7 | from .agentcore_client import * 8 | from .keep_alive_manager import * 9 | from .websocket_error_handler import * 10 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/useCaseDetails/__snapshots__/UseCaseView.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Snapshot test 1`] = ` 4 |
11 | No deployment details found for ID: 12 | (Type: 13 | ) 14 |
15 | `; 16 | -------------------------------------------------------------------------------- /source/ui-chat/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "GAABChat", 3 | "name": "Generative AI Application Builder Chat", 4 | "icons": [ 5 | { 6 | "src": "favicon.png", 7 | "type": "image/png", 8 | "sizes": "320x320" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /source/lambda/layers/aws-sdk-lib/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'ts-jest', 3 | testEnvironment: 'node', 4 | collectCoverageFrom: ['*.ts', '!*.test.ts', '!jest.config.js'], 5 | coveragePathIgnorePatterns: ['/node_modules/', '/dist/'], 6 | moduleNameMapper: { 7 | '^aws-node-user-agent-config$': '/../aws-node-user-agent-config/dist' 8 | } 9 | }; 10 | -------------------------------------------------------------------------------- /source/ui-deployment/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "GAABAdmin", 3 | "name": "Generative AI Application Builder Admin", 4 | "icons": [ 5 | { 6 | "src": "favicon.png", 7 | "type": "image/png", 8 | "sizes": "320x320" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/interfaces/UseCaseTypes/UseCaseType.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { BaseWizardStep } from '../Steps/BaseWizardStep'; 5 | 6 | export abstract class UseCaseType { 7 | public abstract steps: BaseWizardStep[]; 8 | public abstract type: string; 9 | } 10 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/typescript-lambda/test/index.test.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | describe('When invoking lambda', () => { 5 | it('should call the lambda', async () => { 6 | console.debug('dummy implementation for unit testing infrastructure. No real test case'); 7 | }); 8 | }); 9 | -------------------------------------------------------------------------------- /source/ui-deployment/src/i18n-strings/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './app-layout'; 5 | export * from './flashbar'; 6 | export * from './collection-preferences'; 7 | export * from './table'; 8 | export * from './pagination'; 9 | export * from './text-filter'; 10 | export * from './header'; 11 | -------------------------------------------------------------------------------- /source/ui-chat/src/models/feedback.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { FeedbackType } from '../pages/chat/components/input/FeedbackForm'; 5 | 6 | export interface FeedbackData { 7 | messageId: string; 8 | type: FeedbackType; 9 | comment: string; 10 | reasons: string[]; 11 | timestamp: string; 12 | } 13 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/utils/test_lambda_context_parser.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | from utils.lambda_context_parser import get_invocation_account_id 5 | 6 | 7 | def test_get_invocation_account_id(mock_lambda_context): 8 | account_id = get_invocation_account_id(mock_lambda_context) 9 | assert account_id == "123456789012" 10 | -------------------------------------------------------------------------------- /source/lambda/files-metadata-management/utils/error.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | /** 5 | * Custom error class for request validation errors 6 | */ 7 | export default class RequestValidationError extends Error { 8 | constructor(message: string) { 9 | super(message); 10 | this.name = 'CustomHttpError'; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /source/lambda/model-info/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Logger } from '@aws-lambda-powertools/logger'; 5 | import { Tracer } from '@aws-lambda-powertools/tracer'; 6 | 7 | const serviceName = { serviceName: 'ModelInfo' }; 8 | 9 | export const tracer = new Tracer(serviceName); 10 | export const logger = new Logger(serviceName); 11 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/useCaseDetails/__snapshots__/Gateway.test.tsx.snap: -------------------------------------------------------------------------------- 1 | // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html 2 | 3 | exports[`Gateway Component Snapshots > Gateway component with missing data 1`] = `null`; 4 | 5 | exports[`Gateway Component Snapshots > Gateway component with null deployment 1`] = `null`; 6 | 7 | exports[`Gateway Component Snapshots > Gateway component with valid data 1`] = `null`; 8 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/external-link.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import React from 'react'; 5 | import Link, { LinkProps } from '@cloudscape-design/components/link'; 6 | 7 | export function ExternalLink(props: LinkProps) { 8 | return ; 9 | } 10 | -------------------------------------------------------------------------------- /source/ui-chat/src/__tests__/server.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { setupServer } from 'msw/node'; 4 | import { handlers } from '../mocks/handlers.ts'; 5 | 6 | // configures a mock server for unit tests. 7 | // call server.use() in test to set up handlers. 8 | export const MOCK_SERVER_URL = 'http://localhost:3001/'; 9 | export const server = setupServer(...handlers(MOCK_SERVER_URL)); 10 | -------------------------------------------------------------------------------- /source/ui-deployment/src/utils/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './test-utils'; 5 | export * from './utils'; 6 | export * from './dateUtils'; 7 | export * from './displayUtils'; 8 | export * from './linkUtils'; 9 | export * from './tools-content'; 10 | export * from './ValueWithLabel'; 11 | export * from './KeyValueDisplay'; 12 | export * from './notificationHelpers'; 13 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/src/gaab_strands_common/multimodal/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | """ 5 | Multimodal - Multimodal processing components for GAAB Strands 6 | """ 7 | 8 | from .file_handler import FileHandler 9 | from .multimodal_processor import MultimodalRequestProcessor 10 | 11 | __all__ = [ 12 | "FileHandler", 13 | "MultimodalRequestProcessor", 14 | ] 15 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-agent/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore virtual environments 2 | .venv 3 | venv 4 | __pycache__ 5 | *.pyc 6 | *.pyo 7 | *.pyd 8 | 9 | # Ignore test artifacts 10 | .pytest_cache 11 | .coverage 12 | htmlcov 13 | 14 | # Ignore IDE files 15 | .vscode 16 | .idea 17 | *.swp 18 | 19 | # Ignore gaab-strands-common's venv and test artifacts 20 | gaab-strands-common/.venv 21 | gaab-strands-common/.pytest_cache 22 | gaab-strands-common/htmlcov 23 | gaab-strands-common/__pycache__ 24 | -------------------------------------------------------------------------------- /source/ui-deployment/setupTests.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | import '@testing-library/jest-dom'; 4 | import { beforeAll, vi } from 'vitest'; 5 | import { Auth } from 'aws-amplify'; 6 | import { mockedAuthenticator } from './src/utils/test-utils'; 7 | 8 | globalThis.jest = vi; 9 | 10 | vi.mock('aws-amplify'); 11 | beforeAll(() => { 12 | Auth.currentAuthenticatedUser = mockedAuthenticator(); 13 | }); 14 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-workflow-agent/.dockerignore: -------------------------------------------------------------------------------- 1 | # Ignore virtual environments 2 | .venv 3 | venv 4 | __pycache__ 5 | *.pyc 6 | *.pyo 7 | *.pyd 8 | 9 | # Ignore test artifacts 10 | .pytest_cache 11 | .coverage 12 | htmlcov 13 | 14 | # Ignore IDE files 15 | .vscode 16 | .idea 17 | *.swp 18 | 19 | # Ignore gaab-strands-common's venv and test artifacts 20 | gaab-strands-common/.venv 21 | gaab-strands-common/.pytest_cache 22 | gaab-strands-common/htmlcov 23 | gaab-strands-common/__pycache__ 24 | -------------------------------------------------------------------------------- /source/ui-chat/src/models/api/document.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export interface SourceDocument { 5 | source_name?: string; 6 | excerpt: string; 7 | link?: string | null; 8 | title?: string | null; 9 | location?: string; 10 | score?: string | number; 11 | document_title?: string | null; 12 | document_id?: string | null; 13 | additional_attributes?: any | null; 14 | } 15 | -------------------------------------------------------------------------------- /source/infrastructure/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | testEnvironment: 'node', 6 | roots: ['/test'], 7 | testMatch: ['**/*.test.ts'], 8 | collectCoverage: true, 9 | transform: { 10 | '^.+\\.tsx?$': 'ts-jest' 11 | }, 12 | coverageReporters: ['text', ['lcov', { projectRoot: '../../' }]], 13 | setupFilesAfterEnv: ['/jest.setup.ts'] 14 | }; 15 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { ExternalLink } from './external-link'; 5 | export { ExternalLinkGroup } from './external-link-group'; 6 | export { InfoLink } from './info-link'; 7 | export { Notifications } from './notifications'; 8 | export { SeparatedList } from './separated-list'; 9 | export { FullPageHeader } from './full-page-header'; 10 | export { Navigation, navItems } from './navigation'; 11 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | ## Reporting Security Issues 2 | 3 | We take all security reports seriously. When we receive such reports, 4 | we will investigate and subsequently address any potential vulnerabilities as 5 | quickly as possible. If you discover a potential security issue in this project, 6 | please notify AWS/Amazon Security via our [vulnerability reporting page] 7 | (http://aws.amazon.com/security/vulnerability-reporting/) or directly via email 8 | to [AWS Security](mailto:aws-security@amazon.com). 9 | Please do _not_ create a public GitHub issue in this project. 10 | -------------------------------------------------------------------------------- /source/lambda/chat/utils/custom_exceptions.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | 5 | class LLMBuildError(Exception): 6 | """Exception raised when building an LLM fails.""" 7 | 8 | pass 9 | 10 | 11 | class LLMInvocationError(Exception): 12 | """Exception raised when invoking an LLM fails.""" 13 | 14 | pass 15 | 16 | 17 | class JsonPathExtractionError(Exception): 18 | """Exception raised when JSONPath extraction fails for SageMaker""" 19 | 20 | pass 21 | -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/agents/deploy-agent-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | export const deployAgentUseCaseResponseSchema: JsonSchema = { 7 | type: JsonSchemaType.OBJECT, 8 | properties: { 9 | useCaseId: { 10 | type: JsonSchemaType.STRING, 11 | description: 'Unique identifier for the deployed agent use case' 12 | } 13 | } 14 | }; -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/agents/update-agent-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | export const updateAgentUseCaseResponseSchema: JsonSchema = { 7 | type: JsonSchemaType.OBJECT, 8 | properties: { 9 | useCaseId: { 10 | type: JsonSchemaType.STRING, 11 | description: 'Unique identifier for the updated agent use case' 12 | } 13 | } 14 | }; -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/info-link.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import React from 'react'; 5 | import Link, { LinkProps } from '@cloudscape-design/components/link'; 6 | 7 | interface InfoLinkProps { 8 | id?: string; 9 | ariaLabel?: string; 10 | onFollow: LinkProps['onFollow']; 11 | } 12 | export const InfoLink = (props: InfoLinkProps) => ( 13 | 14 | Info 15 | 16 | ); 17 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this solution 4 | title: '' 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the feature you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Additional context** 17 | Add any other context or screenshots about the feature request here. 18 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/json-code-view.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import jsonHighlight from '@cloudscape-design/code-view/highlight/json'; 5 | import { CodeView, CodeViewProps } from '@cloudscape-design/code-view'; 6 | 7 | export type JsonCodeViewProps = Omit; 8 | 9 | export const JsonCodeView = (props: JsonCodeViewProps) => { 10 | return ; 11 | }; 12 | 13 | export default JsonCodeView; 14 | -------------------------------------------------------------------------------- /source/ui-chat/src/i18n/i18n-strings/app-layout.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { AppLayoutProps } from '@cloudscape-design/components'; 4 | 5 | export const appLayoutAriaLabels: AppLayoutProps.Labels = { 6 | navigation: 'Navigation drawer', 7 | navigationClose: 'Close navigation drawer', 8 | navigationToggle: 'Open navigation drawer', 9 | notifications: 'Notifications', 10 | tools: 'Help panel', 11 | toolsClose: 'Close help panel', 12 | toolsToggle: 'Open help panel' 13 | }; 14 | -------------------------------------------------------------------------------- /source/ui-deployment/src/i18n-strings/app-layout.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { AppLayoutProps } from '@cloudscape-design/components'; 5 | 6 | export const appLayoutAriaLabels: AppLayoutProps.Labels = { 7 | navigation: 'Side navigation', 8 | navigationToggle: 'Open side navigation', 9 | navigationClose: 'Close side navigation', 10 | notifications: 'Notifications', 11 | tools: 'Help panel', 12 | toolsToggle: 'Open help panel', 13 | toolsClose: 'Close help panel' 14 | }; 15 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/python-lambda/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "mock-lambda-function" 3 | version = "4.0.2" 4 | authors = [ "Amazon Web Services" ] 5 | description = "Mock lambda implementation to unit test infrastructure code" 6 | packages = [ 7 | { include = "*.py" }, 8 | ] 9 | classifiers = [ 10 | "Programming Language :: Python :: 3", 11 | "License :: Apache-2.0", 12 | ] 13 | license = "Apache-2.0" 14 | 15 | [tool.poetry.dependencies] 16 | python = "^3.13" 17 | 18 | [build-system] 19 | requires = [ "poetry-core>=1.0.8" ] 20 | build-backend = "poetry.core.masonry.api" -------------------------------------------------------------------------------- /source/lambda/layers/custom_boto3_init/test/conftest.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import os 6 | 7 | import pytest 8 | 9 | 10 | @pytest.fixture(autouse=True) 11 | def aws_credentials(): 12 | """Mocked AWS Credentials and general environment variables as required by python based lambda functions""" 13 | os.environ["AWS_ACCESS_KEY_ID"] = "fakeId" 14 | os.environ["AWS_SECRET_ACCESS_KEY"] = "fakeAccessKey" # nosec B105 15 | os.environ["AWS_REGION"] = "us-east-1" # must be a valid region 16 | -------------------------------------------------------------------------------- /source/ui-chat/index.html: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Generative AI Application Builder on AWS 13 | 14 | 15 |
16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/use-local-storage.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { useState } from 'react'; 5 | import { load, save } from './localStorage'; 6 | 7 | export function useLocalStorage(key: string, defaultValue?: T) { 8 | const [value, setValue] = useState(() => load(key) ?? defaultValue); 9 | 10 | function handleValueChange(newValue: T) { 11 | setValue(newValue); 12 | save(key, newValue); 13 | } 14 | 15 | return [value, handleValueChange] as const; 16 | } 17 | -------------------------------------------------------------------------------- /source/ui-chat/src/styles.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | * SPDX-License-Identifier: Apache-2.0 4 | */ 5 | 6 | body, 7 | html { 8 | margin: 0; 9 | height: 100%; 10 | } 11 | .amplify-button--primary { 12 | background-color: #eb5f07; 13 | } 14 | 15 | .amplify-tabs-item[data-state="active"] { 16 | color: black; 17 | border-color: #eb5f07; 18 | } 19 | 20 | /* Keep a sticky top navigation bar at the top of the screen when scrolling down */ 21 | #top-nav { 22 | position: sticky; 23 | left: 0; 24 | top: 0; 25 | right: 0; 26 | z-index: 1000; 27 | } 28 | -------------------------------------------------------------------------------- /source/lambda/layers/aws-sdk-lib/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": ["es2018"], 6 | "declaration": true, 7 | "outDir": "./dist", 8 | "rootDir": ".", 9 | "strict": true, 10 | "esModuleInterop": true, 11 | "forceConsistentCasingInFileNames": true, 12 | "moduleResolution": "node", 13 | "resolveJsonModule": true, 14 | "paths": { 15 | "aws-node-user-agent-config": [ 16 | "../aws-node-user-agent-config/dist" 17 | ] 18 | } 19 | }, 20 | "include": ["*.ts"], 21 | "exclude": ["node_modules", "dist"] 22 | } 23 | -------------------------------------------------------------------------------- /source/lambda/custom-authorizer/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: ['/../layers/', '/../layers/aws-sdk-lib/node_modules/'], 6 | testMatch: ['**/*.test.ts'], 7 | setupFiles: ['./test/jest-environment-variables.ts'], 8 | modulePathIgnorePatterns: ['/dist/'], 9 | collectCoverage: true, 10 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 11 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 12 | preset: 'ts-jest' 13 | }; 14 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/utils/lambda_context_parser.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | from aws_lambda_powertools import Logger, Tracer 6 | 7 | logger = Logger(utc=True) 8 | tracer = Tracer() 9 | 10 | ARN_ACCOUNT_ID_INDEX = 4 11 | 12 | 13 | @tracer.capture_method 14 | def get_invocation_account_id(lambda_context): 15 | """Parses the account id from the lambda context. 16 | 17 | Returns: 18 | str: the account id 19 | """ 20 | return lambda_context.invoked_function_arn.split(":")[ARN_ACCOUNT_ID_INDEX] 21 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/src/gaab_strands_common/constants.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | """ 5 | Constants for GAAB Strands agents. 6 | 7 | This module defines shared constants used across all GAAB Strands agents, 8 | including environment variable names and configuration keys. 9 | """ 10 | 11 | # Environment variable names 12 | ENV_USE_CASE_TABLE_NAME = "USE_CASE_TABLE_NAME" 13 | ENV_USE_CASE_CONFIG_KEY = "USE_CASE_CONFIG_KEY" 14 | ENV_AWS_REGION = "AWS_REGION" 15 | ENV_MEMORY_ID = "MEMORY_ID" 16 | ENV_MEMORY_STRATEGY_ID = "MEMORY_STRATEGY_ID" 17 | -------------------------------------------------------------------------------- /source/infrastructure/lib/s3web/copy-use-case-ui-assets.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { UIAssetFolders } from '../utils/constants'; 5 | import { CopyUIAssets } from './copy-ui-assets-nested-stack'; 6 | 7 | /** 8 | * Class responsible for copying UI assets for chat use case. 9 | * Extends the base CopyUIAssets class to override the folder 10 | * for chat use case specific assets. 11 | */ 12 | export class CopyUseCaseUIAssets extends CopyUIAssets { 13 | public getUIAssetFolder(): string { 14 | return UIAssetFolders.CHAT; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/lambda/layers/aws_boto3/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "boto3-layer" 3 | version = "4.0.2" 4 | authors = [ "Amazon Web Services" ] 5 | description = "Layer for AWS Boto3 python SDK" 6 | packages = [ 7 | { include = "*.toml" }, 8 | { include = "*.lock" }, 9 | ] 10 | classifiers = [ 11 | "Programming Language :: Python :: 3", 12 | "License :: Apache-2.0", 13 | ] 14 | license = "Apache-2.0" 15 | 16 | [tool.poetry.dependencies] 17 | botocore = "1.40.53" 18 | boto3 = "1.40.53" 19 | python = "^3.13" 20 | urllib3="2.6.1" 21 | 22 | [build-system] 23 | requires = [ "poetry-core>=1.9.0" ] 24 | build-backend = "poetry.core.masonry.api" -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/mcps/ToolItem.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ValueWithLabel } from '../../../utils/ValueWithLabel'; 5 | 6 | interface Tool { 7 | ToolId: string; 8 | } 9 | 10 | interface ToolItemProps { 11 | tool: Tool; 12 | index: number; 13 | } 14 | 15 | export const ToolItem = ({ tool, index }: ToolItemProps) => { 16 | return ( 17 | 18 | {tool?.ToolId || 'N/A'} 19 | 20 | ); 21 | }; 22 | -------------------------------------------------------------------------------- /source/model-info/chat-sagemaker-default.json: -------------------------------------------------------------------------------- 1 | { 2 | "UseCase": "Chat", 3 | "ModelProviderName": "SageMaker", 4 | "ModelName": "default", 5 | "AllowsStreaming": false, 6 | "Prompt": "{history}\n\n{input}", 7 | "MaxTemperature": "100", 8 | "DefaultTemperature": "0.1", 9 | "MinTemperature": "0", 10 | "DefaultStopSequences": [], 11 | "MemoryConfig": { 12 | "history": "history", 13 | "input": "input", 14 | "context": null, 15 | "ai_prefix": "AI", 16 | "human_prefix": "Human", 17 | "output": null 18 | }, 19 | "MaxPromptSize": 375000, 20 | "MaxChatMessageSize": 375000 21 | } -------------------------------------------------------------------------------- /source/ui-deployment/src/i18n-strings/flashbar.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { FlashbarProps } from '@cloudscape-design/components'; 5 | 6 | export const flashbarI18nStrings: FlashbarProps.I18nStrings = { 7 | ariaLabel: 'Notifications', 8 | notificationBarText: 'Notifications', 9 | notificationBarAriaLabel: 'View all notifications', 10 | errorIconAriaLabel: 'Error', 11 | successIconAriaLabel: 'Success', 12 | warningIconAriaLabel: 'Warning', 13 | infoIconAriaLabel: 'Information', 14 | inProgressIconAriaLabel: 'In progress' 15 | }; 16 | -------------------------------------------------------------------------------- /source/infrastructure/jest.setup.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // Mocks the cdk App creation to include 'aws:cdk:bundling-stacks': [] when running tests 5 | // in order to avoid unecessarry bundling 6 | jest.mock('aws-cdk-lib', () => { 7 | const actualModule = jest.requireActual('aws-cdk-lib'); 8 | const { ModifiedApp, ModifiedStack } = jest.requireActual('./test/modifiedCdk'); 9 | 10 | const modifiedModule = { 11 | ...actualModule, 12 | App: ModifiedApp, 13 | Stack: ModifiedStack 14 | }; 15 | 16 | return modifiedModule; 17 | }); 18 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/gen_uuid_events.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | 6 | import pytest 7 | from operations import operation_types 8 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 9 | 10 | 11 | @pytest.fixture 12 | def lambda_event(aws_credentials, custom_resource_event): 13 | custom_resource_event[RESOURCE_PROPERTIES] = {RESOURCE: operation_types.GEN_UUID} 14 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 15 | 16 | yield custom_resource_event 17 | -------------------------------------------------------------------------------- /source/model-info/chat-bedrock-inference-profile.json: -------------------------------------------------------------------------------- 1 | { 2 | "UseCase": "Chat", 3 | "ModelProviderName": "Bedrock", 4 | "ModelName": "inference-profile", 5 | "AllowsStreaming": true, 6 | "Prompt": "You are a friendly AI assistant that is helpful, honest, and harmless.", 7 | "MaxTemperature": "1", 8 | "DefaultTemperature": "0.5", 9 | "MinTemperature": "0", 10 | "DefaultStopSequences": [], 11 | "MemoryConfig": { 12 | "history": "history", 13 | "input": "input", 14 | "context": null, 15 | "ai_prefix": "AI", 16 | "human_prefix": "Human", 17 | "output": null 18 | }, 19 | "MaxPromptSize": 375000, 20 | "MaxChatMessageSize": 375000 21 | } -------------------------------------------------------------------------------- /source/infrastructure/lib/s3web/copy-deployment-ui-assets.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { UIAssetFolders } from '../utils/constants'; 5 | import { CopyUIAssets } from './copy-ui-assets-nested-stack'; 6 | 7 | /** 8 | * Class responsible for copying UI assets for deployment platforms. 9 | * Extends the base CopyUIAssets class to override the folder 10 | * for deployment specific assets. 11 | */ 12 | export class CopyDeploymentUIAssets extends CopyUIAssets { 13 | public getUIAssetFolder(): string { 14 | return UIAssetFolders.DEPLOYMENT_PLATFORM; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/shared/agent-memory-params.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | export const agentMemoryParams: JsonSchema = { 7 | type: JsonSchemaType.OBJECT, 8 | description: 'Agent memory configuration parameters', 9 | properties: { 10 | LongTermEnabled: { 11 | type: JsonSchemaType.BOOLEAN, 12 | description: 'Enable long-term memory for the agent', 13 | default: false 14 | } 15 | }, 16 | additionalProperties: false 17 | }; 18 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/gen_domain_prefix_events.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | 6 | import pytest 7 | from operations import operation_types 8 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 9 | 10 | 11 | @pytest.fixture 12 | def lambda_event(aws_credentials, custom_resource_event): 13 | custom_resource_event[RESOURCE_PROPERTIES] = {RESOURCE: operation_types.GEN_DOMAIN_PREFIX} 14 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 15 | 16 | yield custom_resource_event 17 | -------------------------------------------------------------------------------- /source/ui-deployment/src/utils/ValueWithLabel.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Box } from '@cloudscape-design/components'; 5 | 6 | interface ValueWithLabelProps { 7 | label: string; 8 | children: React.ReactNode; 9 | 'data-testid'?: string; 10 | } 11 | 12 | export const ValueWithLabel = ({ label, children, 'data-testid': dataTestId }: ValueWithLabelProps) => ( 13 |
14 | {label} 15 |
{children}
16 |
17 | ); 18 | -------------------------------------------------------------------------------- /source/ui-chat/src/pages/chat/components/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export * from './actions/ChatBubbleActions'; 5 | export * from './actions/HeaderActions'; 6 | export * from './messages/ChatMessage'; 7 | 8 | export * from './messages/ChatMessage'; 9 | export * from './messages/ChatMessagesContainer'; 10 | export * from './messages/Messages'; 11 | 12 | export * from './alerts/ConnectionStatus'; 13 | export * from './alerts/ErrorAlert'; 14 | 15 | export * from './input/ChatInput'; 16 | 17 | export * from './header/ChatHeader'; 18 | 19 | export * from './source-documents/SourceDocument'; 20 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/use-component-id.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { useRef } from 'react'; 5 | import { v4 as uuidv4 } from 'uuid'; 6 | 7 | export function useSingleton(provider: () => T): T { 8 | const singleton = useRef(); 9 | 10 | function getSingleton() { 11 | if (singleton.current == null) { 12 | singleton.current = provider(); 13 | } 14 | return singleton.current; 15 | } 16 | 17 | return getSingleton(); 18 | } 19 | 20 | export function useComponentId(): string { 21 | return useSingleton(uuidv4); 22 | } 23 | -------------------------------------------------------------------------------- /source/ui-deployment/src/utils/displayUtils.jsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Box } from '@cloudscape-design/components'; 5 | 6 | export const escapedNewLineToLineBreakTag = (str, componentId) => { 7 | try { 8 | return str.split('\n').map((item, index) => { 9 | return index === 0 ? item : [
, item]; //NOSONAR - split new line characters to html br tags once 10 | }); 11 | } catch (error) { 12 | return ''; 13 | } 14 | }; 15 | 16 | export const createBox = (data) => { 17 | return {data}; 18 | }; -------------------------------------------------------------------------------- /deployment/ecr/.dockerignore: -------------------------------------------------------------------------------- 1 | # Docker ignore file for gaab-strands-agent build 2 | # Build context is deployment/ecr/ 3 | 4 | # Ignore Python cache and compiled files 5 | __pycache__ 6 | *.pyc 7 | *.pyo 8 | *.pyd 9 | .Python 10 | *.so 11 | *.egg 12 | *.egg-info 13 | dist 14 | build 15 | 16 | # Ignore test artifacts 17 | .pytest_cache 18 | .coverage 19 | .tox 20 | 21 | # Ignore version control 22 | .git 23 | .gitignore 24 | 25 | # Ignore test directories 26 | test 27 | tests 28 | 29 | # Ignore IDE files 30 | .vscode 31 | .idea 32 | *.swp 33 | *.swo 34 | *~ 35 | 36 | # Ignore CI/CD 37 | .github 38 | .gitlab-ci.yml 39 | Jenkinsfile 40 | 41 | # Ignore docs 42 | docs 43 | 44 | # Ignore MCP directory 45 | mcp -------------------------------------------------------------------------------- /source/lambda/use-case-management/model/commands/case-command.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { UseCase } from '../use-case'; 5 | import { ListUseCasesAdapter } from '../list-use-cases'; 6 | import { GetUseCaseAdapter } from '../get-use-case'; 7 | import { McpOperation } from '../adapters/mcp-adapter'; 8 | 9 | /** 10 | * Common command interface for all command types (UseCase and MCP) 11 | * Supports both UseCase operations and MCP operations 12 | */ 13 | export interface CaseCommand { 14 | execute(operation: UseCase | ListUseCasesAdapter | GetUseCaseAdapter | McpOperation): Promise; 15 | } 16 | -------------------------------------------------------------------------------- /source/lambda/websocket-connectors/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Logger } from '@aws-lambda-powertools/logger'; 5 | import { Metrics } from '@aws-lambda-powertools/metrics'; 6 | import { Tracer } from '@aws-lambda-powertools/tracer'; 7 | 8 | const serviceName = { serviceName: 'UseCaseManagement' }; 9 | const namespace = 'Solution/UseCaseDeployments'; 10 | 11 | export const tracer = new Tracer(serviceName); 12 | export const logger = new Logger(serviceName); 13 | export const metrics = new Metrics({ 14 | namespace: namespace, 15 | serviceName: serviceName.serviceName 16 | }); 17 | -------------------------------------------------------------------------------- /source/ui-deployment/src/i18n-strings/header.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const getHeaderCounterText = ( 5 | items: ReadonlyArray, 6 | selectedItems: ReadonlyArray | undefined 7 | ) => { 8 | return selectedItems && selectedItems?.length > 0 9 | ? `(${selectedItems.length}/${items.length})` 10 | : `(${items.length})`; 11 | }; 12 | 13 | export const getHeaderCounterServerSideText = (totalCount: number, selectedCount: number | undefined) => { 14 | return selectedCount && selectedCount > 0 ? `(${selectedCount}/${totalCount}+)` : `(${totalCount}+)`; 15 | }; 16 | -------------------------------------------------------------------------------- /source/lambda/model-info/utils/constants.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | export const MODEL_INFO_TABLE_NAME_ENV_VAR = 'MODEL_INFO_TABLE_NAME'; 6 | 7 | export const REQUIRED_ENV_VARS = [MODEL_INFO_TABLE_NAME_ENV_VAR]; 8 | 9 | export enum ModelInfoTableKeys { 10 | MODEL_INFO_TABLE_PARTITION_KEY = 'UseCase', 11 | MODEL_INFO_TABLE_SORT_KEY = 'SortKey', 12 | MODEL_INFO_TABLE_PROVIDER_NAME_KEY = 'ModelProviderName', 13 | MODEL_INFO_TABLE_MODEL_NAME_KEY = 'ModelName', 14 | MODEL_INFO_TABLE_DISPLAY_NAME_KEY = 'DisplayName', 15 | MODEL_INFO_TABLE_DESCRIPTION_KEY = 'Description', 16 | } 17 | -------------------------------------------------------------------------------- /source/lambda/files-management/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Logger } from '@aws-lambda-powertools/logger'; 5 | import { Metrics } from '@aws-lambda-powertools/metrics'; 6 | import { Tracer } from '@aws-lambda-powertools/tracer'; 7 | import { CloudWatchNamespace } from './utils/constants'; 8 | 9 | const serviceName = { serviceName: 'FilesManagement' }; 10 | 11 | export const tracer = new Tracer(serviceName); 12 | export const logger = new Logger(serviceName); 13 | export const metrics = new Metrics({ 14 | namespace: CloudWatchNamespace.FILE_HANDLING, 15 | serviceName: serviceName.serviceName 16 | }); 17 | -------------------------------------------------------------------------------- /source/lambda/use-case-management/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Logger } from '@aws-lambda-powertools/logger'; 5 | import { Metrics } from '@aws-lambda-powertools/metrics'; 6 | import { Tracer } from '@aws-lambda-powertools/tracer'; 7 | import { CloudWatchNamespace } from './utils/constants'; 8 | 9 | const serviceName = { serviceName: 'UseCaseManagement' }; 10 | 11 | export const tracer = new Tracer(serviceName); 12 | export const logger = new Logger(serviceName); 13 | export const metrics = new Metrics({ 14 | namespace: CloudWatchNamespace.USE_CASE_DEPLOYMENTS, 15 | serviceName: serviceName.serviceName 16 | }); -------------------------------------------------------------------------------- /source/ui-deployment/src/i18n-strings/pagination.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { PaginationProps, TableProps } from '@cloudscape-design/components'; 5 | 6 | export const renderAriaLive: TableProps['renderAriaLive'] = ({ firstIndex, lastIndex, totalItemsCount }) => 7 | `Displaying items ${firstIndex} to ${lastIndex} of ${totalItemsCount}`; 8 | 9 | export const paginationAriaLabels: (totalPages?: number) => PaginationProps.Labels = (totalPages) => ({ 10 | nextPageLabel: 'Next page', 11 | previousPageLabel: 'Previous page', 12 | pageLabel: (pageNumber) => `Page ${pageNumber} of ${totalPages || 'all pages'}` 13 | }); 14 | -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/deploy-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | /** 7 | * JSON Schema for the response returned after successfully deploying a new use case. 8 | * Contains the unique identifier for the newly created use case. 9 | */ 10 | export const deployUseCaseResponseSchema: JsonSchema = { 11 | type: JsonSchemaType.OBJECT, 12 | properties: { 13 | useCaseId: { 14 | type: JsonSchemaType.STRING, 15 | description: 'ID of the use case that was created' 16 | } 17 | } 18 | }; -------------------------------------------------------------------------------- /source/lambda/files-metadata-management/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Logger } from '@aws-lambda-powertools/logger'; 5 | import { Metrics } from '@aws-lambda-powertools/metrics'; 6 | import { Tracer } from '@aws-lambda-powertools/tracer'; 7 | import { CloudWatchNamespace } from './utils/constants'; 8 | 9 | const serviceName = { serviceName: 'FilesManagement' }; 10 | 11 | export const tracer = new Tracer(serviceName); 12 | export const logger = new Logger(serviceName); 13 | export const metrics = new Metrics({ 14 | namespace: CloudWatchNamespace.FILE_HANDLING, 15 | serviceName: serviceName.serviceName 16 | }); 17 | -------------------------------------------------------------------------------- /source/lambda/use-case-details/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Logger } from '@aws-lambda-powertools/logger'; 5 | import { Metrics } from '@aws-lambda-powertools/metrics'; 6 | import { Tracer } from '@aws-lambda-powertools/tracer'; 7 | import { CloudWatchNamespace } from './utils/constants'; 8 | 9 | const serviceName = { serviceName: 'Solution/UseCaseDetails' }; 10 | 11 | export const tracer = new Tracer(serviceName); 12 | export const logger = new Logger(serviceName); 13 | export const metrics = new Metrics({ 14 | namespace: CloudWatchNamespace.USE_CASE_DETAILS, 15 | serviceName: serviceName.serviceName 16 | }); 17 | -------------------------------------------------------------------------------- /source/lambda/feedback-management/power-tools-init.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Tracer } from '@aws-lambda-powertools/tracer'; 5 | import { Logger } from '@aws-lambda-powertools/logger'; 6 | import { Metrics } from '@aws-lambda-powertools/metrics'; 7 | import { CloudWatchNamespaces } from './utils/constants'; 8 | 9 | const serviceName = { serviceName: 'FeedbackManagement' }; 10 | 11 | export const tracer = new Tracer(serviceName); 12 | export const logger = new Logger(serviceName); 13 | export const metrics = new Metrics({ 14 | namespace: CloudWatchNamespaces.FEEDBACK_MANAGEMENT, 15 | serviceName: serviceName.serviceName 16 | }); 17 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/src/gaab_strands_common/custom_tools/setup/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | """ 5 | Custom Tools Setup - Core components for custom tools system 6 | """ 7 | 8 | from .base_tool import BaseCustomTool 9 | from .decorators import auto_attach_when, custom_tool, requires 10 | from .metadata import ToolCategory, ToolMetadata, ToolRequirements 11 | from .registry import CustomToolsRegistry 12 | 13 | __all__ = [ 14 | "CustomToolsRegistry", 15 | "BaseCustomTool", 16 | "custom_tool", 17 | "requires", 18 | "auto_attach_when", 19 | "ToolCategory", 20 | "ToolMetadata", 21 | "ToolRequirements", 22 | ] 23 | -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/update-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | /** 7 | * JSON Schema for the response returned after successfully updating an existing use case. 8 | * Contains the unique identifier of the updated use case for confirmation. 9 | */ 10 | export const updateUseCaseResponseSchema: JsonSchema = { 11 | type: JsonSchemaType.OBJECT, 12 | properties: { 13 | useCaseId: { 14 | type: JsonSchemaType.STRING, 15 | description: 'ID of the use case that was updated' 16 | } 17 | } 18 | }; -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/gen_ecr_repo_prefix_events.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import pytest 6 | from operations import operation_types 7 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 8 | 9 | 10 | @pytest.fixture 11 | def lambda_event(aws_credentials, custom_resource_event): 12 | custom_resource_event[RESOURCE_PROPERTIES] = { 13 | RESOURCE: operation_types.GEN_ECR_REPO_PREFIX, 14 | "StackName": "DeploymentPlatformStack" 15 | } 16 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 17 | 18 | yield custom_resource_event -------------------------------------------------------------------------------- /source/ui-chat/src/components/thinking/ExpandableContent.scss: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | .expandable-content { 5 | display: inline; 6 | 7 | &__text { 8 | word-break: break-word; 9 | } 10 | 11 | &__toggle { 12 | background: none; 13 | border: none; 14 | color: #0073bb; 15 | cursor: pointer; 16 | padding: 0 0 0 4px; 17 | font-size: inherit; 18 | text-decoration: underline; 19 | 20 | &:hover { 21 | color: #005a9e; 22 | } 23 | 24 | &:focus { 25 | outline: 2px solid #0073bb; 26 | outline-offset: 2px; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /source/ui-deployment/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Generative AI Application Builder on AWS 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /source/lambda/layers/langchain/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "langchain-layer" 3 | version = "4.0.2" 4 | authors = [ "Amazon Web Services" ] 5 | description = "Layer for LangChain libraries" 6 | packages = [ 7 | { include = "*.toml" }, 8 | { include = "*.lock" }, 9 | ] 10 | classifiers = [ 11 | "Programming Language :: Python :: 3", 12 | "License :: Apache-2.0", 13 | ] 14 | license = "Apache-2.0" 15 | 16 | [tool.poetry.dependencies] 17 | python = "^3.13" 18 | numpy = "2.2.2" 19 | langchain = "0.3.27" 20 | langchain-core = "0.3.80" 21 | langchain-aws = "0.2.31" 22 | pydantic = "2.11.0" 23 | requests="2.32.4" 24 | urllib3="2.6.1" 25 | 26 | [build-system] 27 | requires = [ "poetry-core>=1.9.0" ] 28 | build-backend = "poetry.core.masonry.api" -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/lambda_version_generator_events.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import pytest 6 | from operations import operation_types 7 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 8 | 9 | 10 | @pytest.fixture 11 | def lambda_event(aws_credentials, custom_resource_event): 12 | custom_resource_event[RESOURCE_PROPERTIES] = { 13 | RESOURCE: operation_types.LAMBDA_VERSION_GENERATOR, 14 | "FunctionName": "my-function" 15 | } 16 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 17 | 18 | yield custom_resource_event 19 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-ui/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "types": [ 5 | "vite/client", 6 | "vitest/globals" 7 | ], 8 | "lib": [ 9 | "dom", 10 | "dom.iterable", 11 | "esnext" 12 | ], 13 | "allowJs": true, 14 | "skipLibCheck": true, 15 | "esModuleInterop": true, 16 | "allowSyntheticDefaultImports": true, 17 | "strict": true, 18 | "forceConsistentCasingInFileNames": true, 19 | "module": "esnext", 20 | "moduleResolution": "node", 21 | "resolveJsonModule": true, 22 | "isolatedModules": true, 23 | "noEmit": true, 24 | "jsx": "react-jsx", 25 | "noFallthroughCasesInSwitch": true 26 | }, 27 | "include": [ 28 | "src" 29 | ] 30 | } -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/columnDefinitionsHelper.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const addToColumnDefinitions = (columnDefinitions, propertyName, columns) => 5 | columnDefinitions.map((colDef) => { 6 | const column = (columns || []).find((col) => col.id === colDef.id); 7 | return { 8 | ...colDef, 9 | [propertyName]: (column && column[propertyName]) || colDef[propertyName] 10 | }; 11 | }); 12 | 13 | export const mapWithColumnDefinitionIds = (columnDefinitions, propertyName, items) => 14 | columnDefinitions.map(({ id }, i) => ({ 15 | id, 16 | [propertyName]: items[i] 17 | })); 18 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/Kendra/KendraResourceRetentionWarning.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Alert, Box, FormField } from '@cloudscape-design/components'; 5 | import { KENDRA_WARNING } from '../../../../../utils/constants'; 6 | 7 | export const KendraResourceRetentionWarning = () => { 8 | return ( 9 | 10 | 11 | {KENDRA_WARNING} 12 | 13 | 14 | ); 15 | }; 16 | 17 | export default KendraResourceRetentionWarning; 18 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/localStorage.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export const save = (key: string, value: any) => localStorage.setItem(key, JSON.stringify(value)); 5 | 6 | export const remove = (key: string) => localStorage.removeItem(key); 7 | 8 | export const load = (key: string) => { 9 | const value = localStorage.getItem(key); 10 | try { 11 | return value && JSON.parse(value); 12 | } catch (e) { 13 | console.warn( 14 | `⚠️ The ${key} value that is stored in localStorage is incorrect. Try to remove the value ${key} from localStorage and reload the page` 15 | ); 16 | return undefined; 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /source/lambda/model-info/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | testMatch: ['**/*.test.ts'], 12 | modulePathIgnorePatterns: ['/dist/'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node' 18 | }; 19 | -------------------------------------------------------------------------------- /source/lambda/use-case-details/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | testMatch: ['**/*.test.ts'], 12 | modulePathIgnorePatterns: ['/dist/'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node' 18 | }; 19 | -------------------------------------------------------------------------------- /source/lambda/feedback-management/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | testMatch: ['**/*.test.ts'], 12 | modulePathIgnorePatterns: ['/dist/'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node' 18 | }; 19 | -------------------------------------------------------------------------------- /source/lambda/websocket-connectors/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | modulePathIgnorePatterns: ['/dist/'], 12 | testMatch: ['**/*.test.ts'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node' 18 | }; 19 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/separated-list.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import React from 'react'; 5 | import { useComponentId } from './use-component-id'; 6 | 7 | interface SeparatedListProps { 8 | ariaLabel?: string; 9 | items: Array; 10 | } 11 | 12 | export function SeparatedList({ ariaLabel, items }: SeparatedListProps) { 13 | const componentId = useComponentId(); 14 | return ( 15 |
    16 | {items.map((item, index) => ( 17 |
  • {item}
  • //NOSONAR - using unique componentId to prevent rerenders 18 | ))} 19 |
20 | ); 21 | } 22 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/cw_log_retention.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import pytest 6 | from operations import operation_types 7 | from operations.cw_log_retention import FUNCTION_NAME 8 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 9 | 10 | 11 | @pytest.fixture 12 | def lambda_event(aws_credentials, custom_resource_event): 13 | custom_resource_event[RESOURCE_PROPERTIES] = {RESOURCE: operation_types.CW_LOG_RETENTION} 14 | custom_resource_event[RESOURCE_PROPERTIES][FUNCTION_NAME] = "fake_function_name" 15 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 16 | 17 | yield custom_resource_event 18 | -------------------------------------------------------------------------------- /source/ui-chat/src/i18n/i18n-strings/split-panel.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { SplitPanelProps } from '@cloudscape-design/components'; 4 | 5 | export const splitPanelI18nStrings: SplitPanelProps.I18nStrings = { 6 | preferencesTitle: 'Split panel preferences', 7 | preferencesPositionLabel: 'Split panel position', 8 | preferencesPositionDescription: 'Choose the default split panel position for the service.', 9 | preferencesPositionSide: 'Side', 10 | preferencesPositionBottom: 'Bottom', 11 | preferencesConfirm: 'Confirm', 12 | preferencesCancel: 'Cancel', 13 | closeButtonAriaLabel: 'Close panel', 14 | openButtonAriaLabel: 'Open panel', 15 | resizeHandleAriaLabel: 'Resize split panel' 16 | }; 17 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/MCPServer/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { default } from './MCPServer'; 5 | export * from './helpers'; 6 | 7 | // Export the new modular components 8 | export { default as SchemaUpload } from './SchemaUpload'; 9 | export { default as OutboundAuth } from './OutboundAuth'; 10 | export { default as LambdaTarget } from './LambdaTarget'; 11 | export { default as OpenAPITarget } from './OpenAPITarget'; 12 | export { default as SmithyTarget } from './SmithyTarget'; 13 | export { default as TargetBasicInfo } from './TargetBasicInfo'; 14 | export { default as TargetTypeSelector } from './TargetTypeSelector'; 15 | export { default as MCPTargetConfiguration } from './MCPTargetConfiguration'; -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/mcp/deploy-mcp-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | /** 7 | * JSON Schema for the response returned after successfully deploying a new MCP use case. 8 | * Contains the unique identifier for the newly created MCP use case. 9 | */ 10 | export const deployMcpUseCaseResponseSchema: JsonSchema = { 11 | type: JsonSchemaType.OBJECT, 12 | properties: { 13 | useCaseId: { 14 | type: JsonSchemaType.STRING, 15 | description: 'ID of the MCP use case that was created' 16 | } 17 | }, 18 | required: ['useCaseId'], 19 | additionalProperties: false 20 | }; -------------------------------------------------------------------------------- /source/infrastructure/lib/framework/bundler/base-asset-options.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | import * as s3_assets from 'aws-cdk-lib/aws-s3-assets'; 6 | import { IConstruct } from 'constructs'; 7 | 8 | /** 9 | * A type to allow for additional arguments to be passed to the bundling command 10 | */ 11 | export interface AdditionalInstallArguments {} 12 | 13 | /** 14 | * Abstract type that defines the method for asset bundlers. 15 | */ 16 | export abstract class BundlerAssetOptions { 17 | public abstract options( 18 | construct: IConstruct, 19 | entry: string, 20 | packagingOptions?: AdditionalInstallArguments, 21 | assetHash?: string 22 | ): s3_assets.AssetOptions; 23 | } 24 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-agent/test/run_tests.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | #!/usr/bin/env python3 5 | """ 6 | Test runner for all unit tests 7 | """ 8 | 9 | import os 10 | import sys 11 | import unittest 12 | 13 | 14 | def run_all_tests(): 15 | """Run all unit tests""" 16 | # Discover and run all tests in the test directory 17 | loader = unittest.TestLoader() 18 | start_dir = os.path.dirname(__file__) 19 | suite = loader.discover(start_dir, pattern="test_*.py") 20 | 21 | runner = unittest.TextTestRunner(verbosity=2) 22 | result = runner.run(suite) 23 | 24 | return result.wasSuccessful() 25 | 26 | 27 | if __name__ == "__main__": 28 | success = run_all_tests() 29 | sys.exit(0 if success else 1) 30 | -------------------------------------------------------------------------------- /source/lambda/model-info/utils/check-env.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | import { logger } from '../power-tools-init'; 6 | import { REQUIRED_ENV_VARS } from './constants'; 7 | 8 | export const checkEnv = () => { 9 | let missingVars = []; 10 | for (let envVar of REQUIRED_ENV_VARS) { 11 | if (!process.env[envVar]) { 12 | missingVars.push(envVar); 13 | } 14 | } 15 | if (missingVars.length > 0) { 16 | const errMsg = `Missing required environment variables: ${missingVars.join( 17 | ', ' 18 | )}. This should not happen and indicates in issue with your deployment.`; 19 | logger.error(errMsg); 20 | throw new Error(errMsg); 21 | } 22 | }; 23 | -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/mcp/update-mcp-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | /** 7 | * JSON Schema for the response returned after successfully updating an existing MCP use case. 8 | * Contains the unique identifier of the updated MCP use case for confirmation. 9 | */ 10 | export const updateMcpUseCaseResponseSchema: JsonSchema = { 11 | type: JsonSchemaType.OBJECT, 12 | properties: { 13 | useCaseId: { 14 | type: JsonSchemaType.STRING, 15 | description: 'ID of the MCP use case that was updated' 16 | } 17 | }, 18 | required: ['useCaseId'], 19 | additionalProperties: false 20 | }; -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "gaab-strands-common" 3 | version = "0.1.0" 4 | description = "Shared library for GAAB Strands agents" 5 | readme = "README.md" 6 | requires-python = ">=3.13" 7 | license = { text = "Apache-2.0" } 8 | authors = [{ name = "AWS" }] 9 | 10 | dependencies = [ 11 | "pydantic>=2.0.0", 12 | "boto3>=1.34.0", 13 | "bedrock-agentcore>=0.1.0", 14 | "strands-agents>=1.10.0", 15 | ] 16 | 17 | [build-system] 18 | requires = ["hatchling"] 19 | build-backend = "hatchling.build" 20 | 21 | [tool.hatch.build.targets.wheel] 22 | packages = ["src/gaab_strands_common"] 23 | 24 | [tool.uv] 25 | dev-dependencies = [ 26 | "pytest>=8.0.0", 27 | "pytest-cov>=4.1.0", 28 | "pytest-asyncio>=0.23.0", 29 | "black>=24.0.0", 30 | "isort>=5.13.0", 31 | "moto>=5.1.0", 32 | ] 33 | -------------------------------------------------------------------------------- /source/ui-chat/src/models/runtime-config.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { TextUseCaseConfig, AgentUseCaseConfig, AgentBuilderUseCaseConfig, WorkflowUseCaseConfig } from './use-case-config'; 5 | 6 | export interface RuntimeConfig { 7 | IsInternalUser: string; 8 | ModelProviderName: string; 9 | UserPoolId: string; 10 | SocketRoutes: string[]; 11 | UserPoolClientId: string; 12 | CognitoRedirectUrl: string; 13 | ApiEndpoint: string; 14 | SocketURL: string; 15 | AwsRegion: string; 16 | CognitoDomain: string; 17 | UseCaseConfigKey: string; 18 | UseCaseId: string; 19 | UseCaseConfig?: TextUseCaseConfig | AgentUseCaseConfig | AgentBuilderUseCaseConfig | WorkflowUseCaseConfig; 20 | RestApiEndpoint: string; 21 | } 22 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/knowledgeBase/DisabledKnowledgeBase.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ColumnLayout, StatusIndicator, SpaceBetween } from '@cloudscape-design/components'; 5 | import { ValueWithLabel } from '../../../utils/ValueWithLabel'; 6 | 7 | export const DisabledKnowledgeBase = () => { 8 | return ( 9 | 10 | 11 | 12 | disabled 13 | 14 | 15 | 16 | ); 17 | }; 18 | -------------------------------------------------------------------------------- /source/ui-deployment/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "types": [ 5 | "vite/client", 6 | "vitest/globals" 7 | ], 8 | "lib": [ 9 | "dom", 10 | "dom.iterable", 11 | "esnext" 12 | ], 13 | "baseUrl": "./src", 14 | "paths": { 15 | "@/*": [ 16 | "*" 17 | ] 18 | }, 19 | "allowJs": true, 20 | "skipLibCheck": true, 21 | "esModuleInterop": true, 22 | "allowSyntheticDefaultImports": true, 23 | "strict": true, 24 | "forceConsistentCasingInFileNames": true, 25 | "module": "esnext", 26 | "moduleResolution": "Bundler", 27 | "resolveJsonModule": true, 28 | "isolatedModules": true, 29 | "noEmit": true, 30 | "jsx": "react-jsx", 31 | "noFallthroughCasesInSwitch": true 32 | }, 33 | "include": [ 34 | "src" 35 | ] 36 | } -------------------------------------------------------------------------------- /source/lambda/chat/test/shared/knowledge/mock_bedrock_response.json: -------------------------------------------------------------------------------- 1 | { 2 | "retrievalResults": [ 3 | { 4 | "content": { 5 | "text": "this is an excerpt from a fake bedrock knowledge base" 6 | }, 7 | "location": { 8 | "type": "S3", 9 | "s3Location": { 10 | "uri": "s3://fakepath1" 11 | } 12 | }, 13 | "score": 0.25 14 | }, 15 | { 16 | "content": { 17 | "text": "this is another excerpt from a fake bedrock knowledge base" 18 | }, 19 | "location": { 20 | "type": "S3", 21 | "s3Location": { 22 | "uri": "s3://fakepath2" 23 | } 24 | }, 25 | "score": 0.9 26 | } 27 | ] 28 | } -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/workflows/update-workflow-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | /** 7 | * JSON Schema for workflow update response. 8 | * This schema defines the structure of the response returned after successfully 9 | * updating a workflow use case via PATCH /deployments/workflows/{id}. 10 | */ 11 | export const updateWorkflowUseCaseResponseSchema: JsonSchema = { 12 | type: JsonSchemaType.OBJECT, 13 | description: 'Response schema for workflow updates', 14 | properties: { 15 | useCaseId: { 16 | type: JsonSchemaType.STRING, 17 | description: 'Unique identifier for the updated workflow use case' 18 | } 19 | } 20 | }; -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/wizard/WizardView.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '@testing-library/jest-dom'; 5 | import { vi } from 'vitest'; 6 | import { mockReactMarkdown, snapshotWithProvider } from '@/utils'; 7 | import { TextUseCaseType } from '@/components/wizard/interfaces/UseCaseTypes/Text'; 8 | import { USECASE_TYPE_ROUTE } from '@/utils/constants'; 9 | 10 | vi.mock('@cloudscape-design/components'); 11 | 12 | let WizardView: any; 13 | mockReactMarkdown(); 14 | WizardView = (await import('../../../wizard/WizardView')).default; 15 | 16 | test('Snapshot test', async () => { 17 | const tree = snapshotWithProvider(, USECASE_TYPE_ROUTE.TEXT).toJSON(); 18 | expect(tree).toMatchSnapshot(); 19 | }); 20 | -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/deployments/workflows/deploy-workflow-usecase-response.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType } from 'aws-cdk-lib/aws-apigateway'; 5 | 6 | /** 7 | * JSON Schema for workflow deployment response. 8 | * This schema defines the structure of the response returned after successfully 9 | * deploying a workflow use case via POST /deployments/workflows. 10 | */ 11 | export const deployWorkflowUseCaseResponseSchema: JsonSchema = { 12 | type: JsonSchemaType.OBJECT, 13 | description: 'Response schema for workflow deployment', 14 | properties: { 15 | useCaseId: { 16 | type: JsonSchemaType.STRING, 17 | description: 'Unique identifier for the deployed workflow use case' 18 | }, 19 | } 20 | }; -------------------------------------------------------------------------------- /source/lambda/files-metadata-management/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | testMatch: ['**/*.test.ts'], 12 | modulePathIgnorePatterns: ['/dist/'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node', 18 | maxWorkers: 2, 19 | testTimeout: 30000, 20 | forceExit: true, 21 | detectOpenHandles: true 22 | }; 23 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/use-column-widths.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { useMemo } from 'react'; 5 | import { addToColumnDefinitions, mapWithColumnDefinitionIds } from './columnDefinitionsHelper'; 6 | import { useLocalStorage } from './use-local-storage'; 7 | 8 | export function useColumnWidths(storageKey, columnDefinitions) { 9 | const [widths, saveWidths] = useLocalStorage(storageKey); 10 | 11 | function handleWidthChange(event) { 12 | saveWidths(mapWithColumnDefinitionIds(columnDefinitions, 'width', event.detail.widths)); 13 | } 14 | const memoDefinitions = useMemo(() => { 15 | return addToColumnDefinitions(columnDefinitions, 'width', widths); 16 | }, [widths, columnDefinitions]); 17 | 18 | return [memoDefinitions, handleWidthChange]; 19 | } 20 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/node-lambda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "@amzn/node-lambda", 3 | "version": "4.0.2", 4 | "description": "A mock lambda implementation for CDK infrastructure unit", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "jest --coverage --silent --verbose", 8 | "test-debug": "jest --coverage", 9 | "clean": "rm -rf node_modules", 10 | "code-linter-js": "./node_modules/eslint/bin/eslint.js lambda --ext .js", 11 | "code-linter-ts": "./node_modules/eslint/bin/eslint.js bin lib --ext .ts", 12 | "code-linter": "npm run code-linter-ts && npm run code-linter-js", 13 | "code-formatter": "./node_modules/prettier/bin-prettier.js --config .prettierrc.yml '**/*.ts' '**/*.js' --write" 14 | }, 15 | "author": { 16 | "name": "Amazon Web Services", 17 | "url": "https://aws.amazon.com/solutions" 18 | }, 19 | "license": "Apache-2.0" 20 | } 21 | -------------------------------------------------------------------------------- /source/ui-chat/src/store/types.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { EntityState, EntityId } from '@reduxjs/toolkit'; 5 | 6 | /** 7 | * When using custom slices/thunks, we have to keep of the data loading status. 8 | * When using RTK Query instead, that's built in and we don't need the folowing types. 9 | */ 10 | export enum ApiDataStatus { 11 | IDLE = 'IDLE', 12 | LOADING = 'LOADING', 13 | SUCCEEDED = 'SUCCEEDED', 14 | FAILED = 'FAILED' 15 | } 16 | 17 | type StatusAndError = { 18 | status: ApiDataStatus; 19 | error: string | null; 20 | }; 21 | 22 | export type ApiDataState = EntityState & StatusAndError; 23 | 24 | export const DEFAULT_INITIAL_STATE: StatusAndError = { 25 | status: ApiDataStatus.IDLE, 26 | error: null 27 | }; 28 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/UseCase/__tests__/UseCaseName.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import UseCaseName from '../UseCaseName'; 5 | import { cloudscapeRender } from '@/utils'; 6 | import { screen } from '@testing-library/react'; 7 | 8 | describe('UseCaseName', () => { 9 | afterEach(() => { 10 | jest.clearAllMocks(); 11 | }); 12 | 13 | test('should render', () => { 14 | const { cloudscapeWrapper } = cloudscapeRender( 15 | 16 | ); 17 | const element = screen.getByTestId('use-case-name-field'); 18 | expect(element).toBeDefined(); 19 | expect(cloudscapeWrapper.findInput()?.getInputValue()).toEqual('fake-name'); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/UseCase/__tests__/UserEmail.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import UserEmail from '../UserEmail'; 5 | import { cloudscapeRender } from '@/utils'; 6 | import { screen } from '@testing-library/react'; 7 | 8 | describe('UserEmail', () => { 9 | afterEach(() => { 10 | jest.clearAllMocks(); 11 | }); 12 | 13 | test('should render', () => { 14 | const { cloudscapeWrapper } = cloudscapeRender( 15 | 16 | ); 17 | const element = screen.getByTestId('user-email-field'); 18 | expect(element).toBeDefined(); 19 | expect(cloudscapeWrapper.findInput()?.getInputValue()).toEqual('fake-email@example.com'); 20 | }); 21 | }); 22 | -------------------------------------------------------------------------------- /source/infrastructure/test/api/model-schema/shared/utils.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ValidatorResult } from 'jsonschema'; 5 | 6 | /** 7 | * Will check that the provided ValidatorResult is true, and throw back any validation errors that may have occurred. 8 | * This is a utility function for testing to make jest output more helpful 9 | * 10 | * @param result 11 | */ 12 | export function checkValidationSucceeded(result: ValidatorResult) { 13 | try { 14 | expect(result.valid).toBeTruthy(); 15 | } catch (e) { 16 | console.log(result.errors); 17 | throw new Error(`JSON schema validation failed with errors: \n ${result.errors.map((e) => e).join('\n')}`); 18 | } 19 | } 20 | 21 | export function checkValidationFailed(result: ValidatorResult) { 22 | expect(result.valid).toBeFalsy(); 23 | } -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/test/pytest_plugin.py: -------------------------------------------------------------------------------- 1 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | # SPDX-License-Identifier: Apache-2.0 3 | 4 | """ 5 | Pytest plugin to mock decorators before module imports 6 | """ 7 | 8 | import sys 9 | from unittest.mock import MagicMock 10 | 11 | 12 | # Mock the requires_access_token decorator before any imports 13 | def identity_decorator(**kwargs): 14 | """Mock decorator that just returns the function unchanged""" 15 | 16 | def decorator(func): 17 | return func 18 | 19 | return decorator 20 | 21 | 22 | # Create mock module 23 | mock_auth = MagicMock() 24 | mock_auth.requires_access_token = identity_decorator 25 | 26 | # Inject into sys.modules before imports 27 | sys.modules["bedrock_agentcore"] = MagicMock() 28 | sys.modules["bedrock_agentcore.identity"] = MagicMock() 29 | sys.modules["bedrock_agentcore.identity.auth"] = mock_auth 30 | -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/agentcore_outbound_permissions_events.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import pytest 6 | from operations import operation_types 7 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 8 | 9 | 10 | @pytest.fixture 11 | def lambda_event(custom_resource_event): 12 | custom_resource_event[RESOURCE_PROPERTIES] = { 13 | RESOURCE: operation_types.AGENTCORE_OUTBOUND_PERMISSIONS, 14 | "USE_CASE_ID": "test-use-case-123", 15 | "USE_CASE_CLIENT_ID": "fake-client-id", 16 | "USE_CASE_CONFIG_TABLE_NAME": "fake-table-name", 17 | "USE_CASE_CONFIG_RECORD_KEY": "fake-record-key" 18 | } 19 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 20 | 21 | yield custom_resource_event 22 | -------------------------------------------------------------------------------- /source/lambda/layers/aws-node-user-agent-config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2018", 7 | "dom" 8 | ], 9 | "declaration": true, 10 | "strict": true, 11 | "noImplicitAny": true, 12 | "strictNullChecks": true, 13 | "noImplicitThis": true, 14 | "alwaysStrict": true, 15 | "noUnusedLocals": false, 16 | "noUnusedParameters": false, 17 | "noImplicitReturns": true, 18 | "noFallthroughCasesInSwitch": false, 19 | "inlineSourceMap": true, 20 | "inlineSources": true, 21 | "experimentalDecorators": true, 22 | "strictPropertyInitialization": false, 23 | "typeRoots": [ 24 | "./node_modules/@types" 25 | ], 26 | "esModuleInterop": true, 27 | "resolveJsonModule": true, 28 | "outDir": "./dist", 29 | "moduleResolution": "Node", 30 | "rootDir": ".", 31 | } 32 | } -------------------------------------------------------------------------------- /source/ui-chat/.eslintrc.cjs: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | root: true, 6 | env: { browser: true, es2020: true }, 7 | extends: [ 8 | "eslint:recommended", 9 | "plugin:@typescript-eslint/recommended", 10 | "plugin:react-hooks/recommended" 11 | ], 12 | ignorePatterns: [ 13 | "dist", 14 | ".eslintrc.cjs" 15 | ], 16 | parser: "@typescript-eslint/parser", 17 | plugins: ["react-refresh"], 18 | rules: { 19 | "@typescript-eslint/no-unused-vars": ["off", { argsIgnorePattern: "^_" }], 20 | "@typescript-eslint/no-explicit-any": ["off"], 21 | "react-hooks/exhaustive-deps": "off", 22 | "react-refresh/only-export-components": [ 23 | "warn", 24 | { allowConstantExport: true } 25 | ] 26 | } 27 | }; 28 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/providers/Sagemaker.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { SpaceBetween } from '@cloudscape-design/components'; 5 | import { BaseFormComponentProps } from '../../interfaces'; 6 | import SageMakerEndpointNameInput from '../common/SageMakerEndpointName'; 7 | import SagemakerPayloadSchema from '../SagemakerPayloadSchema'; 8 | 9 | export interface SagemakerModelProps extends BaseFormComponentProps { 10 | modelData: any; 11 | } 12 | 13 | export const SagemakerModel = (props: SagemakerModelProps) => { 14 | return ( 15 | 16 | 17 | 18 | 19 | ); 20 | }; 21 | 22 | export default SagemakerModel; 23 | -------------------------------------------------------------------------------- /source/ui-deployment/src/contexts/home.context.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Dispatch, createContext, useEffect } from 'react'; 5 | 6 | import { ActionType } from '../hooks/useCreateReducer'; 7 | 8 | import { HomeInitialState } from './home.state'; 9 | 10 | export interface HomeContextProps { 11 | state: HomeInitialState; 12 | dispatch: Dispatch>; 13 | } 14 | 15 | export const HomeContext = createContext(undefined!); 16 | 17 | export const HomeContextProvider = (props: any) => { 18 | useEffect(() => { 19 | sessionStorage.setItem('init-state', JSON.stringify(props.value.state)); 20 | }, [props.value.state]); 21 | 22 | return {props.children}; 23 | }; 24 | 25 | export default HomeContext; 26 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/Bedrock/Bedrock.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { KnowledgeBaseConfigProps } from '@/components/wizard/interfaces/Steps'; 5 | import { Container, Header, SpaceBetween } from '@cloudscape-design/components'; 6 | import BedrockKnowledgeBaseId from './BedrockKnowledgeBaseId'; 7 | 8 | export const BedrockKnowledgeBase = (props: KnowledgeBaseConfigProps) => { 9 | return ( 10 | Knowledge base configuration} 12 | data-testid="bedrock-knowledgebase-container" 13 | > 14 | 15 | 16 | 17 | 18 | ); 19 | }; 20 | 21 | export default BedrockKnowledgeBase; 22 | -------------------------------------------------------------------------------- /source/infrastructure/test/mock-lambda-func/typescript-lambda/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2018", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2018", 7 | "dom" 8 | ], 9 | "declaration": true, 10 | "strict": true, 11 | "noImplicitAny": true, 12 | "strictNullChecks": true, 13 | "noImplicitThis": true, 14 | "alwaysStrict": true, 15 | "noUnusedLocals": false, 16 | "noUnusedParameters": false, 17 | "noImplicitReturns": true, 18 | "noFallthroughCasesInSwitch": false, 19 | "inlineSourceMap": true, 20 | "inlineSources": true, 21 | "experimentalDecorators": true, 22 | "strictPropertyInitialization": false, 23 | "typeRoots": [ 24 | "./node_modules/@types" 25 | ], 26 | "esModuleInterop": true, 27 | "resolveJsonModule": true, 28 | "outDir": "./dist", 29 | "moduleResolution": "Node", 30 | "rootDir": "." 31 | } 32 | } -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/Kendra/__tests__/KendraResourceRetention.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { KendraResourceRetentionWarning } from '../KendraResourceRetentionWarning'; 5 | import { cloudscapeRender } from '@/utils'; 6 | import { KENDRA_WARNING } from '@/utils/constants'; 7 | import { screen } from '@testing-library/react'; 8 | 9 | describe('KendraResourceRetention', () => { 10 | afterEach(() => { 11 | jest.clearAllMocks(); 12 | }); 13 | 14 | it('renders', () => { 15 | const { cloudscapeWrapper } = cloudscapeRender(); 16 | expect(screen.getByTestId('kendra-resource-retention-alert')).toBeDefined(); 17 | 18 | expect(cloudscapeWrapper.findAlert()?.findContent()?.getElement().innerHTML).toContain(KENDRA_WARNING); 19 | }); 20 | }); 21 | -------------------------------------------------------------------------------- /source/infrastructure/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ES2022", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es2022", 7 | "dom" 8 | ], 9 | "declaration": true, 10 | "strict": true, 11 | "noImplicitAny": true, 12 | "strictNullChecks": true, 13 | "noImplicitThis": true, 14 | "alwaysStrict": true, 15 | "noUnusedLocals": false, 16 | "noUnusedParameters": false, 17 | "noImplicitReturns": true, 18 | "noFallthroughCasesInSwitch": false, 19 | "inlineSourceMap": true, 20 | "inlineSources": true, 21 | "experimentalDecorators": true, 22 | "strictPropertyInitialization": false, 23 | "typeRoots": [ 24 | "./node_modules/@types" 25 | ], 26 | "esModuleInterop": true, 27 | "resolveJsonModule": true 28 | }, 29 | "exclude": [ 30 | "node_modules", 31 | "cdk.out", 32 | "test/mock-lambda-func/typescript-lambda", 33 | "test/mock-ui" 34 | ] 35 | } -------------------------------------------------------------------------------- /source/lambda/custom-resource/test/fixtures/agentcore_oauth_client_events.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | # SPDX-License-Identifier: Apache-2.0 4 | 5 | import pytest 6 | from operations import operation_types 7 | from operations.operation_types import PHYSICAL_RESOURCE_ID, RESOURCE, RESOURCE_PROPERTIES 8 | 9 | 10 | @pytest.fixture 11 | def lambda_event(aws_credentials, custom_resource_event): 12 | custom_resource_event[RESOURCE_PROPERTIES] = { 13 | RESOURCE: operation_types.AGENTCORE_OAUTH_CLIENT, 14 | "CLIENT_ID": "test-client-id", 15 | "CLIENT_SECRET": "test-client-secret", 16 | "DISCOVERY_URL": "https://example.com/.well-known/openid_configuration", 17 | "PROVIDER_NAME": "test-provider", 18 | "AWS_REGION": "us-east-1" 19 | } 20 | custom_resource_event[PHYSICAL_RESOURCE_ID] = "fake_physical_resource_id" 21 | 22 | yield custom_resource_event 23 | -------------------------------------------------------------------------------- /source/ui-chat/src/pages/chat/components/messages/types.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ChatBubbleMessage } from '../../types'; 5 | import { FeedbackFormData } from '../input/FeedbackForm'; 6 | import { ToolUsageInfo } from '../../../../models'; 7 | 8 | interface BaseMessageProps { 9 | message: ChatBubbleMessage; 10 | author: { 11 | type: 'user' | 'assistant'; 12 | name: string; 13 | avatar?: string; 14 | description?: string; 15 | }; 16 | 'data-testid'?: string; 17 | } 18 | 19 | export interface IncomingMessageProps extends BaseMessageProps { 20 | showActions: boolean; 21 | conversationId: string; 22 | toolUsage?: ToolUsageInfo[]; 23 | } 24 | 25 | export interface OutgoingMessageProps extends BaseMessageProps { 26 | previewHeight?: number; 27 | conversationId?: string; 28 | hasFileError?: boolean; 29 | } 30 | -------------------------------------------------------------------------------- /source/ui-deployment/src/utils/linkUtils.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | // function to create a direct link to the Kendra console given a Kendra index id 5 | export const createKendraConsoleLink = (region, kendraIndexId) => { 6 | return `https://console.aws.amazon.com/kendra/home?region=${region}#/indexes/${kendraIndexId}/details`; 7 | }; 8 | 9 | // Note: there currently does not exist a direct link given a knowledge base ID 10 | // the console link uses the KB name in the URL, which we do not have access to at this point 11 | export const createBedrockKnowledgeBaseConsoleLink = (region, bedrockKnowledgeBaseId) => { 12 | return `https://console.aws.amazon.com/bedrock/home?region=${region}#/knowledge-bases`; 13 | }; 14 | 15 | export const createVpcLink = (region, vpcId) => { 16 | return `https://console.aws.amazon.com/vpcconsole/home?region=${region}#VpcDetails:VpcId=${vpcId}`; 17 | }; -------------------------------------------------------------------------------- /source/infrastructure/lib/api/model-schema/multimodal/files-get-response-body.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonSchema, JsonSchemaType, JsonSchemaVersion } from 'aws-cdk-lib/aws-apigateway'; 5 | import { UPLOADED_FILE_NAME_MIN_LENGTH, MULTIMODAL_FILENAME_PATTERN } from '../../../utils/constants'; 6 | 7 | /** 8 | * JSON Schema for file retrieval response from the GET /files REST API. 9 | */ 10 | export const filesGetResponseSchema: JsonSchema = { 11 | schema: JsonSchemaVersion.DRAFT4, 12 | type: JsonSchemaType.OBJECT, 13 | required: ['downloadUrl'], 14 | properties: { 15 | downloadUrl: { 16 | type: JsonSchemaType.STRING, 17 | description: 'Presigned URL for file download from S3', 18 | format: 'uri', 19 | minLength: UPLOADED_FILE_NAME_MIN_LENGTH 20 | } 21 | }, 22 | additionalProperties: false 23 | }; 24 | -------------------------------------------------------------------------------- /source/lambda/websocket-connectors/disconnect-handler.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { injectLambdaContext } from '@aws-lambda-powertools/logger/middleware'; 5 | import { logMetrics } from '@aws-lambda-powertools/metrics/middleware'; 6 | import { captureLambdaHandler } from '@aws-lambda-powertools/tracer/middleware'; 7 | import middy from '@middy/core'; 8 | import { APIGatewayProxyEvent } from 'aws-lambda'; 9 | import { logger, metrics, tracer } from './power-tools-init'; 10 | 11 | // prettier-ignore 12 | export const lambdaHandler = async (event: APIGatewayProxyEvent) => { //NOSONAR - declaration as per lambda signature 13 | return { 14 | statusCode: 200, 15 | body: 'Disconnected' 16 | }; 17 | }; 18 | 19 | export const handler = middy(lambdaHandler).use([ 20 | captureLambdaHandler(tracer), 21 | injectLambdaContext(logger), 22 | logMetrics(metrics) 23 | ]); 24 | -------------------------------------------------------------------------------- /source/lambda/feedback-management/model/data-model.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | import { FeedbackType } from '../utils/constants'; 4 | 5 | export interface FeedbackRequest { 6 | conversationId: string; 7 | messageId: string; 8 | feedback: FeedbackType; 9 | rephrasedQuery?: string; 10 | sourceDocuments?: string[]; 11 | feedbackReason?: string[]; 12 | comment?: string; 13 | userId?: string; 14 | useCaseRecordKey: string; 15 | } 16 | 17 | export interface EnrichedFeedback extends FeedbackRequest { 18 | useCaseId: string; 19 | timestamp: string; 20 | userInput: string; 21 | llmResponse: string; 22 | modelId?: string; 23 | modelProvider?: string; 24 | knowledgeBaseId?: string; 25 | knowledgeBaseProvider?: string; 26 | ragEnabled?: boolean; 27 | agentId?: string; 28 | feedbackId: string; 29 | custom?: Record; 30 | } 31 | 32 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/SagemakerPayloadSchema/__tests__/InputSchema.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import InputSchema from '../InputSchema'; 5 | import { cloudscapeRender, mockFormComponentCallbacks } from '@/utils'; 6 | import { cleanup, screen, waitFor } from '@testing-library/react'; 7 | 8 | // Mock the loadAce function 9 | vi.mock('../../utils', () => ({ 10 | loadAce: vi.fn().mockResolvedValue({}) 11 | })); 12 | 13 | describe('InputSchema', () => { 14 | afterEach(() => { 15 | jest.clearAllMocks(); 16 | cleanup(); 17 | }); 18 | 19 | test('renders', async () => { 20 | const mockModelData = { sagemakerInputSchema: '' }; 21 | cloudscapeRender(); 22 | expect(screen.getByTestId('sagemaker-input-payload-schema-field')).toBeDefined(); 23 | }); 24 | }); 25 | -------------------------------------------------------------------------------- /source/ui-deployment/src/index.css: -------------------------------------------------------------------------------- 1 | /* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | * SPDX-License-Identifier: Apache-2.0 */ 3 | 4 | body { 5 | margin: 0; 6 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 7 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 8 | sans-serif; 9 | -webkit-font-smoothing: antialiased; 10 | -moz-osx-font-smoothing: grayscale; 11 | } 12 | 13 | code { 14 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 15 | monospace; 16 | } 17 | 18 | html { 19 | font-family: sans-serif; 20 | font-size: 14px; 21 | } 22 | 23 | table { 24 | border: 1px solid lightgray; 25 | } 26 | 27 | tbody { 28 | border-bottom: 1px solid lightgray; 29 | } 30 | 31 | th { 32 | border-bottom: 1px solid lightgray; 33 | border-right: 1px solid lightgray; 34 | padding: 2px 4px; 35 | } 36 | 37 | tfoot { 38 | color: gray; 39 | } 40 | 41 | tfoot th { 42 | font-weight: normal; 43 | } -------------------------------------------------------------------------------- /source/ui-deployment/src/components/common/index.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | export { useNotifications } from '../../hooks/useNotifications'; 5 | export type { NotificationItem, NotificationOptions } from '../../hooks/useNotifications'; 6 | 7 | export { Notifications } from './Notifications'; 8 | export type { NotificationsProps } from './Notifications'; 9 | 10 | export { 11 | createApiErrorNotification, 12 | createValidationErrorNotification, 13 | createSuccessWithActionNotification, 14 | createProgressNotification, 15 | createNetworkErrorNotification, 16 | createPermissionErrorNotification, 17 | createTimeoutNotification, 18 | createBulkOperationNotification 19 | } from '../../utils/notificationHelpers'; 20 | 21 | import { useNotifications } from '../../hooks/useNotifications'; 22 | import { Notifications } from './Notifications'; 23 | 24 | export default { 25 | useNotifications, 26 | Notifications 27 | }; 28 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/interfaces/BaseFormComponent.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { SelectProps } from '@cloudscape-design/components'; 5 | import React from 'react'; 6 | 7 | /** 8 | * Base interface that specifies the props for all form components for the pages of the wizard 9 | */ 10 | export interface BaseFormComponentProps { 11 | onChangeFn: (detail: any) => void; 12 | setNumFieldsInError: React.Dispatch; 13 | setHelpPanelContent?: (content: any) => void; 14 | handleWizardNextStepLoading?: (isLoading: boolean) => void; 15 | } 16 | 17 | export interface BaseToggleComponentProps { 18 | setHelpPanelContent?: (content: any) => void; 19 | onChangeFn: (detail: any) => void; 20 | disabled?: boolean; 21 | handleWizardNextStepLoading?: (isLoading: boolean) => void; 22 | } 23 | 24 | export type ModelProviderOption = SelectProps.Option; 25 | export type ModelNameOption = SelectProps.Option; 26 | -------------------------------------------------------------------------------- /source/scripts/v2_migration/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "gaab-v2-migration" 3 | version = "4.0.2" 4 | authors = [ "Amazon Web Services" ] 5 | description = "Migration script to convert v1.X use cases to v2.X" 6 | packages = [ 7 | { include = "*.py" }, 8 | { include = "./**/*.py" }, 9 | { include = "./**/**/*.py" } 10 | ] 11 | classifiers = [ 12 | "Programming Language :: Python :: 3", 13 | "License :: Apache-2.0", 14 | ] 15 | license = "Apache-2.0" 16 | 17 | [tool.poetry.dependencies] 18 | python = "^3.13" 19 | boto3 = "1.37.22" 20 | 21 | [tool.poetry.group.test.dependencies] 22 | moto = "5.0.28" 23 | pytest = "8.3.4" 24 | pytest-cov = "6.0.0" 25 | pytest-env = "1.1.5" 26 | requests="2.32.4" 27 | urllib3="2.6.1" 28 | 29 | [tool.black] 30 | line-length = 120 31 | 32 | [tool.isort] 33 | multi_line_output = 3 34 | include_trailing_comma = true 35 | force_grid_wrap = 0 36 | line_length = 120 37 | profile = "black" 38 | 39 | [build-system] 40 | requires = [ "poetry-core>=1.0.8" ] 41 | build-backend = "poetry.core.masonry.api" -------------------------------------------------------------------------------- /source/ui-chat/src/App.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '@aws-amplify/ui-react/styles.css'; 5 | import { AppRoutes } from './AppRoutes.tsx'; 6 | import { useSelector } from 'react-redux'; 7 | 8 | import { useEffect } from 'react'; 9 | import { RootState } from './store/store.ts'; 10 | import { SOLUTION_NAME } from './utils/constants.ts'; 11 | 12 | const AppComponent = () => { 13 | // Access the config from Redux store 14 | const config = useSelector((state: RootState) => state.config); 15 | 16 | useEffect(() => { 17 | if (config.runtimeConfig?.UseCaseConfig?.UseCaseName) { 18 | document.title = config.runtimeConfig.UseCaseConfig.UseCaseName; 19 | } else { 20 | document.title = SOLUTION_NAME; 21 | } 22 | }, [config.runtimeConfig?.UseCaseConfig?.UseCaseName]); // Re-run when use case name changes 23 | 24 | return ; 25 | }; 26 | 27 | export const App = AppComponent; 28 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/common/__tests__/GuardrailVersionInput.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { cloudscapeRender, mockFormComponentCallbacks } from '@/utils'; 5 | import { screen } from '@testing-library/react'; 6 | import GuardrailVersionInput from '../GuardrailVersionInput'; 7 | 8 | describe('GuardrailVersionInput', () => { 9 | afterEach(() => { 10 | jest.clearAllMocks(); 11 | }); 12 | 13 | test('renders', () => { 14 | const mockModelData = { 15 | guardrailVersion: '12' 16 | }; 17 | const { cloudscapeWrapper } = cloudscapeRender( 18 | 19 | ); 20 | expect(screen.getByTestId('guardrail-version-input')).toBeDefined(); 21 | expect(cloudscapeWrapper.findInput('[data-testid="guardrail-version-input"]')?.getInputValue()).toEqual('12'); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/__tests__/snapshot_tests/useCaseDetails/UseCaseView.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import '@testing-library/jest-dom'; 5 | import { Dispatch } from 'react'; 6 | import { ActionType } from '../../../../hooks/useCreateReducer'; 7 | import { HomeInitialState } from '../../../../contexts/home.state'; 8 | import UseCaseView from '../../../useCaseDetails/UseCaseView'; 9 | 10 | // eslint-disable-next-line jest/no-mocks-import 11 | import mockContext from '../../__mocks__/mock-context.json'; 12 | import { snapshotWithProvider } from '@/utils'; 13 | 14 | vi.mock('@cloudscape-design/components'); 15 | 16 | const contextValue = { 17 | dispatch: vi.fn() as Dispatch>, 18 | state: mockContext 19 | }; 20 | 21 | test('Snapshot test', async () => { 22 | const tree = snapshotWithProvider(, '/deployment-details', contextValue).toJSON(); 23 | expect(tree).toMatchSnapshot(); 24 | }); 25 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/providers/__tests__/Sagemaker.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { mockFormComponentCallbacks, mockReactMarkdown, renderWithProvider } from '@/utils'; 5 | import { screen } from '@testing-library/react'; 6 | 7 | let SagemakerModel: any; 8 | 9 | describe('Sagemaker', () => { 10 | beforeEach(async () => { 11 | mockReactMarkdown(); 12 | SagemakerModel = (await import('../Sagemaker')).default; 13 | }); 14 | it('renders', () => { 15 | const mockModelData = { sagemakerInputSchema: '', modelParameters: [], temperature: 0.1 }; 16 | renderWithProvider(, { 17 | route: '/sm' 18 | }); 19 | expect(screen.getByTestId('model-inference-endpoint-name-field')).toBeDefined(); 20 | expect(screen.getByTestId('sagemaker-payload-schema-components')).toBeDefined(); 21 | }); 22 | }); 23 | -------------------------------------------------------------------------------- /source/lambda/use-case-management/model/commands/workflow-command.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ListUseCasesAdapter, UseCaseRecord } from '../list-use-cases'; 5 | import { UseCaseTypes } from '../../utils/constants'; 6 | import { tracer } from '../../power-tools-init'; 7 | import { ListUseCasesCommand } from './use-case-command'; 8 | 9 | /** 10 | * Command to list Workflow use cases 11 | */ 12 | export class ListWorkflowCommand extends ListUseCasesCommand { 13 | @tracer.captureMethod({ captureResponse: true, subSegmentName: '###listWorkflowCommand' }) 14 | public async execute(operation: ListUseCasesAdapter): Promise { 15 | return await super.execute(operation); 16 | } 17 | 18 | /** 19 | * Filters use cases to only include Workflow type 20 | */ 21 | protected filterUseCasesByType(useCaseRecords: UseCaseRecord[]): UseCaseRecord[] { 22 | return useCaseRecords.filter((record) => record.UseCaseType === UseCaseTypes.WORKFLOW); 23 | } 24 | } -------------------------------------------------------------------------------- /source/ui-chat/src/contexts/ToolsContext.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { createContext, ReactNode, useState } from 'react'; 5 | 6 | export type ToolsContextType = { 7 | helpTopic: string | null; 8 | toolsOpen: boolean; 9 | setToolsOpen: (open: boolean) => void; 10 | }; 11 | 12 | const DEFAULT_STATE = { 13 | helpTopic: null, 14 | toolsOpen: false, 15 | setToolsOpen: (_open: boolean) => {} 16 | }; 17 | export const ToolsContext = createContext<{ 18 | toolsState: ToolsContextType; 19 | setToolsState: (value: ((prevState: ToolsContextType) => ToolsContextType) | ToolsContextType) => void; 20 | }>(null as any); 21 | export const ToolsContextProvider = (props: { children: ReactNode }) => { 22 | const [toolsState, setToolsState] = useState(DEFAULT_STATE); 23 | 24 | return ( 25 | <> 26 | {props.children} 27 | 28 | ); 29 | }; 30 | -------------------------------------------------------------------------------- /docs/sagemaker-ai-payload-examples/deepseek-r1-distill-llama-3B.md: -------------------------------------------------------------------------------- 1 | # DeepSeek R1 Distill Llama 8B 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 23 | 30 | 31 | 32 |
Model Id Model Input Schema Model Output JSONPath
deepseek-r1-distill-llama-3B 12 | 13 | ```json 14 | { 15 | "inputs": "<>", 16 | "parameters": { 17 | "temperature": "<>" 18 | } 19 | } 20 | ``` 21 | 22 | 24 | 25 | ```json 26 | $.generated_text 27 | ``` 28 | 29 |
33 | 34 | ## Model Payload 35 | 36 | The input schemas provided here are inferred from model payloads to replace the actual values supplied at run time. For example, sample model payload for the input schema provided above is: 37 | 38 | ```json 39 | { 40 | "inputs": "Write a haiku on the weather in London.", 41 | "parameters": { 42 | "temperature": 0.1 43 | } 44 | } 45 | ``` 46 | 47 | Please refer to model documentation and test inferences available in SageMaker AI to see the most up-to-date supported parameters. 48 | -------------------------------------------------------------------------------- /source/lambda/files-management/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | testMatch: ['**/*.test.ts'], 12 | modulePathIgnorePatterns: ['/dist/'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node', 18 | // Limit concurrency to prevent worker exhaustion 19 | maxWorkers: 2, 20 | // Set reasonable timeouts 21 | testTimeout: 30000, 22 | // Force exit to prevent hanging processes 23 | forceExit: true, 24 | // Detect open handles to identify resource leaks 25 | detectOpenHandles: true 26 | }; 27 | -------------------------------------------------------------------------------- /source/lambda/use-case-management/jest.config.js: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | module.exports = { 5 | modulePaths: [ 6 | '/../layers/', 7 | '/../layers/aws-sdk-lib/node_modules/', 8 | '/../layers/aws-node-user-agent-config/', 9 | '/../layers/aws-node-user-agent-config/node_modules/' 10 | ], 11 | testMatch: ['**/*.test.ts'], 12 | modulePathIgnorePatterns: ['/dist/'], 13 | collectCoverage: true, 14 | collectCoverageFrom: ['**/*.ts', '!**/test/*.ts', '!dist/'], 15 | coverageReporters: ['text', ['lcov', { projectRoot: '../../../' }]], 16 | preset: 'ts-jest', 17 | testEnvironment: 'node', 18 | // Limit concurrency to prevent worker exhaustion 19 | maxWorkers: 2, 20 | // Set reasonable timeouts 21 | testTimeout: 30000, 22 | // Force exit to prevent hanging processes 23 | forceExit: true, 24 | // Detect open handles to identify resource leaks 25 | detectOpenHandles: true 26 | }; 27 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-agent/test/conftest.py: -------------------------------------------------------------------------------- 1 | """ 2 | Pytest configuration for test suite 3 | """ 4 | 5 | import os 6 | import pytest 7 | from unittest.mock import patch 8 | 9 | 10 | def mock_requires_access_token(*args, **kwargs): 11 | """Mock decorator that just returns the function unchanged""" 12 | 13 | def decorator(func): 14 | return func 15 | 16 | return decorator 17 | 18 | 19 | # Apply the patch at module level before any imports 20 | patcher = patch("bedrock_agentcore.identity.auth.requires_access_token", mock_requires_access_token) 21 | patcher.start() 22 | 23 | 24 | def pytest_sessionfinish(session, exitstatus): 25 | """Called after whole test run finished""" 26 | patcher.stop() 27 | 28 | 29 | @pytest.fixture(autouse=True) 30 | def mock_environment(): 31 | """Mock environment variables for all tests""" 32 | with patch.dict( 33 | os.environ, 34 | { 35 | "AWS_REGION": "us-east-1", 36 | "AWS_SDK_USER_AGENT": '{"user_agent_extra": "test-agent"}', 37 | }, 38 | clear=False, 39 | ): 40 | yield 41 | -------------------------------------------------------------------------------- /deployment/ecr/gaab-strands-common/README.md: -------------------------------------------------------------------------------- 1 | # GAAB Strands Common Library 2 | 3 | Shared library for GAAB Strands agents providing common functionality for: 4 | - Runtime streaming 5 | - DynamoDB configuration management 6 | - Data models 7 | - Tool wrapping and event emission 8 | - Base agent patterns 9 | 10 | ## Installation 11 | 12 | ```bash 13 | uv sync 14 | ``` 15 | 16 | ## Usage 17 | 18 | ```python 19 | from gaab_strands_common.runtime_streaming import RuntimeStreaming 20 | from gaab_strands_common.ddb_helper import DynamoDBHelper 21 | from gaab_strands_common.models import AgentConfig 22 | from gaab_strands_common.tool_wrapper import wrap_tool_with_events 23 | from gaab_strands_common.base_agent import BaseAgent 24 | ``` 25 | 26 | ## Development 27 | 28 | Install dependencies: 29 | ```bash 30 | uv sync 31 | ``` 32 | 33 | Run tests: 34 | ```bash 35 | uv run pytest 36 | ``` 37 | 38 | Run tests with coverage: 39 | ```bash 40 | uv run pytest --cov=src/gaab_strands_common --cov-report=term-missing 41 | ``` 42 | 43 | Format code: 44 | ```bash 45 | uv run black src/ test/ 46 | uv run isort src/ test/ 47 | ``` 48 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/KnowledgeBase/providers/Bedrock/__tests__/Bedrock.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { BedrockKnowledgeBase } from '../Bedrock'; 5 | import { mockFormComponentCallbacks, renderWithProvider } from '@/utils'; 6 | import { screen } from '@testing-library/react'; 7 | 8 | describe('Bedrock', () => { 9 | afterEach(() => { 10 | vi.clearAllMocks(); 11 | }); 12 | 13 | test('renders on state to show kendra config', () => { 14 | const mockKnowledgeBaseData = { 15 | bedrockKnowledgeBaseId: '' 16 | }; 17 | renderWithProvider( 18 | , 19 | { 20 | route: '/mockPage' 21 | } 22 | ); 23 | expect(screen.getByTestId('bedrock-knowledgebase-container')).toBeDefined(); 24 | expect(screen.getByTestId('input-bedrock-knowledge-base-id')).toBeDefined(); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /source/lambda/use-case-management/model/commands/agent-builder-command.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ListUseCasesAdapter, UseCaseRecord } from '../list-use-cases'; 5 | import { UseCaseTypes } from '../../utils/constants'; 6 | import { tracer } from '../../power-tools-init'; 7 | import { ListUseCasesCommand } from './use-case-command'; 8 | 9 | /** 10 | * Command to list Agent Builder use cases 11 | */ 12 | export class ListAgentBuilderCommand extends ListUseCasesCommand { 13 | @tracer.captureMethod({ captureResponse: true, subSegmentName: '###listAgentBuilderCommand' }) 14 | public async execute(operation: ListUseCasesAdapter): Promise { 15 | return await super.execute(operation); 16 | } 17 | 18 | /** 19 | * Filters use cases to only include Agent Builder type 20 | */ 21 | protected filterUseCasesByType(useCaseRecords: UseCaseRecord[]): UseCaseRecord[] { 22 | return useCaseRecords.filter((record) => record.UseCaseType === UseCaseTypes.AGENT_BUILDER); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /source/ui-chat/src/models/message.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { ApiFileReference } from '../types/file-upload'; 5 | 6 | export type BaseMessage = { 7 | conversationId?: string; 8 | authToken?: string; 9 | files?: ApiFileReference[]; 10 | }; 11 | 12 | export type TextMessage = BaseMessage & { 13 | action: 'sendMessage'; 14 | question: string; 15 | promptTemplate?: string; 16 | authToken?: string; 17 | }; 18 | 19 | export type AgentMessage = BaseMessage & { 20 | action: 'invokeAgent'; 21 | inputText: string; 22 | }; 23 | 24 | export type AgentBuilderMessage = BaseMessage & { 25 | action: 'invokeAgentCore'; 26 | inputText: string; 27 | promptTemplate?: string; 28 | messageId?: string; 29 | }; 30 | 31 | export type WorkflowMessage = BaseMessage & { 32 | action: 'invokeWorkflow'; 33 | inputText: string; 34 | promptTemplate?: string; 35 | messageId?: string; 36 | }; 37 | 38 | export type ChatMessage = TextMessage | AgentMessage | AgentBuilderMessage | WorkflowMessage; 39 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Model/common/__tests__/ModelArnInput.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { cloudscapeRender, mockFormComponentCallbacks } from '@/utils'; 5 | import { screen } from '@testing-library/react'; 6 | import ModelArnInput from '../ModelArnInput'; 7 | 8 | describe('ModelArnInput', () => { 9 | afterEach(() => { 10 | jest.clearAllMocks(); 11 | }); 12 | 13 | test('renders', () => { 14 | const mockModelData = { 15 | modelArn: 'arn:aws:bedrock:us-west-2::foundation-model/aaaaaa.aaaaa:1' 16 | }; 17 | const { cloudscapeWrapper } = cloudscapeRender( 18 | 19 | ); 20 | expect(screen.getByTestId('model-arn-input')).toBeDefined(); 21 | expect(cloudscapeWrapper.findInput('[data-testid="model-arn-input"]')?.getInputValue()).toEqual( 22 | 'arn:aws:bedrock:us-west-2::foundation-model/aaaaaa.aaaaa:1' 23 | ); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /docs/sagemaker-ai-payload-examples/alexaTM-20B.md: -------------------------------------------------------------------------------- 1 | # AlexaTM 20B 2 | 3 | Sample values for the model are: 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 24 | 31 | 32 | 33 |
Model Id Model Input Schema Model Output JSONPath
pytorch-textgeneration1-alexa20b 14 | 15 | ```json 16 | { 17 | "text_inputs": "<>", 18 | "num_beams": "<>", 19 | "no_repeat_ngram_size": "<>" 20 | } 21 | ``` 22 | 23 | 25 | 26 | ```json 27 | $.generated_texts[0] 28 | ``` 29 | 30 |
34 | 35 | 36 | ## Model Payload 37 | 38 | The input schemas provided here are inferred from model payloads to replace the actual values supplied at run time. For example, sample model payload for the input schema provided above is: 39 | 40 | ```json 41 | { 42 | "text_inputs": "[CLM] My name is Lewis and I like to", 43 | "num_beams": 5, 44 | "no_repeat_ngram_size": 2 45 | } 46 | ``` 47 | 48 | Please refer to model documentation and test inferences available in SageMaker AI to see the most up-to-date supported parameters. 49 | -------------------------------------------------------------------------------- /source/ui-deployment/src/contexts/home.state.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { DEPLOYMENT_ACTIONS, USECASE_TYPES } from '../utils/constants'; 5 | 6 | export interface HomeInitialState { 7 | authorized: boolean; 8 | selectedDeployment: any; 9 | deploymentsData: any; 10 | deploymentAction: string; 11 | runtimeConfig?: any; 12 | reloadData?: boolean; 13 | numUseCases: number; 14 | currentPageIndex: number; 15 | searchFilter: string; 16 | submittedSearchFilter: string; 17 | } 18 | 19 | export const initialState: HomeInitialState = { 20 | authorized: true, 21 | selectedDeployment: {}, 22 | deploymentsData: [], 23 | deploymentAction: DEPLOYMENT_ACTIONS.CREATE, 24 | reloadData: false, 25 | numUseCases: 0, 26 | currentPageIndex: 1, 27 | searchFilter: '', 28 | submittedSearchFilter: '' 29 | }; 30 | 31 | export const insertRuntimeConfig = (state: Partial, runtimeConfig: any) => { 32 | return { 33 | ...state, 34 | runtimeConfig 35 | }; 36 | }; 37 | -------------------------------------------------------------------------------- /source/infrastructure/lib/storage/deployment-platform-model-info-storage.ts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 | // SPDX-License-Identifier: Apache-2.0 4 | 5 | import * as dynamodb from 'aws-cdk-lib/aws-dynamodb'; 6 | import * as iam from 'aws-cdk-lib/aws-iam'; 7 | 8 | import { Construct } from 'constructs'; 9 | import { ModelInfoStorage, ModelInfoStorageProps } from './model-info-storage'; 10 | 11 | /** 12 | * This Construct creates and populates the DynamoDB table with model info/defaults if needed 13 | */ 14 | export class DeploymentPlatformModelInfoStorage extends ModelInfoStorage { 15 | public readonly newModelInfoTable: dynamodb.Table; 16 | 17 | constructor(scope: Construct, id: string, props: ModelInfoStorageProps) { 18 | super(scope, id, props); 19 | 20 | this.newModelInfoTable = this.createModelInfoTable(props); 21 | 22 | const crLambdaRole = iam.Role.fromRoleArn(this, 'CopyModelInfoCustomResourceRole', props.customResourceRoleArn); 23 | 24 | this.createCopyModelInfoCustomResource(props, this.newModelInfoTable, crLambdaRole); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/commons/__tests__/json-code-view.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { JsonCodeView } from '../json-code-view'; 5 | import { cloudscapeRender } from '@/utils'; 6 | import { screen } from '@testing-library/react'; 7 | 8 | describe('JsonCodeView', () => { 9 | it('should render the code content', () => { 10 | const content = '{"key": "value"}'; 11 | const { cloudscapeWrapper } = cloudscapeRender( 12 | 13 | ); 14 | expect(screen.getByTestId('mock-json-viewer')).toBeInTheDocument(); 15 | 16 | expect(cloudscapeWrapper.getElement()).toHaveTextContent(content); 17 | }); 18 | 19 | it('should handle empty content', () => { 20 | const content = ''; 21 | const { cloudscapeWrapper } = cloudscapeRender( 22 | 23 | ); 24 | expect(cloudscapeWrapper.getElement()).toHaveTextContent(''); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/Agent/__tests__/Agent.test.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { mockFormComponentCallbacks, mockModelNamesQuery, renderWithProvider } from '@/utils'; 5 | import { screen } from '@testing-library/react'; 6 | import Agent from '../Agent'; 7 | import { sampleDeployUseCaseFormData } from '@/components/__tests__/__mocks__/deployment-steps-form-data'; 8 | 9 | describe('Agent', () => { 10 | describe('test that all components are rendered in a success state', () => { 11 | beforeEach(() => { 12 | renderWithProvider(, { 13 | route: '/wizardView' 14 | }); 15 | }); 16 | 17 | afterEach(() => { 18 | vi.clearAllMocks(); 19 | }); 20 | 21 | test('renders', async () => { 22 | expect(screen.getByTestId('agent-step-container')).toBeDefined(); 23 | expect(screen.getByTestId('agent-step-secure-agent-alert')).toBeDefined(); 24 | }); 25 | }); 26 | }); 27 | -------------------------------------------------------------------------------- /source/infrastructure/test/modifiedCdk.ts: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | const cdk = jest.requireActual('aws-cdk-lib'); 5 | 6 | export const ModifiedApp = new Proxy(cdk.App, { 7 | construct(target, args, newTarget) { 8 | // Destructure args with default values 9 | const [props] = args; 10 | 11 | // Disable asset bundling 12 | return Reflect.construct( 13 | target, 14 | [{ ...props, context: { ...props?.context, 'aws:cdk:bundling-stacks': [] } }], 15 | newTarget 16 | ); 17 | } 18 | }); 19 | 20 | export const ModifiedStack = new Proxy(cdk.Stack, { 21 | construct(target, args, newTarget) { 22 | // Destructure args with default values 23 | const [scope, id, props] = args; 24 | 25 | // If no scope provided, create a new ModifiedApp. 26 | // This ensures that all Stacks are created with an App (and therefore use the Disabled Asset bundling context defined above) 27 | return Reflect.construct(target, [scope || new ModifiedApp(), id, props], newTarget); 28 | } 29 | }); 30 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/useCaseDetails/mcps/MCPsList.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { Box, SpaceBetween } from '@cloudscape-design/components'; 5 | import { MCPItem } from './MCPItem'; 6 | 7 | export interface MCPsListProps { 8 | selectedDeployment: any; 9 | } 10 | 11 | export function MCPsList({ selectedDeployment }: MCPsListProps) { 12 | const mcpServers = selectedDeployment?.AgentBuilderParams?.MCPServers || []; 13 | 14 | if (mcpServers.length === 0) { 15 | return ( 16 | 17 | 18 | No MCP servers configured for this agent. 19 | 20 | 21 | ); 22 | } 23 | 24 | return ( 25 | 26 | {mcpServers.map((mcpServer: any, index: number) => ( 27 | 28 | ))} 29 | 30 | ); 31 | } 32 | -------------------------------------------------------------------------------- /source/ui-deployment/src/components/wizard/UseCase/UseCaseTypeSelection.tsx: -------------------------------------------------------------------------------- 1 | // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 2 | // SPDX-License-Identifier: Apache-2.0 3 | 4 | import { FormField, Select, SelectProps } from '@cloudscape-design/components'; 5 | 6 | interface UseCaseTypeSelectionProps { 7 | useCaseTypeOptions: SelectProps.Option[]; 8 | selectedOption: SelectProps.Option; 9 | onChangeFn: (e: any) => void; 10 | } 11 | 12 | export const UseCaseTypeSelection = (props: UseCaseTypeSelectionProps) => { 13 | const onUseCaseChange = (detail: SelectProps.ChangeDetail) => { 14 | props.onChangeFn({ 'useCase': detail.selectedOption }); 15 | }; 16 | 17 | return ( 18 | Use case type} data-testid="use-case-type-selection"> 19 |