Skip to content

Commit e5ad207

Browse files
feat: Get Prompts from File
1 parent 3b1c3d5 commit e5ad207

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/cdk/resources/BedrockPromptSettings.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ export class BedrockPromptSettings extends Construct {
6363
: { text: string; filename: string } {
6464
// Read all files in the folder
6565
const files = fs
66-
.readdirSync("../../../prompts")
67-
.filter(f => f.startsWith(`${type}_v`) && f.endsWith(".txt"))
66+
.readdirSync(`${process.cwd()}/prompts`)
6867

6968
if (files.length === 0) {
7069
throw new Error("No variant files found in the folder.")
@@ -76,7 +75,7 @@ export class BedrockPromptSettings extends Construct {
7675
throw new Error(`No prompt file found for type: ${type}`)
7776
}
7877

79-
const text = fs.readFileSync(file, "utf-8")
78+
const text = fs.readFileSync(`${process.cwd()}/prompts/${file}`, "utf-8")
8079

8180
return {text, filename: file}
8281
}

0 commit comments

Comments
 (0)