|
| 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 | +} |
0 commit comments