Experimental
@aws-cdk/aws-bedrock-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.
PromptOverrideConfiguration Class
Configuration for overriding prompt templates and behaviors in different parts of an agent's sequence.
This allows customizing how the agent processes inputs, makes decisions, and generates responses.
Example
ts
const agent = new bedrock.Agent(this, 'Agent', {
foundationModel: bedrock.BedrockFoundationModel.AMAZON_NOVA_LITE_V1,
instruction: 'You are a helpful assistant.',
promptOverrideConfiguration: bedrock.PromptOverrideConfiguration.fromSteps([
{
stepType: bedrock.AgentStepType.ROUTING_CLASSIFIER,
stepEnabled: true,
customPromptTemplate: 'Your routing template here',
foundationModel: bedrock.BedrockFoundationModel.ANTHROPIC_CLAUDE_V2
} as bedrock.PromptRoutingClassifierConfigCustomParser
])
});
Properties
knowledgeBaseResponseGenerationStepmay be undefinedPromptKnowledgeBaseResponseGenerationConfigCustomParserknowledge_base_response_generation_stepmay be undefinedPromptKnowledgeBaseResponseGenerationConfigCustomParserknowledgeBaseResponseGenerationStepmay be undefinedPromptKnowledgeBaseResponseGenerationConfigCustomParserKnowledgeBaseResponseGenerationStepmay be undefinedPromptKnowledgeBaseResponseGenerationConfigCustomParserKnowledgeBaseResponseGenerationStepmay be undefinedPromptKnowledgeBaseResponseGenerationConfigCustomParser#Configuration for the knowledge base response generation step.
memorySummarizationStepmay be undefinedPromptMemorySummarizationConfigCustomParsermemory_summarization_stepmay be undefinedPromptMemorySummarizationConfigCustomParsermemorySummarizationStepmay be undefinedPromptMemorySummarizationConfigCustomParserMemorySummarizationStepmay be undefinedPromptMemorySummarizationConfigCustomParserMemorySummarizationStepmay be undefinedPromptMemorySummarizationConfigCustomParser#Configuration for the memory summarization step.
orchestrationStepmay be undefinedPromptOrchestrationConfigCustomParserorchestration_stepmay be undefinedPromptOrchestrationConfigCustomParserorchestrationStepmay be undefinedPromptOrchestrationConfigCustomParserOrchestrationStepmay be undefinedPromptOrchestrationConfigCustomParserOrchestrationStepmay be undefinedPromptOrchestrationConfigCustomParser#Configuration for the orchestration step.
parsermay be undefinedIFunctionparsermay be undefinedIFunctionparsermay be undefinedIFunctionParsermay be undefinedIFunctionParsermay be undefinedIFunction#The custom Lambda parser function to use.
notes
The Lambda parser processes and interprets the raw foundation model output. It receives an input event with:
- messageVersion: Version of message format (1.0)
- agent: Info about the agent (name, id, alias, version)
- invokeModelRawResponse: Raw model output to parse
- promptType: Type of prompt being parsed
- overrideType: Type of override (OUTPUT_PARSER)
The Lambda must return a response that the agent uses for next actions.
postProcessingStepmay be undefinedPromptPostProcessingConfigCustomParserpost_processing_stepmay be undefinedPromptPostProcessingConfigCustomParserpostProcessingStepmay be undefinedPromptPostProcessingConfigCustomParserPostProcessingStepmay be undefinedPromptPostProcessingConfigCustomParserPostProcessingStepmay be undefinedPromptPostProcessingConfigCustomParser#Configuration for the post-processing step.
preProcessingStepmay be undefinedPromptPreProcessingConfigCustomParserpre_processing_stepmay be undefinedPromptPreProcessingConfigCustomParserpreProcessingStepmay be undefinedPromptPreProcessingConfigCustomParserPreProcessingStepmay be undefinedPromptPreProcessingConfigCustomParserPreProcessingStepmay be undefinedPromptPreProcessingConfigCustomParser#Configuration for the pre-processing step.
routingClassifierStepmay be undefinedPromptRoutingClassifierConfigCustomParserrouting_classifier_stepmay be undefinedPromptRoutingClassifierConfigCustomParserroutingClassifierStepmay be undefinedPromptRoutingClassifierConfigCustomParserRoutingClassifierStepmay be undefinedPromptRoutingClassifierConfigCustomParserRoutingClassifierStepmay be undefinedPromptRoutingClassifierConfigCustomParser#Configuration for the routing classifier step.
Methods
fromSteps(steps: PromptStepConfigBase[]): PromptOverrideConfiguration // chainable@staticmethod def from_steps(steps: typing.List[PromptStepConfigBase]) -> PromptOverrideConfigurationpublic static PromptOverrideConfiguration fromSteps(List<PromptStepConfigBase> steps)public static PromptOverrideConfiguration FromSteps(PromptStepConfigBase[] steps)func FromSteps(Steps *[]PromptStepConfigBase) PromptOverrideConfigurationstatic#Creates a PromptOverrideConfiguration from individual step configurations.
Use this method when you want to override prompts without using a custom parser.
1 parameter · returns
Parameters
stepsstepsstepsstepsSteps— The step configurations to use.
Returns: A new PromptOverrideConfiguration instance
withCustomParser(props: CustomParserProps): PromptOverrideConfiguration // chainable@staticmethod def with_custom_parser(props: CustomParserProps) -> PromptOverrideConfigurationpublic static PromptOverrideConfiguration withCustomParser(CustomParserProps props)public static PromptOverrideConfiguration WithCustomParser(CustomParserProps props)func WithCustomParser(Props CustomParserProps) PromptOverrideConfigurationstatic#Creates a PromptOverrideConfiguration with a custom Lambda parser function.
1 parameter
Parameters
propspropspropspropsProps— Configuration including: -parser: Lambda function to use as custom parser - Individual step configurations.