@yike5460/intelli-agent
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Build a Constructor for Generative AI

Start from scratch

  1. Initialize your project using projen
npx projen new awscdk-construct --name intelli-agent
  1. Add your construct implementation ts file (intell-agent-construct e.g.) inside src folder and corresponding lambda function code (e.g. lambda folder) in root folder

  2. Import your custom construct in the main stack file (index.ts)

export * from './intelli-agent-construct';
  1. Adjust your test file (intell-agent.test.ts) inside test folder and run the test
npx projen test

 PASS  test/intelli-agent.test.ts
  ✓ Intelli Agent Construct (437 ms)

----------------------------|---------|----------|---------|---------|-------------------
File                        | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s 
----------------------------|---------|----------|---------|---------|-------------------
All files                   |     100 |      100 |     100 |     100 |                   
 intelli-agent-construct.ts |     100 |      100 |     100 |     100 |                   
----------------------------|---------|----------|---------|---------|-------------------
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        3.648 s, estimated 4 s
  1. Update the .projenrc.ts file to include the new Lambda asset and run npx projen to update the project configuration
npx projen
  1. Build your project
npx projen build && npm version patch
  1. Publish your project to npm, we don't use "npx progen release" for simplicity in skip some processes e.g. unused git diff and customized npm authentication
npm login
npm publish --access public

Use the Construct

  1. Create a new CDK project
mkdir my-intelli-agent
cd my-intelli-agent
npx projen new awscdk-app-ts
  1. Add the new construct to your project
npm install @yike5460/intelli-agent
  1. Import the construct in your stack
import { AIAgent } from '@yike5460/intelli-agent';
  1. Use the construct in your stack
export class MyStack extends Stack {
  constructor(scope: Construct, id: string, props: StackProps = {}) {
    super(scope, id, props);

    // define resources here...
    new AIAgent(this, 'IntelliAgentConstruct', {
      agentName: 'my-intelli-agent',
      runtime: lambda.Runtime.NODEJS_LATEST,
      memorySize: 256,
    });
  }
}
  1. Build and deploy your project
npx projen build
npx cdk deploy

Readme

Keywords

Package Sidebar

Install

npm i @yike5460/intelli-agent

Weekly Downloads

20

Version

0.0.2

License

Apache-2.0

Unpacked Size

102 MB

Total Files

2781

Last publish

Collaborators

  • yike5460