Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(construct): add cloudwatch dashboard for bedrock #651

Merged
merged 8 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ The following constructs are available in the library:
| [SageMaker model deployment (Custom)](./src/patterns/gen-ai/aws-model-deployment-sagemaker/README_custom_sagemaker_endpoint.md) | Deploy a foundation model from an S3 location to an Amazon SageMaker endpoint. | Amazon SageMaker |
| [Content Generation](./src/patterns/gen-ai/aws-contentgen-appsync-lambda/README.md) | Generate images from text using Amazon titan-image-generator-v1 or stability.stable-diffusion-xl model. | AWS Lambda, Amazon Bedrock, AWS AppSync |
| [Web crawler](./src/patterns/gen-ai/aws-web-crawler/README.md) | Crawl websites and RSS feeds on a schedule and store changeset data in an Amazon Simple Storage Service bucket. | AWS Lambda, AWS Batch, AWS Fargate, Amazon DynamoDB |
| [Amazon Bedrock Monitoring (Amazon CloudWatch Dashboard)](./src/patterns/gen-ai/aws-bedrock-cw-dashboard/README.md) | Amazon CloudWatch dashboard to monitor model usage from Amazon Bedrock. | Amazon CloudWatch |

### L2 Constructs

Expand Down
3 changes: 3 additions & 0 deletions apidocs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
## Classes

- [BaseClass](classes/BaseClass.md)
- [BedrockCwDashboard](classes/BedrockCwDashboard.md)
- [ContainerImage](classes/ContainerImage.md)
- [ContentGenerationAppSyncLambda](classes/ContentGenerationAppSyncLambda.md)
- [CustomSageMakerEndpoint](classes/CustomSageMakerEndpoint.md)
Expand All @@ -39,6 +40,7 @@

- [AsyncInferenceConfig](interfaces/AsyncInferenceConfig.md)
- [BaseClassProps](interfaces/BaseClassProps.md)
- [BedrockCwDashboardProps](interfaces/BedrockCwDashboardProps.md)
- [ContainerImageConfig](interfaces/ContainerImageConfig.md)
- [ContentGenerationAppSyncLambdaProps](interfaces/ContentGenerationAppSyncLambdaProps.md)
- [CrawlerTarget](interfaces/CrawlerTarget.md)
Expand All @@ -51,6 +53,7 @@
- [JumpStartSageMakerEndpointProps](interfaces/JumpStartSageMakerEndpointProps.md)
- [LangchainLayerProps](interfaces/LangchainLayerProps.md)
- [LangchainProps](interfaces/LangchainProps.md)
- [ModelMonitoringProps](interfaces/ModelMonitoringProps.md)
- [QaAppsyncOpensearchProps](interfaces/QaAppsyncOpensearchProps.md)
- [RagAppsyncStepfnOpensearchProps](interfaces/RagAppsyncStepfnOpensearchProps.md)
- [SummarizationAppsyncStepfnProps](interfaces/SummarizationAppsyncStepfnProps.md)
Expand Down
153 changes: 153 additions & 0 deletions apidocs/classes/BedrockCwDashboard.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
[**@cdklabs/generative-ai-cdk-constructs**](../README.md) • **Docs**

***

[@cdklabs/generative-ai-cdk-constructs](../README.md) / BedrockCwDashboard

# Class: BedrockCwDashboard

The BedrockCwDashboard class.

## Extends

- `Construct`

## Constructors

### new BedrockCwDashboard()

> **new BedrockCwDashboard**(`scope`, `id`, `props`): [`BedrockCwDashboard`](BedrockCwDashboard.md)

Constructs a new instance of the BedrockCwDashboard class.

#### Parameters

• **scope**: `Construct`

represents the scope for all the resources.

• **id**: `string`

this is a a scope-unique id.

• **props**: [`BedrockCwDashboardProps`](../interfaces/BedrockCwDashboardProps.md)

user provided props for the construct.

#### Returns

[`BedrockCwDashboard`](BedrockCwDashboard.md)

#### Since

0.0.0

#### Overrides

`Construct.constructor`

## Properties

### dashboard

> `readonly` **dashboard**: `Dashboard`

Returns the instance of CloudWatch dashboard used by the construct

***

### node

> `readonly` **node**: `Node`

The tree node.

#### Inherited from

`Construct.node`

## Methods

### addAllModelsMonitoring()

> **addAllModelsMonitoring**(`props`): `void`

#### Parameters

• **props**: [`ModelMonitoringProps`](../interfaces/ModelMonitoringProps.md)

#### Returns

`void`

***

### addModelMonitoring()

> **addModelMonitoring**(`modelName`, `modelId`, `props`): `void`

#### Parameters

• **modelName**: `string`

• **modelId**: `string`

• **props**: [`ModelMonitoringProps`](../interfaces/ModelMonitoringProps.md)

#### Returns

`void`

***

### toString()

> **toString**(): `string`

Returns a string representation of this construct.

#### Returns

`string`

#### Inherited from

`Construct.toString`

***

### isConstruct()

> `static` **isConstruct**(`x`): `x is Construct`

Checks if `x` is a construct.

Use this method instead of `instanceof` to properly detect `Construct`
instances, even when the construct library is symlinked.

Explanation: in JavaScript, multiple copies of the `constructs` library on
disk are seen as independent, completely different libraries. As a
consequence, the class `Construct` in each copy of the `constructs` library
is seen as a different class, and an instance of one class will not test as
`instanceof` the other class. `npm install` will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the `constructs`
library can be accidentally installed, and `instanceof` will behave
unpredictably. It is safest to avoid using `instanceof`, and using
this type-testing method instead.

#### Parameters

• **x**: `any`

Any object

#### Returns

`x is Construct`

true if `x` is an object created from a class which extends `Construct`.

#### Inherited from

`Construct.isConstruct`
40 changes: 40 additions & 0 deletions apidocs/interfaces/BedrockCwDashboardProps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
[**@cdklabs/generative-ai-cdk-constructs**](../README.md) • **Docs**

***

[@cdklabs/generative-ai-cdk-constructs](../README.md) / BedrockCwDashboardProps

# Interface: BedrockCwDashboardProps

The properties for the BedrockCwDashboardProps class.

## Properties

### dashboardName?

> `readonly` `optional` **dashboardName**: `string`

Optional A name for the dashboard which will be created.
If existingDashboard is defined, this value will be ignored.
If not provided, the construct will create a new dashboard named 'BedrockMetricsDashboard'

#### Default

```ts
- none
```

***

### existingDashboard?

> `readonly` `optional` **existingDashboard**: `Dashboard`

Optional An existing dashboard where metrics will be added to.
If not provided, the construct will create a new dashboard

#### Default

```ts
- none
```
15 changes: 15 additions & 0 deletions apidocs/interfaces/ModelMonitoringProps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[**@cdklabs/generative-ai-cdk-constructs**](../README.md) • **Docs**

***

[@cdklabs/generative-ai-cdk-constructs](../README.md) / ModelMonitoringProps

# Interface: ModelMonitoringProps

The properties for the ModelMonitoringProps class.

## Properties

### period?

> `readonly` `optional` **period**: `Duration`
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ export * from './common/props/DockerLambdaCustomProps';
export * from './common/props/LangchainProps';
export * from './common/base-class/base-class';
export * from './common/base-class/construct-name-enum';
export * from './patterns/gen-ai/aws-bedrock-cw-dashboard';
Loading
Loading