repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ApplicationAssetBundler.constructor
private constructor() {}
/** * Because the the class is a factory class, the constructor private. Call {@link ApplicationAssetBundler.assetBundlerFactory()} instead */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/asset-options-factory.ts#L73-L73
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ApplicationAssetBundler.assetBundlerFactory
public static assetBundlerFactory(): BundlerAssetOptionsFactory { if (ApplicationAssetBundler._assetFactory === undefined) { this._assetFactory = new BundlerAssetOptionsFactory(); } return this._assetFactory; }
/** * A static method to return the Singleton instance of {@link AssetOptionsFactory} class */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/asset-options-factory.ts#L78-L84
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
CdkJsonContextAssetOptions.options
public options(construct: IConstruct, entry: string, assetHash?: string): s3_assets.AssetOptions { entry = path.resolve(entry); return { ...(assetHash && { assetHash: assetHash, assetHashType: cdk.AssetHashType.CUSTOM }), bundling: { image: COMMERCIAL_REGION_LAMBD...
/** * An implementation of AssetOptions method to build artifacts. * * @param assetHash * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/cdk-json.ts#L34-L48
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
CdkJsonLocalBuildTemplate.readContextProperty
protected readContextProperty(construct: IConstruct, buildStage: string): string[] { const buildTemplate = construct.node.tryGetContext(this.buildTemplateKey); let templateSteps: string[] = []; if ( !Object.hasOwn(buildTemplate, LOCAL_BUILD_VAR) && Object.hasOwn(buildTemp...
/** * A utility method to read build steps from cdk json * * @param construct * @param key - key of the template definition in the context definition * @param buildStage - pre, post, build or unit-test stage within the template definition * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/cdk-json.ts#L139-L154
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
CdkJsonDockerBuildTemplate.readContextProperty
protected readContextProperty(construct: IConstruct, buildStage: string): string[] { const buildTemplate = construct.node.tryGetContext(this.buildTemplateKey); let templateSteps: string[] = []; if ( !Object.hasOwn(buildTemplate, DOCKER_BUILD_VAR) && Object.hasOwn(buildTem...
/** * A utility method to read build steps from cdk json * * @param construct * @param key - key of the template definition in the context definition * @param buildStage - pre, post, build or unit-test stage within the template definition * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/cdk-json.ts#L169-L185
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
CdkJsonDockerBuildTemplate.bundle
public bundle(construct: IConstruct, moduleName: string, outputDir: string): string[] { return ['bash', '-c', super.bundle(construct, moduleName, outputDir).join(' && ')]; }
/** * bundler implementation for docker builds * * @param moduleName * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/cdk-json.ts#L194-L196
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptLayerAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new JavascriptLayerDockerBuild(); this.localBuild = new JavascriptLayerLocalBuild(); }
/** * Method to initialize build templates for TS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript-layer.ts#L14-L17
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptLayerDockerBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { return [ `mkdir -p ${outputDir}/nodejs/node_modules`, `cp -au /asset-input/node_modules/* ${outputDir}/nodejs/node_modules/` ]; }
/** * Copy assets to output directory post build * * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript-layer.ts#L32-L37
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptLayerLocalBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { return [ `mkdir -p ${outputDir}/nodejs/node_modules`, `cp -R ${moduleName}/node_modules/* ${outputDir}/nodejs/node_modules/` // for local build there is no post build steps. ]; }
/** * Copy assets to output directory post build * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript-layer.ts#L51-L56
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new JavascriptDockerBuild(); this.localBuild = new JavascriptLocalBuild(); }
/** * Method to initialize the build templates for JS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L36-L39
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptDockerBuild.preBuild
protected preBuild(moduleName: string, outputDir: string): string[] { return [ `echo \"local bundling failed for ${moduleName} and hence building with Docker image\"`, 'rm -fr /asset-input/node_modules' ]; }
/** * pre-build steps for Nodejs docker build */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L64-L69
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptDockerBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['npm install', 'rm -fr ./node_modules', 'npm ci --omit=dev']; }
/** * Build steps for docker build * @param outputDir */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L75-L77
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptDockerBuild.cleanup
protected cleanup(moduleName: string, outputDir: string): string[] { return [`rm -fr ${outputDir}/.coverage`]; }
/** * post-build steps for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L89-L91
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptDockerBuild.unitTest
protected unitTest(moduleName: string, outputDir: string): string[] { return ['echo "Executing unit tests"', 'npm install', 'npm run test']; }
/** * Unit test execution * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L99-L101
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptLocalBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['npm ci --omit=dev']; }
/** * build steps for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L114-L116
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptLocalBuild.preBuild
protected preBuild(moduleName: string, outputDir: string): string[] { return [`echo local bundling ${moduleName}`, `cd ${moduleName}`, 'rm -fr node_modules']; }
/** * pre-build steps for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L124-L126
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
JavascriptLocalBuild.unitTest
protected unitTest(moduleName: string, outputDir: string): string[] { return ['echo "Executing unit tests"', `cd ${moduleName}`, 'npm install', 'npm run test']; }
/** * unit test execution for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/javascript.ts#L148-L150
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LangChainLayerAssetOptions.options
public options( construct: IConstruct, entry: string, packagingOptions?: AdditionalInstallArguments, assetHash?: string ): s3_assets.AssetOptions { const pipOptions = packagingOptions as PipInstallArguments; // if pipOptions is not provided use default values for plat...
/** * An implementation of AssetOptions method to build artifacts. * * @param assetHash * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/langchain-layer.ts#L37-L49
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LangChainLayerDockerBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { const commandList: string[] = []; if (process.env.SKIP_PRE_BUILD?.toLowerCase() === 'true') { commandList.push('python3 -m pip install poetry --upgrade'); } commandList.push( `poetry run pip i...
/** * Install the dependencies in the output directory * * @param moduleName * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/langchain-layer.ts#L70-L80
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LangchainPythonVersionAssetOptions.options
public options( construct: IConstruct, entry: string, packagingOptions?: AdditionalInstallArguments, assetHash?: string ): s3_assets.AssetOptions { entry = path.resolve(entry); const pipOptions = packagingOptions as PipInstallArguments; this.dockerBuild = new ...
/** * An implementation of AssetOptions method to build artifacts. * * @param assetHash * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/langchain-py-version.ts#L27-L49
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLayerAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new PythonLayerDockerBuild(); this.localBuild = new PythonLayerLocalBuild(); }
/** * Method to initialize the build templates for JS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python-layer.ts#L14-L17
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLayerDockerBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['poetry build', 'poetry install --only main']; }
/** * For python build steps include copying the artifacts into the output directory and installing module * dependencies * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python-layer.ts#L31-L33
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLayerDockerBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { const commandList: string[] = []; if (process.env.SKIP_PRE_BUILD?.toLowerCase() === 'true') { commandList.push('python3 -m pip install poetry --upgrade'); } commandList.push(`poetry run pip install -t ${o...
/** * Install the dependencies in the output directory * * @param moduleName * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python-layer.ts#L42-L50
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new PythonDockerBuild(); this.localBuild = new PythonLocalBuild(); }
/** * Method to initialize the build templates for JS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L49-L52
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonAssetOptions.options
public options( construct: IConstruct, entry: string, packagingOptions?: AdditionalInstallArguments, assetHash?: string ): s3_assets.AssetOptions { entry = path.resolve(entry); return { ...(assetHash && { assetHash: assetHash, assetHashType: cdk.AssetHashT...
/** * An implementation of AssetOptions method to build artifacts. * * @param assetHash * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L60-L79
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonDockerBuild.preBuild
protected preBuild(moduleName: string, outputDir: string): string[] { return [ `echo "local bundling failed for ${moduleName} and hence building with Docker image"`, 'rm -fr .venv*', 'rm -fr dist', 'rm -fr .coverage', 'rm -fr coverage', 'py...
/** * For python pre-build steps include creating the output directory and deleting any virtual environments created * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L92-L101
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonDockerBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['python3 -m pip install poetry --upgrade', 'poetry build', 'poetry install --only main']; }
/** * For python build steps include copying the artifacts into the output directory and installing module * dependencies * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L110-L112
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonDockerBuild.unitTest
protected unitTest(moduleName: string, outputDir: string): string[] { return getUnitTestSteps(); }
/** * Unit test steps to * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L120-L122
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonDockerBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { const commandList: string[] = []; if (process.env.SKIP_PRE_BUILD?.toLowerCase() === 'true') { commandList.push('python3 -m pip install poetry --upgrade'); } commandList.push( ...[`cp -au /asset...
/** * Copying assets * * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L132-L141
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonDockerBuild.cleanup
protected cleanup(moduleName: string, outputDir: string): string[] { return [`find ${outputDir} | grep -E "(/__pycache__$|\.pyc$|\.pyo$|\.coverage$)" | xargs rm -rf`]; }
/** * As post-build cleanup, remove anything that is not required for packaging. * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L149-L151
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLocalBuild.preBuild
protected preBuild(moduleName: string, outputDir: string): string[] { return [ `echo local bundling ${moduleName}`, `cd ${moduleName}`, 'rm -fr .venv*', 'rm -fr dist', 'rm -fr coverage', 'rm -fr .coverage', 'python3 -m venv .ven...
/** * Pre-build steps for local build template * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L164-L176
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLocalBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['poetry build', 'poetry install --only main']; }
/** * For python build steps include copying the artifacts into the output directory and installing module * dependencies * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L185-L187
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLocalBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { return [ `cd ${moduleName}`, 'python3 -m pip install poetry --upgrade', `poetry run pip install -t ${outputDir} dist/*.whl` ]; }
/** * Execute statements post build * * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L197-L203
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLocalBuild.cleanup
protected cleanup(moduleName: string, outputDir: string): string[] { return [ 'deactivate', `find ${outputDir} | grep -E "(/__pycache__$|\.pyc$|\.pyo$|.coverage$|dist$|.venv*$)" | xargs rm -rf`, `rm -fr ${outputDir}/requirements.txt` ]; }
/** * Clean up files and directories post build * * @param moduleName * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L212-L218
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PythonLocalBuild.unitTest
protected unitTest(moduleName: string, outputDir: string): string[] { return [`cd ${moduleName}`].concat(getUnitTestSteps()); }
/** * Execute unit test * * @param moduleName * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/python.ts#L227-L229
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ReactjsAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new ReactjsDockerBuild(); this.localBuild = new ReactjsLocalBuild(); }
/** * Method to initialize build templates for TS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/reactjs.ts#L14-L17
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ReactjsDockerBuild.build
protected build(moduleName: string, outputDir: string): string[] { return [`mkdir -p build/`, 'npm install', 'npm run build']; }
/** * Build steps for docker build * @param outputDir */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/reactjs.ts#L28-L30
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ReactjsLocalBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['mkdir -p build', 'npm install', 'npm run build']; }
/** * build steps for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/reactjs.ts#L47-L49
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptLayerAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new TypescriptLayerDockerBuild(); this.localBuild = new TypescriptLayerLocalBuild(); }
/** * Method to initialize build templates for TS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typescript-layer.ts#L16-L19
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptLayerDockerBuild.build
protected build(moduleName: string, outputDir: string): string[] { return [ `mkdir -p ${outputDir}/nodejs`, 'npm install', 'npm run build', 'rm -fr ./node_modules', 'npm ci --omit=dev' ]; }
/** * Build steps for docker build * @param outputDir */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typescript-layer.ts#L30-L38
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptLayerDockerBuild.postBuild
protected postBuild(moduleName: string, outputDir: string, construct?: IConstruct | undefined): string[] { const moduleFolderName = path.basename(moduleName); return [ `mkdir -p ${outputDir}/nodejs`, `cp -au /asset-input/node_modules ${outputDir}/nodejs/`, `mkdir -p ...
/** * Copy assets to output directory post build * * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typescript-layer.ts#L48-L57
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptLayerLocalBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { const moduleFolderName = path.basename(moduleName); return [ `mkdir -p ${outputDir}/nodejs`, `cp -R ${moduleName}/node_modules ${outputDir}/nodejs/`, `mkdir -p ${outputDir}/nodejs/node_modules/${mo...
/** * Copy assets to output directory post build * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typescript-layer.ts#L71-L79
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptAssetOptions.initializeOptions
protected initializeOptions() { this.dockerBuild = new TypescriptDockerBuild(); this.localBuild = new TypescriptLocalBuild(); }
/** * Method to initialize build templates for TS builds */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typscript.ts#L15-L18
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptDockerBuild.build
protected build(moduleName: string, outputDir: string): string[] { return ['npm install', 'npm run build', 'rm -fr ./node_modules', 'npm ci --omit=dev']; }
/** * build steps for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typscript.ts#L29-L31
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptDockerBuild.postBuild
protected postBuild(moduleName: string, outputDir: string, construct?: IConstruct | undefined): string[] { return [ `mkdir -p ${outputDir}/`, `cp -au /asset-input/node_modules ${outputDir}/`, `cp -au /asset-input/dist/* ${outputDir}/` ]; }
/** * Copy assets to output directory post build * * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typscript.ts#L41-L47
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptLocalBuild.postBuild
protected postBuild(moduleName: string, outputDir: string): string[] { return [ `mkdir -p ${outputDir}`, `cp -R ${moduleName}/node_modules ${outputDir}/`, `cp -R ${moduleName}/dist/* ${outputDir}/` // for local build there is no post build steps. ]; }
/** * Copy assets to output directory post build * @param moduleName * @param outputDir * @param construct * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typscript.ts#L71-L77
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TypescriptLocalBuild.preBuild
protected preBuild(moduleName: string, outputDir: string): string[] { const commandList = super.preBuild(moduleName, outputDir); commandList.push('rm -fr dist'); return commandList; }
/** * pre-build steps for local bundling * * @param outputDir * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/framework/bundler/runtime/typscript.ts#L85-L89
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
KendraKnowledgeBase.createKendraIndex
private createKendraIndex(props: KendraKnowledgeBaseParameters) { const kendraProps = { capacityUnits: { queryCapacityUnits: props.queryCapacityUnits ?? 0, storageCapacityUnits: props.storageCapacityUnits ?? 0 }, description: `Kendra index whic...
/** * Handles creation of Kendra index with given properties * * @param props properties as passed from constructor * @returns CfnIndex, the created Kendra index */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/search/kendra-knowledge-base.ts#L155-L174
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
KendraKnowledgeBase.createKendraIAMRole
private createKendraIAMRole(): iam.Role { const kendraRole = new iam.Role(this, 'KendraRole', { assumedBy: new iam.ServicePrincipal('kendra.amazonaws.com') }); kendraRole.addToPolicy( new iam.PolicyStatement({ effect: iam.Effect.ALLOW, act...
/** * Creates an IAM role which will be assigned to the Kendra index, allowing it to perform logging functions * * @returns the IAM role */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/search/kendra-knowledge-base.ts#L181-L230
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
DynamoDBChatStorage.createDynamoDBTables
private createDynamoDBTables(stackParams: DynamoDBChatStorageParameters) { this.conversationTable = new dynamodb.Table(this, 'ConversationTable', { encryption: dynamodb.TableEncryption.AWS_MANAGED, billingMode: dynamodb.BillingMode.PAY_PER_REQUEST, partitionKey: { ...
/** * Handles creation of DynamoDB table with given props * * @param stackParams properties as passed from constructor */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/storage/chat-storage-stack.ts#L89-L110
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UIInfrastructureBuilder.constructor
constructor(props: UIInfrastructureBuilderProps) { this.uiAssetFolder = props.uiAssetFolder; this.deployWebApp = props.deployWebApp; }
/** * Constructor sets the uiAssetFolderPath property. * * @param props - UIInfrastructureBuilderProps object */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/ui/ui-infrastructure-builder.ts#L58-L61
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UIInfrastructureBuilder.createDistribution
public createDistribution(scope: Construct, id: string, props: cdk.NestedStackProps) { this.cloudFrontDistributionStack = new UIDistribution(scope, id, props); const deployWebAppDistributionCondition = this.getOrCreateDeployWebAppCondition(scope); (this.cloudFrontDistributionStack.node.default...
/** * Creates a UI distribution using the UIDistribution nested stack. * * @param scope - Construct scope * @param id - Stack id * @param props - NestedStackProps * @returns UIDistribution nested stack */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/ui/ui-infrastructure-builder.ts#L71-L80
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UIInfrastructureBuilder.createUIAssetsCustomResource
public createUIAssetsCustomResource(scope: Construct, id: string, props: cdk.NestedStackProps) { switch (this.uiAssetFolder) { case UIAssetFolders.DEPLOYMENT_PLATFORM: this.copyUIAssetsStack = new CopyDeploymentUIAssets(scope, id, props); break; case UIAs...
/** * Creates a custom resource to copy UI assets using the CopyUIAssets nested stack. * * @param scope - Construct scope * @param id - Stack id * @param props - NestedStackProps * @returns CopyUIAssets nested stack */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/ui/ui-infrastructure-builder.ts#L90-L107
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UIInfrastructureBuilder.getOrCreateDeployWebAppCondition
private getOrCreateDeployWebAppCondition(scope: Construct): cdk.CfnCondition { if (this.deployWebAppCondition) { return this.deployWebAppCondition; } this.deployWebAppCondition = new cdk.CfnCondition( cdk.Stack.of(scope), 'DeployWebAppUIInfrastructureConditio...
/** * Gets or creates the deploy web app condition resource. * * Checks if a condition was already created, and if not, initializes a new * CfnCondition resource with an expression that checks if `deployWebApp` equals * "yes". This condition controls whether the web app deployment proceeds. ...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/ui/ui-infrastructure-builder.ts#L119-L132
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UIInfrastructureBuilder.getCloudFrontUrlWithCondition
public getCloudFrontUrlWithCondition(): string { return cdk.Fn.conditionIf( this.deployWebAppCondition.logicalId, `https://${this.cloudFrontDistributionStack.cloudFrontDistribution.domainName}`, cdk.Aws.NO_VALUE ).toString(); }
/** * Generates a URL for the CloudFront distribution * * This method returns a URL for the CloudFront distribution configured in this stack. * It constructs the URL by prepending "https://" to the domain name of the distribution. * * @returns A string containing the CloudFront distributio...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/ui/ui-infrastructure-builder.ts#L142-L148
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UIInfrastructureBuilder.getCloudFrontUrlWithoutCondition
public getCloudFrontUrlWithoutCondition(): string { return `https://${this.cloudFrontDistributionStack.cloudFrontDistribution.domainName}`; }
/** * Generates a URL for the CloudFront distribution * * This method returns a URL for the CloudFront distribution configured in this stack. * It constructs the URL by prepending "https://" to the domain name of the distribution. * * @returns A string containing the CloudFront distributio...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/ui/ui-infrastructure-builder.ts#L158-L160
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UseCaseManagement.createVpcConfigForLambda
protected createVpcConfigForLambda(lambdaFunction: lambda.Function) { const cfnLambdaFunction = lambdaFunction.node.defaultChild as lambda.CfnFunction; cfnLambdaFunction.vpcConfig = cdk.Fn.conditionIf( this.deployVPCCondition.logicalId, { SubnetIds: this.stackPara...
/** * Method to add vpc configuration to lambda functions * * @param lambdaFunction */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/use-case-management/management-stack.ts#L528-L538
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
AppRegistry.visit
public visit(node: IConstruct): void { if (node instanceof cdk.Stack) { if (!node.nested) { // parent stack if (!this.application.get(node.stackId)) { this.createAppForAppRegistry(node); } const stack = node; ...
/** * Method invoked as a `Visitor` pattern to inject aspects during cdk synthesis * * @param node */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/app-registry-aspects.ts#L90-L126
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
AppRegistry.createAppForAppRegistry
private createAppForAppRegistry(stack: cdk.Stack): void { this.application.set( stack.stackId, new appreg.Application(stack, `RegistrySetup`, { applicationName: this.applicationNameValue, description: `Service Catalog application to track and manage all yo...
/** * Method to initialize an Application in AppRegistry service * * @returns - Instance of AppRegistry's Application class */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/app-registry-aspects.ts#L133-L141
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
AppRegistry.addTagsforApplication
private addTagsforApplication(node: cdk.Stack): void { if (!this.application.get(node.stackId)) { this.createAppForAppRegistry(node); } cdk.Tags.of(this.application.get(node.stackId)!).add('Solutions:SolutionID', this.solutionID); cdk.Tags.of(this.application.get(node.stackI...
/** * Method to add tags to the AppRegistry's Application instance * */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/app-registry-aspects.ts#L151-L160
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
AppRegistry.createAttributeGroup
private createAttributeGroup(node: cdk.Stack): void { if (!this.application.get(node.stackId)) { this.createAppForAppRegistry(node); } this.attributeGroup = new appreg.AttributeGroup(node, `AppAttributes`, { attributeGroupName: `AttrGrp-${cdk.Aws.STACK_NAME}`, ...
/** * Method to create AttributeGroup to be associated with the Application's instance in AppRegistry * */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/app-registry-aspects.ts#L166-L181
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.addCWMetricsPolicy
private addCWMetricsPolicy(lambda: lambda.Function) { if (!this.customMetricsPolicy) { this.customMetricsPolicy = new Map(); } const stack = cdk.Stack.of(lambda); let metricsPolicy = this.customMetricsPolicy.get(stack.stackId); if (metricsPolicy === undefined) { ...
/** * Method to add policy to put custom metrics to CloudWatch * * @param lambda */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L83-L124
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.addLayersForPythonLambda
private addLayersForPythonLambda(node: cdk.aws_lambda.Function, solutionID: string, solutionVersion: string) { node.addLayers(this.getOrCreatePythonUserAgent(node)); node.addEnvironment( 'AWS_SDK_USER_AGENT', `{ "user_agent_extra": "AWSSOLUTION/${solutionID}/${solutionVersion}" }...
/** * Method to add layers for lambdas with python runtimes. This method has an additional check if the * lambda function includes LLM libraries, it will not attach boto3 layer to restrict unpacked lambda size * during deployment, implying that LLM lambda functions will rely on the AWS Lambda provided Py...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L136-L170
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.addLayersForNodejsLambda
private addLayersForNodejsLambda(node: cdk.aws_lambda.Function, solutionID: any, solutionVersion: any) { node.addLayers(this.getOrCreateNodeUserAgent(node), this.getOrCreateAwsNodeSdkLibLayer(node)); node.addEnvironment( 'AWS_SDK_USER_AGENT', `{ "customUserAgent": [["AWSSOLUTION/...
/** * Method to add layers for Nodejs lambda * * @param node - the lambda Function construct currently visited (in context) * @param solutionID * @param solutionVersion */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L179-L186
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getOrCreateNodeUserAgent
private getOrCreateNodeUserAgent(node: Construct): lambda.LayerVersion { const stackId = this.getStackIdFromNode(node); if (this.nodejsUserAgentLayer.get(stackId) === undefined) { this.nodejsUserAgentLayer.set( stackId, new TSUserAgentLayer(this.getConstructTo...
/** * @returns Node runtime compatible LayerVersion for user-agent */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L191-L205
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getOrCreatePythonUserAgent
private getOrCreatePythonUserAgent(node: Construct): lambda.LayerVersion { const stackId = this.getStackIdFromNode(node); if (this.pythonUserAgentLayer.get(stackId) === undefined) { this.pythonUserAgentLayer.set( stackId, new PythonUserAgentLayer(this.getConst...
/** * This method checks if the layer definition exists. If not then creates a new one. * * @returns Python runtime compatible LayerVersion for user-agent */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L212-L226
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getOrCreateAwsNodeSdkLibLayer
private getOrCreateAwsNodeSdkLibLayer(node: Construct): lambda.LayerVersion { const stackId = this.getStackIdFromNode(node); if (this.awsNodeSdkLibLayer.get(stackId) === undefined) { this.awsNodeSdkLibLayer.set( stackId, new AwsNodeSdkLibLayer(this.getConstruc...
/** * This method checks if the layer defition exists. If not then creates a new one. * * @returns Lambda LayerVersion for AWS Node SDK */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L233-L247
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getOrCreateBoto3LibLayer
private getOrCreateBoto3LibLayer(node: Construct): lambda.LayerVersion { const stackId = this.getStackIdFromNode(node); if (this.boto3SdkLibLayer.get(stackId) === undefined) { this.boto3SdkLibLayer.set( stackId, new Boto3SdkLibLayer(this.getConstructToCreateLa...
/** * This method checks if the layer definition exists. If not then creates a new one. * * @returns returns a LayerVersion for Boto3 library */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L254-L268
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getOrCreateLangchainLayer
private getOrCreateLangchainLayer(node: Construct): lambda.LayerVersion { const stackId = this.getStackIdFromNode(node); if (this.pythonLangchainLayer.get(stackId) === undefined) { const pipInstallArgs = new PipInstallArguments(); pipInstallArgs.pythonVersion = LANGCHAIN_LAMBDA_P...
/** * This method checks if the layer definition exists. If not then creates a new one. * * @returns Python runtime compatible LayerVersion for LangChain with all its required packages */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L275-L294
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getConstructToCreateLayer
private getConstructToCreateLayer(node: Construct) { let construct: Construct; if (cdk.Stack.of(node).nested) { construct = cdk.Stack.of(cdk.Stack.of(node).nestedStackParent!); } else { construct = cdk.Stack.of(node); } return construct; }
/** * Get the construct of the stack to create the layer. If the construct is nested then get the construct of the parent * stack. * * @param node * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L303-L311
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.checkIfAdditionalLLMLayersRequired
private checkIfAdditionalLLMLayersRequired(node: lambda.Function): boolean { // using escape hatches as there is no way to check if the metadata is present const lambdaMetadata = (node.node.defaultChild as lambda.CfnFunction).cfnOptions.metadata; if (lambdaMetadata && lambdaMetadata[ADDITIONAL_L...
/** * Iterates through the lambda construct metadata (if present) in a lambda function node to check if the * 'AttachLangchainLayer' metadata has a value of true or false. * @param node lambda function node from template */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L318-L326
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaAspects.getStackIdFromNode
private getStackIdFromNode(node: Construct): string { const stackId = cdk.Stack.of(node).nestedStackParent ? cdk.Stack.of(node).nestedStackParent!.stackId : cdk.Stack.of(node).stackId; return stackId; }
/** * Method to get stack ID from node (Construct object) * * @param node * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-aspect.ts#L334-L340
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaRuntimeCommandFactory.constructor
constructor(deployPartitionCondition: cdk.CfnCondition) { this.lambdaRuntimeCommandMap = new Map<lambda.RuntimeFamily, LambdaRuntimeCommand>(); this.lambdaRuntimeCommandMap.set( lambda.RuntimeFamily.PYTHON, new PythonRuntimeCommand(deployPartitionCondition) ); thi...
/** * * @param deployPartitionCondition : The CfnCondition to check if the aws partition (govcloud vs non-govcloud) */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-runtimes.ts#L79-L89
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
LambdaRuntimeCommandFactory.getRuntimeCommand
public getRuntimeCommand(runtimeFamily: lambda.RuntimeFamily): LambdaRuntimeCommand { const lambdaRuntimeCommand = this.lambdaRuntimeCommandMap.get(runtimeFamily); if (!lambdaRuntimeCommand) { throw new Error('Runtime family not supported'); } return lambdaRuntimeCommand; ...
/** * Factory method to get the Lambda runtime based on the lambda runtime family * * @param runtimeFamily * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/utils/lambda-runtimes.ts#L97-L105
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
BedrockAgentVPC.getCompatibleAzs
protected getCompatibleAzs(): string[] { const getCompatibleAZsCustomResource = new cdk.CustomResource(this, 'GetCompatibleAZs', { resourceType: 'Custom::GetCompatibleAZs', serviceToken: this.customResourceLambdaArn, properties: { Resource: 'GET_COMPATIBLE_AZS...
/** * This method overrides the default implementation to choose AZs based on bedrock-agent and * bedrock-agent-runtime endpoints availability * * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/bedrock-agent-vpc.ts#L99-L142
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
BedrockAgentVPC.getStackType
public getStackType(): string { return 'bedrock-agents'; }
/** * Returns the stack type that the VPC is being used in. This could be use-case, deployment */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/bedrock-agent-vpc.ts#L147-L149
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
BedrockUseCaseVPC.getStackType
public getStackType(): string { return 'bedrock-use-case'; }
/** * Returns the stack type that the VPC is being used in. This could be use-case, deployment */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/bedrock-vpc.ts#L62-L64
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
CustomVPC.createServiceEndpoints
protected createServiceEndpoints() { const ddbEndpoint: ec2.GatewayVpcEndpoint = this.vpc.addGatewayEndpoint('DDBEndpoint', { service: ec2.GatewayVpcEndpointAwsService.DYNAMODB, subnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS }] }); ddbEndpoint.addToPolicy( ...
/** * Creates VPC endpoints for various AWS services within the VPC. * * This method sets up the following VPC endpoints: * * 1. DynamoDB Gateway Endpoint: * - Allows resources within the VPC to access DynamoDB without going through the public internet. * - Configured to be acce...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/custom-vpc.ts#L120-L233
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
CustomVPC.createVpc
protected createVpc(subnetCidrMask: number) { const vpcFlowLogLogGroup = new logs.LogGroup(this, 'VPCFlowLogs', { retention: LOG_RETENTION_PERIOD }); const subnets: ec2.SubnetConfiguration[] = [ { subnetType: ec2.SubnetType.PRIVATE_WITH_EGRESS, ...
/** * Create the VPC. Can be overridden by child classes for custom behaviour. * * @param subnetCidrMask */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/custom-vpc.ts#L369-L496
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
DeploymentPlatformVPC.getStackType
public getStackType(): string { return 'deployment-platform'; }
/** * Returns the stack type that the VPC is being used in. This could be use-case, deployment */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/deployment-platform-vpc.ts#L69-L71
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
SagemakerUseCaseVPC.getStackType
public getStackType(): string { return 'sagemaker-use-case'; }
/** * Returns the stack type that the VPC is being used in. This could be use-case, deployment */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/sagemaker-vpc.ts#L54-L56
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TextUseCaseVPC.getStackType
public getStackType(): string { throw new Error('Child classes should implement this method. This class should not be instantiated'); }
/** * Returns the stack type that the VPC is being used in. This could be use-case, deployment */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/infrastructure/lib/vpc/text-use-case-vpc.ts#L175-L177
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
PermanentlyDeleteUseCaseCommand.constructor
constructor() { // NOSONAR - typescript:S4144 - this hierarchy is separate from line 49. this.stackMgmt = new StackManagement(); this.storageMgmt = new StorageManagement(); this.useCaseConfigMgmt = new UseCaseConfigManagement(); }
// prettier-ignore
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/command.ts#L175-L179
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ListUseCasesCommand.constructor
constructor() { // NOSONAR - typescript:S4144 - this hierarchy is separate from line 152. this.stackMgmt = new StackManagement(); this.storageMgmt = new StorageManagement(); this.useCaseConfigMgmt = new UseCaseConfigManagement(); }
// prettier-ignore
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/command.ts#L288-L292
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ListUseCasesCommand.filterUseCases
private filterUseCases(useCaseRecords: UseCaseRecord[], searchFilter: string) { // Filter use cases based on search filter const searchFilterLower = searchFilter.toLowerCase(); useCaseRecords = useCaseRecords.filter( (useCaseRecord) => useCaseRecord.UseCaseId.toLowerC...
/** * Filters use cases based on presence of the search filter in the UseCaseId and Name fields if present (case insensitive) * * @param useCaseRecords - Retrieved use case records from DDB to be filtered and selected from. * @param searchFilter - Search filter provided by the user. Will search agai...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/command.ts#L365-L375
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ListUseCasesCommand.findNextPage
private findNextPage( totalUseCases: number, currentPage: number, useCasesPerPage: number = DEFAULT_USE_CASES_PER_PAGE ) { if (currentPage * useCasesPerPage < totalUseCases) { return currentPage + 1; } return undefined; }
/** * Computes the next page number if there are more use cases beyond the current page. * * @param totalUseCases * @param currentPage * @param useCasesPerPage * @returns the next page or undefined if there are no more use cases beyond the current page. */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/command.ts#L385-L394
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ListUseCasesCommand.sortUseCasesByCreationDate
private sortUseCasesByCreationDate(useCaseRecords: UseCaseRecord[]) { useCaseRecords.sort((a, b) => b.CreatedDate.localeCompare(a.CreatedDate)); return useCaseRecords; }
/** * sorts the use case records by creation date. This can be done lexicographically since dates are in ISO 8601 format, * with the latest being shown first. */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/command.ts#L400-L403
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
ListUseCasesCommand.formatUseCasesToList
private formatUseCasesToList = ( useCaseDeploymentsMap: Map<string, DeploymentDetails>, numUseCases: number, nextPage: number | undefined ): any => { // note: future server side sorting may go here const formattedData: any = []; try { useCaseDeploymentsMap...
/** * Formatting the data from ddb, use case config config, and a stack's deployment details to a list of use cases * to send to the front end. * * @param useCaseDeploymentsMap * @returns */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/command.ts
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
StackManagement.createStackInfoFromDdbRecord
private static parseStackDetails = (stackDetails: Stack): UseCaseStackDetails => { const findParameterValue = (key: string): string | undefined => { return stackDetails.Parameters?.find((param) => param.ParameterKey === key)?.ParameterValue; }; const findOutputValue = (key: string):...
/** * Parse the stack details to get a subset of the required details * @param stackDetails response of describe stack for a single stack */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/cfn/stack-management.ts
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
parameters
const parameters = (cfnParameters: Map<string, string>): Parameter[] => { let parameterArray: Parameter[] = new Array(); cfnParameters.forEach((value, key) => { parameterArray.push({ ParameterKey: key, ParameterValue: value }); }); return parameterArray; };
/** * utility method to build the Parameter array from the Map */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/cfn/stack-operation-builder.ts#L135-L145
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
updateParameters
const updateParameters = (cfnParameters: Map<string, string>): Parameter[] => { let parameterArray: Parameter[] = parameters(cfnParameters); for (let parameter of RetainedCfnParameterKeys) { if (!cfnParameters.has(parameter)) { parameterArray.push({ ParameterKey: parameter, ...
/** * Utility method to build the Parameter array from the Map on updates, marking parameters to be retained */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/cfn/stack-operation-builder.ts#L150-L161
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
getTemplateUrl
const getTemplateUrl = (useCase: UseCase): string => { if (process.env[ARTIFACT_KEY_PREFIX_ENV_VAR]) { return `https://${process.env[ARTIFACT_BUCKET_ENV_VAR]}.s3.amazonaws.com/${process.env[ARTIFACT_KEY_PREFIX_ENV_VAR]}/${useCase.templateName}${process.env[TEMPLATE_FILE_EXTN_ENV_VAR]}`; } else { ...
/** * Utility method to get template URL using the useCase object that is passed to it */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/cfn/stack-operation-builder.ts#L166-L172
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
TextUseCaseValidator.resolveBedrockModelSourceOnUpdate
public static resolveBedrockModelSourceOnUpdate(updateConfig: any, mergedConfig: any): any { let resolvedConfig = mergedConfig; // only perform this action if our merged config is invalid (has both a ModelId and an InferenceProfileId) if ( mergedConfig.LlmParams?.BedrockLlmParams?.M...
/** * Function to be applied to an updated use case configuration which will restrict the BedrockLlmParams to only contain one of the InferenceProfileId or ModelId. Required since merging of new and existing configs on updates will retain both values. * * @param newConfig The new config object coming fro...
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/model/use-case-validator.ts#L198-L224
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UseCase.constructor
constructor( //NOSONAR - typescript:S107 - data model class hence needs primitive types as parameters useCaseId: string, name: string, description: string | undefined, cfnParameters: Map<string, string> | undefined, configuration: UseCaseConfiguration, userId: string, ...
// prettier-ignore
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/model/use-case.ts#L72-L92
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UseCase.clone
public clone(): UseCase { let newUseCase = new UseCase( this.useCaseId, this.name, this.description, new Map<string, string>(this.cfnParameters), { ...this.configuration }, this.userId, this.templateName .split(/...
/** * Performs a deep copy of this object, preserving methods and property values * * @returns a deep copy of the object */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/model/use-case.ts#L130-L146
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UseCase.setParameterIfExists
protected static setParameterIfExists( cfnParameters: Map<string, string>, paramName: string, value: any | undefined ): void { if (value !== undefined) { cfnParameters.set(paramName, value.toString()); } }
/** * If the provided value is defined, sets the correct Cloudformation Parameter to that value as a string. * * @param cfnParameters The parameter map to set the value in * @param paramName Name of the Cloudformation Parameter to set * @param value value to set */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/model/use-case.ts#L155-L163
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UseCase.setBooleanParameterIfExists
protected static setBooleanParameterIfExists( cfnParameters: Map<string, string>, paramName: string, value: boolean | undefined ): void { if (value !== undefined) { if (value) { cfnParameters.set(paramName, 'Yes'); } else { cfnP...
/** * If the provided value is defined, sets the correct Cloudformation Parameter to 'Yes' or 'No' accordingly. * * @param cfnParameters The parameter map to set the value in * @param paramName Name of the Cloudformation Parameter to set * @param value boolean value to set */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/model/use-case.ts#L172-L184
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
UseCase.setListParameterIfExists
protected static setListParameterIfExists( cfnParameters: Map<string, string>, paramName: string, values: Array<any> | undefined ): void { if (values !== undefined) { let valueString = ''; for (const item of values) { valueString += item.toStri...
/** * If the provided value is defined, sets the correct Cloudformation Parameter to a comma separated list of the values. * * @param cfnParameters The parameter map to set the value in * @param paramName Name of the Cloudformation Parameter to set * @param values Array of values to set */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/lambda/use-case-management/model/use-case.ts#L193-L209
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
deployUseCasePostRequest
const deployUseCasePostRequest = async (endpoint: string, params = {}) => { setUseCaseDeployStatus(DEPLOYMENT_STATUS_NOTIFICATION.PENDING); const token = await generateToken(); const response = await API.post(API_NAME, endpoint, { body: params, headers: { ...
/** * Make a reqeust to deploy a use case using CloudFormation * POST /deployments/ * * @param {string} endpoint API Endpoint to call * @param {Object} params Use case deployment params to send to the API */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/ui-deployment/src/components/wizard/WizardView.tsx#L140-L151
b278845810db549e19740c5a2405faee959b82a3
generative-ai-application-builder-on-aws
github_2023
aws-solutions
typescript
getRequiredFields
const getRequiredFields = (modelName: string, provisionedModel: boolean): string[] => { if (modelName === INFERENCE_PROFILE) { return ['modelName', 'inferenceProfileId']; } if (provisionedModel) { return ['modelName', 'modelArn']; } return ['modelName']; };
/** * * @param modelProvider Value of model provider selected in the dropdown * @param provisionedModel Whether the model is provisioned or not */
https://github.com/aws-solutions/generative-ai-application-builder-on-aws/blob/b278845810db549e19740c5a2405faee959b82a3/source/ui-deployment/src/components/wizard/Model/helpers.ts#L190-L198
b278845810db549e19740c5a2405faee959b82a3