Skip to content

Commit 88b38b1

Browse files
chore: removes hardcoded text value
1 parent 782b3e7 commit 88b38b1

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

packages/cdk/resources/BedrockPromptResources.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ export interface BedrockPromptResourcesProps {
1414
export class BedrockPromptResources extends Construct {
1515
public readonly queryReformulationPrompt: Prompt
1616
public readonly ragResponsePrompt: Prompt
17+
public readonly ragModelId: string
18+
public readonly queryReformulationModelId: string
1719

1820
constructor(scope: Construct, id: string, props: BedrockPromptResourcesProps) {
1921
super(scope, id)
@@ -56,6 +58,10 @@ export class BedrockPromptResources extends Construct {
5658
variants: [ragResponsePromptVariant]
5759
})
5860

61+
// expose model IDs for use in Lambda environment variables
62+
this.ragModelId = novaProModel.modelId
63+
this.queryReformulationModelId = novaLiteModel.modelId
64+
5965
this.queryReformulationPrompt = queryReformulationPrompt
6066
this.ragResponsePrompt = ragPrompt
6167
}

packages/cdk/resources/Functions.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@ import {StringParameter} from "aws-cdk-lib/aws-ssm"
55
import {Secret} from "aws-cdk-lib/aws-secretsmanager"
66
import {TableV2} from "aws-cdk-lib/aws-dynamodb"
77

8-
// Claude model for RAG responses
9-
const RAG_MODEL_ID = "anthropic.claude-3-sonnet-20240229-v1:0"
10-
// Claude model for query reformulation
11-
const QUERY_REFORMULATION_MODEL_ID = "anthropic.claude-3-haiku-20240307-v1:0"
128
const BEDROCK_KB_DATA_SOURCE = "eps-assist-kb-ds"
139
const LAMBDA_MEMORY_SIZE = "265"
1410

@@ -38,6 +34,8 @@ export interface FunctionsProps {
3834
readonly ragResponsePromptVersion: string
3935
readonly isPullRequest: boolean
4036
readonly mainSlackBotLambdaExecutionRoleArn : string
37+
readonly ragModelId: string
38+
readonly queryReformulationModelId: string
4139
}
4240

4341
export class Functions extends Construct {
@@ -58,8 +56,8 @@ export class Functions extends Construct {
5856
additionalPolicies: [props.slackBotManagedPolicy],
5957
dependencyLocation: ".dependencies/slackBotFunction",
6058
environmentVariables: {
61-
"RAG_MODEL_ID": RAG_MODEL_ID,
62-
"QUERY_REFORMULATION_MODEL_ID": QUERY_REFORMULATION_MODEL_ID,
59+
"RAG_MODEL_ID": props.ragModelId,
60+
"QUERY_REFORMULATION_MODEL_ID": props.queryReformulationModelId,
6361
"KNOWLEDGEBASE_ID": props.knowledgeBaseId,
6462
"BEDROCK_KB_DATA_SOURCE": BEDROCK_KB_DATA_SOURCE,
6563
"LAMBDA_MEMORY_SIZE": LAMBDA_MEMORY_SIZE,

packages/cdk/stacks/EpsAssistMeStack.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ export class EpsAssistMeStack extends Stack {
157157
ragResponsePromptName: bedrockPromptResources.ragResponsePrompt.promptName,
158158
reformulationPromptVersion: bedrockPromptResources.queryReformulationPrompt.promptVersion,
159159
ragResponsePromptVersion: bedrockPromptResources.ragResponsePrompt.promptVersion,
160+
ragModelId: bedrockPromptResources.ragModelId,
161+
queryReformulationModelId: bedrockPromptResources.queryReformulationModelId,
160162
isPullRequest: isPullRequest,
161163
mainSlackBotLambdaExecutionRoleArn: mainSlackBotLambdaExecutionRoleArn
162164
})

0 commit comments

Comments
 (0)