@@ -21,14 +21,12 @@ export class BedrockPromptResources extends Construct {
2121 constructor ( scope : Construct , id : string , props : BedrockPromptResourcesProps ) {
2222 super ( scope , id )
2323
24- // Gemma 3 Pro is for RAG response generation, balancing cost-efficiency with high-reasoning capabilities
25- const novaProModel = new BedrockFoundationModel ( "google.gemma-3-27b-it" )
26- // Nova Lite is recommended for tasks
27- const novaLiteModel = BedrockFoundationModel . AMAZON_NOVA_LITE_V1
24+ const ragModel = new BedrockFoundationModel ( "google.gemma-3-27b-it" )
25+ const reformulationModel = BedrockFoundationModel . AMAZON_NOVA_LITE_V1
2826
2927 const queryReformulationPromptVariant = PromptVariant . text ( {
3028 variantName : "default" ,
31- model : novaLiteModel ,
29+ model : reformulationModel ,
3230 promptVariables : [ "topic" ] ,
3331 promptText : props . settings . reformulationPrompt . text
3432 } )
@@ -42,7 +40,7 @@ export class BedrockPromptResources extends Construct {
4240
4341 const ragResponsePromptVariant = PromptVariant . chat ( {
4442 variantName : "default" ,
45- model : novaProModel ,
43+ model : ragModel ,
4644 promptVariables : [ "query" , "search_results" ] ,
4745 system : props . settings . systemPrompt . text ,
4846 messages : [ props . settings . userPrompt ]
@@ -59,11 +57,32 @@ export class BedrockPromptResources extends Construct {
5957 variants : [ ragResponsePromptVariant ]
6058 } )
6159
60+ const ragOrchestratingResponsePromptVariant = PromptVariant . chat ( {
61+ variantName : "default" ,
62+ model : ragModel ,
63+ promptVariables : [ "query" , "search_results" ] ,
64+ system : props . settings . orchestrationPrompt . text ,
65+ messages : [ props . settings . userPrompt ]
66+ } )
67+
68+ ragOrchestratingResponsePromptVariant . inferenceConfiguration = {
69+ text : props . settings . inferenceConfig
70+ }
71+
72+ const ragOrchestrationPrompt = new Prompt ( this , "ragOrchestrationPrompt" , {
73+ promptName : `${ props . stackName } -ragOrchestration` ,
74+ description : "Prompt for orchestrating RAG responses with knowledge base context and system instructions" ,
75+ defaultVariant : ragOrchestratingResponsePromptVariant ,
76+ variants : [ ragOrchestratingResponsePromptVariant ]
77+ } )
78+
6279 // expose model IDs for use in Lambda environment variables
63- this . ragModelId = novaProModel . modelId
64- this . queryReformulationModelId = novaLiteModel . modelId
80+ this . ragModelId = ragModel . modelId
81+ this . queryReformulationModelId = reformulationModel . modelId
6582
66- this . queryReformulationPrompt = queryReformulationPrompt
6783 this . ragResponsePrompt = ragPrompt
84+ this . queryReformulationPrompt = queryReformulationPrompt
85+
86+ this . ragOrchestrationPrompt = ragOrchestrationPrompt
6887 }
6988}
0 commit comments