Skip to content

Commit

Permalink
added setup CLI option for Kendra Enterprise
Browse files Browse the repository at this point in the history
  • Loading branch information
kmanuwai authored and bigadsoleiman committed Jan 15, 2024
1 parent 4e59d88 commit dda6e4e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
17 changes: 16 additions & 1 deletion cli/magic-create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ const embeddingModels = [
(m: any) => m.default
)[0].name;
options.kendraExternal = config.rag.engines.kendra.external;
options.kendraEnterprise = config.rag.engines.kendra.enterprise;
}
try {
await processCreateOptions(options);
Expand Down Expand Up @@ -208,6 +209,17 @@ async function processCreateOptions(options: any): Promise<void> {
return !(this as any).state.answers.enableRag;
},
},
{
type: "confirm",
name: "kendraEnterprise",
message: "Do you want to enable Kendra Enterprise Edition?",
initial:
options.kendraEnterprise ||
false,
skip(): boolean {
return !(this as any).state.answers.ragsToEnable.includes("kendra");
},
},
];
const answers: any = await enquirer.prompt(questions);
console.log(answers);
Expand Down Expand Up @@ -324,6 +336,7 @@ async function processCreateOptions(options: any): Promise<void> {
enabled: false,
createIndex: false,
external: [{}],
enterprise: false
},
},
embeddingsModels: [{}],
Expand Down Expand Up @@ -353,6 +366,8 @@ async function processCreateOptions(options: any): Promise<void> {
config.rag.engines.kendra.enabled =
config.rag.engines.kendra.createIndex || kendraExternal.length > 0;
config.rag.engines.kendra.external = [...kendraExternal];
config.rag.engines.kendra.enterprise =
answers.kendraEnterprise

console.log("\n✨ This is the chosen configuration:\n");
console.log(JSON.stringify(config, undefined, 2));
Expand All @@ -368,4 +383,4 @@ async function processCreateOptions(options: any): Promise<void> {
).create
? createConfig(config)
: console.log("Skipping");
}
}
2 changes: 1 addition & 1 deletion lib/rag-engines/kendra-retrieval/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class KendraRetrieval extends Construct {
dataBucket.grantRead(kendraRole);

const kendraIndex = new kendra.CfnIndex(this, "Index", {
edition: "DEVELOPER_EDITION",
edition: props.config.rag?.engines.kendra?.enterprise ? "ENTERPRISE_EDITION" : "DEVELOPER_EDITION",
name: indexName,
roleArn: kendraRole.roleArn,
documentMetadataConfigurations: [
Expand Down
1 change: 1 addition & 0 deletions lib/shared/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export interface SystemConfig {
region?: SupportedRegion;
roleArn?: string;
}[];
enterprise?: boolean;
};
};
embeddingsModels: {
Expand Down

0 comments on commit dda6e4e

Please sign in to comment.