Skip to content

Commit 5dd4dc0

Browse files
feat: Get Prompts from File via Directory
1 parent e5ad207 commit 5dd4dc0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/cdk/resources/BedrockPromptSettings.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,10 @@ export class BedrockPromptSettings extends Construct {
6161
*/
6262
private getTypedPrompt(type: BedrockPromptSettingsType)
6363
: { text: string; filename: string } {
64-
// Read all files in the folder
64+
// Read all files in the folder)
65+
const path = __dirname + "/../../../prompts"
6566
const files = fs
66-
.readdirSync(`${process.cwd()}/prompts`)
67+
.readdirSync(path)
6768

6869
if (files.length === 0) {
6970
throw new Error("No variant files found in the folder.")
@@ -75,7 +76,7 @@ export class BedrockPromptSettings extends Construct {
7576
throw new Error(`No prompt file found for type: ${type}`)
7677
}
7778

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

8081
return {text, filename: file}
8182
}

0 commit comments

Comments
 (0)