Skip to content

Commit 6a135ff

Browse files
authored
feat(bedrock): Implement Prompt management (#663)
* feat(bedrock): add prompt management
1 parent 1cc8b55 commit 6a135ff

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+2829
-1027
lines changed

.eslintrc.json

+6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.gitignore

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.npmignore

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/deps.json

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projen/tasks.json

+82-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.projenrc.ts

+14-7
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const CDK_VERSION: string = '2.154.1';
3434

3535
function camelCaseIt(input: string): string {
3636
// Hypens and dashes to spaces and then CamelCase...
37-
return input.replace(/-/g, ' ').replace(/_/g, ' ').replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function(match, _) { if (+match === 0) return ''; return match.toUpperCase(); });
37+
return input.replace(/-/g, ' ').replace(/_/g, ' ').replace(/(?:^\w|[A-Z]|\b\w|\s+)/g, function (match, _) { if (+match === 0) return ''; return match.toUpperCase(); });
3838
}
3939

4040
const project = new awscdk.AwsCdkConstructLibrary({
@@ -64,6 +64,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
6464
'typedoc-plugin-markdown',
6565
'aws-sdk-mock',
6666
'@aws-cdk/assert',
67+
`@aws-cdk/integ-tests-alpha@${CDK_VERSION}-alpha.0`,
6768
],
6869
deps: [
6970
'cdk-nag',
@@ -80,21 +81,20 @@ const project = new awscdk.AwsCdkConstructLibrary({
8081
npmAccess: NpmAccess.PUBLIC,
8182

8283
publishToPypi: {
83-
distName: PUBLICATION_NAMESPACE+'.'+PROJECT_NAME,
84-
module: (PUBLICATION_NAMESPACE.replace(/-/g, '_'))+'.'+(PROJECT_NAME.replace(/-/g, '_')), // PEP 8, convert hypens
84+
distName: PUBLICATION_NAMESPACE + '.' + PROJECT_NAME,
85+
module: (PUBLICATION_NAMESPACE.replace(/-/g, '_')) + '.' + (PROJECT_NAME.replace(/-/g, '_')), // PEP 8, convert hypens
8586
// twineRegistryUrl: '${{ secrets.TWINE_REGISTRY_URL }}',
8687
},
8788

8889
publishToNuget: {
89-
dotNetNamespace: camelCaseIt(PUBLICATION_NAMESPACE)+'.'+camelCaseIt(PROJECT_NAME),
90-
packageId: camelCaseIt(PUBLICATION_NAMESPACE)+'.'+camelCaseIt(PROJECT_NAME),
90+
dotNetNamespace: camelCaseIt(PUBLICATION_NAMESPACE) + '.' + camelCaseIt(PROJECT_NAME),
91+
packageId: camelCaseIt(PUBLICATION_NAMESPACE) + '.' + camelCaseIt(PROJECT_NAME),
9192
},
9293

9394
publishToGo: {
9495
moduleName: `github.com/${PUBLICATION_NAMESPACE}/${PROJECT_NAME}-go`,
9596
packageName: PROJECT_NAME,
9697
},
97-
9898
codeCov: true,
9999
codeCovTokenSecret: 'CODECOV_TOKEN',
100100

@@ -112,6 +112,7 @@ const project = new awscdk.AwsCdkConstructLibrary({
112112
},
113113
},
114114
},
115+
integrationTestAutoDiscover: true,
115116
docgen: false,
116117
licensed: true,
117118
license: 'Apache-2.0',
@@ -147,6 +148,11 @@ if (workflowUpgradeMain) {
147148
workflowUpgradeMain.updateJob('pr', buildUpgradeMainPRCustomJob());
148149
}
149150

151+
// Update Snapshots
152+
project.upgradeWorkflow?.postUpgradeTask.spawn(
153+
project.tasks.tryFind('integ:snapshot-all')!,
154+
);
155+
150156
// Add specific overrides https://projen.io/docs/integrations/github/#actions-versions
151157
project.github?.actions.set('actions/checkout@v3', 'actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11'); // https://github.com/projen/projen/issues/3529
152158
project.github?.actions.set('actions/checkout@v4', 'actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11');
@@ -207,6 +213,7 @@ project.eslint?.addPlugins('header');
207213
project.eslint?.addRules({
208214
'header/header': [2, 'header.js'],
209215
});
216+
project.eslint?.addRules({ 'space-infix-ops': ['error', { int32Hint: false }] });
210217

211218
project.eslint?.addIgnorePattern('LangchainProps.ts');
212219
project.eslint?.addIgnorePattern('AdapterProps.ts');
@@ -243,7 +250,7 @@ project.addTask('generate-models-containers', {
243250
},
244251
{
245252
say: 'Generate new list of models available from Jumpstart and DLC containers',
246-
cwd: project.srcdir+'/patterns/gen-ai/aws-model-deployment-sagemaker/code-generation',
253+
cwd: project.srcdir + '/patterns/gen-ai/aws-model-deployment-sagemaker/code-generation',
247254
exec: 'npm run generate',
248255
},
249256
{

apidocs/namespaces/bedrock/README.md

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [PiiEntitiesConfigAction](enumerations/PiiEntitiesConfigAction.md)
2323
- [PromptCreationMode](enumerations/PromptCreationMode.md)
2424
- [PromptState](enumerations/PromptState.md)
25+
- [PromptTemplateType](enumerations/PromptTemplateType.md)
2526
- [PromptType](enumerations/PromptType.md)
2627
- [UKSpecific](enumerations/UKSpecific.md)
2728
- [USASpecific](enumerations/USASpecific.md)
@@ -38,6 +39,9 @@
3839
- [GuardrailVersion](classes/GuardrailVersion.md)
3940
- [InlineApiSchema](classes/InlineApiSchema.md)
4041
- [KnowledgeBase](classes/KnowledgeBase.md)
42+
- [Prompt](classes/Prompt.md)
43+
- [PromptVariant](classes/PromptVariant.md)
44+
- [PromptVersion](classes/PromptVersion.md)
4145
- [S3ApiSchema](classes/S3ApiSchema.md)
4246
- [S3DataSource](classes/S3DataSource.md)
4347
- [SensitiveInformationPolicyConfig](classes/SensitiveInformationPolicyConfig.md)
@@ -52,17 +56,22 @@
5256
- [AgentProps](interfaces/AgentProps.md)
5357
- [ApiSchemaConfig](interfaces/ApiSchemaConfig.md)
5458
- [BedrockFoundationModelProps](interfaces/BedrockFoundationModelProps.md)
59+
- [CommonPromptVariantProps](interfaces/CommonPromptVariantProps.md)
5560
- [ContentPolicyConfigProps](interfaces/ContentPolicyConfigProps.md)
5661
- [ContextualGroundingPolicyConfigProps](interfaces/ContextualGroundingPolicyConfigProps.md)
5762
- [GuardrailConfiguration](interfaces/GuardrailConfiguration.md)
5863
- [GuardrailProps](interfaces/GuardrailProps.md)
64+
- [IPrompt](interfaces/IPrompt.md)
5965
- [InferenceConfiguration](interfaces/InferenceConfiguration.md)
6066
- [KnowledgeBaseProps](interfaces/KnowledgeBaseProps.md)
6167
- [PromptConfiguration](interfaces/PromptConfiguration.md)
6268
- [PromptOverrideConfiguration](interfaces/PromptOverrideConfiguration.md)
69+
- [PromptProps](interfaces/PromptProps.md)
70+
- [PromptVersionProps](interfaces/PromptVersionProps.md)
6371
- [S3DataSourceProps](interfaces/S3DataSourceProps.md)
6472
- [S3Identifier](interfaces/S3Identifier.md)
6573
- [SensitiveInformationPolicyConfigProps](interfaces/SensitiveInformationPolicyConfigProps.md)
74+
- [TextPromptVariantProps](interfaces/TextPromptVariantProps.md)
6675
- [TopicProps](interfaces/TopicProps.md)
6776

6877
### Functions

0 commit comments

Comments
 (0)