Skip to content

Commit 738cd44

Browse files
authored
Merge pull request #156 from aws-samples/add_sample_tags
feat(samples): Added SAES metric dashboard tag to samples
2 parents 0ec9718 + 278aa36 commit 738cd44

File tree

24 files changed

+80
-13
lines changed

24 files changed

+80
-13
lines changed

samples/content-generation/bin/content-generation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const app = new cdk.App();
1818
new GenerateContentStack(app, 'GenerateContentStack', {
1919
natGateways: 1,
2020
clientUrl:env.clientUrl,
21-
description: '(uksb-1tupboc43) Image generation stack',
21+
//description: '(uksb-1tupboc43) (tag: Image generation stack)',
2222
env: { account: process.env.CDK_DEFAULT_ACCOUNT,
2323
region: process.env.CDK_DEFAULT_REGION },
2424
/* If you don't specify 'env', this stack will be environment-agnostic.
@@ -34,4 +34,4 @@ env: { account: process.env.CDK_DEFAULT_ACCOUNT,
3434
// env: { account: '123456789012', region: 'us-east-1' },
3535

3636
/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
37-
});
37+
});

samples/content-generation/lib/content-generation-stack.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export class GenerateContentStack extends cdk.Stack {
3030
constructor(scope: Construct, id: string, props: GenerateContentStackProps) {
3131
super(scope, id, props);
3232

33+
const key= '(uksb-1tupboc43)'
34+
const tag = ' Image generation stack'
35+
36+
3337
console.log(`Deploying to account ${this.account} in region ${this.region}`);
3438

3539
//---------------------------------------------------------------------
@@ -246,6 +250,9 @@ export class GenerateContentStack extends cdk.Stack {
246250
existingGeneratedAssetsBucketObj: this.generatedAssetsBucket,
247251
observability: true,
248252
});
253+
254+
this.templateOptions.description = `Description: ${key} (tag:${ tag}) `
255+
249256

250257
NagSuppressions.addResourceSuppressions(grapdhQLApiRole, [{id: 'AwsSolutions-IAM5', reason: '* used after ARN prefix'}], true)
251258

samples/contract-compliance-analysis/back-end/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
stack_name = os.environ.get('STACK_NAME', "MainBackendStack")
2626

2727
main_backend_stack = BackendStack(
28-
app, stack_name, description=f'{(USAGE_METRIC)} (version:{VERSION}) (tag:{SOLUTION_NAME})'
28+
app, stack_name, description=f'({USAGE_METRIC})(tag: {SOLUTION_NAME})'
2929
)
3030

3131
cdk.Aspects.of(app).add(AwsSolutionsChecks())

samples/document_explorer/bin/document_explorer.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ cdk.Tags.of(persistence).add("stack", "persistence");
5959
//-----------------------------------------------------------------------------
6060
const api = new ApiStack(app, 'ApiStack', {
6161
env: env,
62-
description: '(uksb-1tupboc43) API Layer stack',
6362
existingOpensearchServerlessCollection: persistence.opensearchCollection,
6463
existingVpc: network.vpc,
6564
existingSecurityGroup: network.securityGroups[0],

samples/document_explorer/lib/api-stack.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ export class ApiStack extends Stack {
271271
`${this.mergedApi.attrArn}/sourceApiAssociations/*`,
272272
]
273273
}));
274+
275+
this.templateOptions.description = `Description: (uksb-1tupboc43) (tag: document explorer)`
276+
274277
NagSuppressions.addResourceSuppressions(mergedApiRole, [{id: 'AwsSolutions-IAM5', reason: '* used after ARN prefix'}], true)
275278

276279
// Add Source API
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import * as cdk from 'aws-cdk-lib';
2+
import { Construct } from 'constructs';
3+
import * as s3 from 'aws-cdk-lib/aws-s3';
4+
import * as fs from 'fs';
5+
import * as path from 'path';
6+
import { bedrock } from '@cdklabs/generative-ai-cdk-constructs';
7+
8+
9+
export class DocumentationAgentStack extends cdk.Stack {
10+
11+
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
12+
super(scope, id, props);
13+
14+
const key= '(uksb-1tupboc43)'
15+
const tag = ' Document Agent'
16+
17+
// Read instruction from file
18+
const instructionPath = path.join(__dirname, '..', 'instructions', 'readme-instructions.txt');
19+
const instruction = fs.readFileSync(instructionPath, 'utf-8');
20+
21+
22+
// print instruction
23+
new cdk.CfnOutput(this, 'Instruction', {
24+
value: instruction,
25+
description: 'Instruction for the agent'
26+
});
27+
28+
const agent = new bedrock.Agent(this, 'documentationAgent', {
29+
foundationModel: bedrock.BedrockFoundationModel.AMAZON_NOVA_MICRO_V1,
30+
instruction: instruction,
31+
enableUserInput: true,
32+
shouldPrepareAgent:true
33+
});
34+
35+
this.templateOptions.description = `Description: ${key} (tag:${ tag}) `
36+
}
37+
}

samples/image-description/bin/image-description.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@ const imageDescStack = new ImageDescriptionStack(app, "ImageDesStack", {
2525
account: process.env.CDK_DEFAULT_ACCOUNT,
2626
region: process.env.CDK_DEFAULT_REGION,
2727
},
28-
description: "(uksb-1tupboc43) GenAI Image Description Stack",
28+
2929
});

samples/image-description/lib/image-description-stack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ export class ImageDescriptionStack extends cdk.Stack {
140140
}
141141
);
142142

143+
this.templateOptions.description = "Description: (uksb-1tupboc43) (tag: Image Description sample)",
143144

144145
summarization.inputAssetBucket.grantReadWrite(this.authenticatedRole);
145146
summarization.processedAssetBucket.grantRead(this.authenticatedRole);

samples/llamaindex-basic-data-loader/bin/llamaindex_basic_data_loader_stack.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,5 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
3737
# docker_image_asset_directory=path.dirname(__file__) + path.sep + ".." + path.sep + "docker",
3838
container_logging_level="DEBUG",
3939
)
40+
41+
self.template_options.description= "Description: (uksb-1tupboc43) (tag: llamaindex data loader sample)",

samples/python-samples/python_samples/bedrock_opensearch_stack.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
7272
user_input_enabled= True,
7373
should_prepare_agent=True
7474
)
75-
7675
## associate action group with agent
7776
agent.add_action_group(ag)
7877

@@ -82,7 +81,8 @@ def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
8281
description='alias for my agent',
8382
agent=agent)
8483

85-
84+
self.template_options.description='Description: (uksb-1tupboc43) (tag: python bedrock sample)'
85+
8686
CfnOutput(self, "KnowledgeBaseId", value=kb.knowledge_base_id)
8787
CfnOutput(self, 'agentid', value= agent.agent_id)
8888
CfnOutput(self, 'DataSourceId', value= dataSource.data_source_id)

0 commit comments

Comments
 (0)