@@ -22,6 +22,7 @@ const LLM_STEPS: AddEvaluatorStep[] = [
2222 'model' ,
2323 'instructions' ,
2424 'ratingScale' ,
25+ 'kms-key-arn' ,
2526 'confirm' ,
2627] ;
2728const CODE_MANAGED_STEPS : AddEvaluatorStep [ ] = [
@@ -30,6 +31,7 @@ const CODE_MANAGED_STEPS: AddEvaluatorStep[] = [
3031 'name' ,
3132 'level' ,
3233 'timeout' ,
34+ 'kms-key-arn' ,
3335 'confirm' ,
3436] ;
3537const CODE_EXTERNAL_STEPS : AddEvaluatorStep [ ] = [
@@ -38,6 +40,7 @@ const CODE_EXTERNAL_STEPS: AddEvaluatorStep[] = [
3840 'name' ,
3941 'level' ,
4042 'lambda-arn' ,
43+ 'kms-key-arn' ,
4144 'confirm' ,
4245] ;
4346
@@ -80,6 +83,7 @@ export function useAddEvaluatorWizard() {
8083 const [ lambdaArn , setLambdaArnState ] = useState ( '' ) ;
8184 const [ timeout , setTimeoutState ] = useState ( DEFAULT_CODE_TIMEOUT ) ;
8285 const [ customRatingScaleType , setCustomRatingScaleType ] = useState < CustomRatingScaleType > ( 'numerical' ) ;
86+ const [ kmsKeyArn , setKmsKeyArnState ] = useState ( '' ) ;
8387 const [ step , setStep ] = useState < AddEvaluatorStep > ( 'evaluator-type' ) ;
8488
8589 const steps = useMemo ( ( ) => getSteps ( evaluatorType , codeBasedType ) , [ evaluatorType , codeBasedType ] ) ;
@@ -109,11 +113,13 @@ export function useAddEvaluatorWizard() {
109113
110114 // Build the final config based on current state
111115 const config : AddEvaluatorConfig = useMemo ( ( ) => {
116+ const kms = kmsKeyArn || undefined ;
112117 if ( evaluatorType === 'llm-as-a-judge' ) {
113118 return {
114119 name,
115120 level,
116121 config : { llmAsAJudge : llmConfig } ,
122+ ...( kms && { kmsKeyArn : kms } ) ,
117123 } ;
118124 }
119125
@@ -126,6 +132,7 @@ export function useAddEvaluatorWizard() {
126132 external : { lambdaArn } ,
127133 } ,
128134 } ,
135+ ...( kms && { kmsKeyArn : kms } ) ,
129136 } ;
130137 }
131138
@@ -143,8 +150,9 @@ export function useAddEvaluatorWizard() {
143150 } ,
144151 } ,
145152 } ,
153+ ...( kms && { kmsKeyArn : kms } ) ,
146154 } ;
147- } , [ evaluatorType , codeBasedType , name , level , llmConfig , lambdaArn , timeout ] ) ;
155+ } , [ evaluatorType , codeBasedType , name , level , llmConfig , lambdaArn , timeout , kmsKeyArn ] ) ;
148156
149157 const selectEvaluatorType = useCallback ( ( type : EvaluatorTypeId ) => {
150158 setEvaluatorType ( type ) ;
@@ -256,6 +264,15 @@ export function useAddEvaluatorWizard() {
256264 [ nextStep ]
257265 ) ;
258266
267+ const setKmsKeyArn = useCallback (
268+ ( arn : string ) => {
269+ setKmsKeyArnState ( arn ) ;
270+ const next = nextStep ( 'kms-key-arn' ) ;
271+ if ( next ) setStep ( next ) ;
272+ } ,
273+ [ nextStep ]
274+ ) ;
275+
259276 const reset = useCallback ( ( ) => {
260277 setEvaluatorType ( 'code-based' ) ;
261278 setCodeBasedType ( 'managed' ) ;
@@ -264,6 +281,7 @@ export function useAddEvaluatorWizard() {
264281 setLlmConfig ( getDefaultLlmConfig ( ) . llmAsAJudge ! ) ;
265282 setLambdaArnState ( '' ) ;
266283 setTimeoutState ( DEFAULT_CODE_TIMEOUT ) ;
284+ setKmsKeyArnState ( '' ) ;
267285 setStep ( 'evaluator-type' ) ;
268286 } , [ ] ) ;
269287
@@ -288,6 +306,7 @@ export function useAddEvaluatorWizard() {
288306 setCustomRatingScale,
289307 setLambdaArn,
290308 setTimeout,
309+ setKmsKeyArn,
291310 reset,
292311 } ;
293312}
0 commit comments