@@ -85,6 +85,9 @@ def _CreateEvaluationMetricParameters_to_vertex(
8585 t .t_metric_for_registry (getv (from_object , ["metric" ])),
8686 )
8787
88+ if getv (from_object , ["encryption_spec" ]) is not None :
89+ setv (to_object , ["encryptionSpec" ], getv (from_object , ["encryption_spec" ]))
90+
8891 if getv (from_object , ["config" ]) is not None :
8992 setv (to_object , ["config" ], getv (from_object , ["config" ]))
9093
@@ -408,6 +411,9 @@ def _EvaluationMetric_from_vertex(
408411 _UnifiedMetric_from_vertex (getv (from_object , ["metric" ]), to_object ),
409412 )
410413
414+ if getv (from_object , ["encryptionSpec" ]) is not None :
415+ setv (to_object , ["encryption_spec" ], getv (from_object , ["encryptionSpec" ]))
416+
411417 return to_object
412418
413419
@@ -1226,6 +1232,7 @@ def _create_evaluation_metric(
12261232 display_name : Optional [str ] = None ,
12271233 description : Optional [str ] = None ,
12281234 metric : Optional [types .MetricOrDict ] = None ,
1235+ encryption_spec : Optional [genai_types .EncryptionSpecOrDict ] = None ,
12291236 config : Optional [types .CreateEvaluationMetricConfigOrDict ] = None ,
12301237 ) -> types .EvaluationMetric :
12311238 """
@@ -1236,6 +1243,7 @@ def _create_evaluation_metric(
12361243 display_name = display_name ,
12371244 description = description ,
12381245 metric = metric ,
1246+ encryption_spec = encryption_spec ,
12391247 config = config ,
12401248 )
12411249
@@ -3160,9 +3168,22 @@ def create_evaluation_metric(
31603168 display_name : Optional [str ] = None ,
31613169 description : Optional [str ] = None ,
31623170 metric : Optional [types .MetricOrDict ] = None ,
3171+ encryption_spec : Optional [genai_types .EncryptionSpecOrDict ] = None ,
31633172 config : Optional [types .CreateEvaluationMetricConfigOrDict ] = None ,
31643173 ) -> str :
3165- """Creates an EvaluationMetric."""
3174+ """Creates an EvaluationMetric.
3175+
3176+ Args:
3177+ display_name: The display name of the EvaluationMetric.
3178+ description: The description of the EvaluationMetric.
3179+ metric: The metric configuration.
3180+ encryption_spec: Customer-managed encryption key spec. If set, this
3181+ EvaluationMetric will be secured by the provided key.
3182+ config: Optional configuration for the request.
3183+
3184+ Returns:
3185+ The resource name of the created EvaluationMetric.
3186+ """
31663187 if metric and not isinstance (metric , dict ):
31673188 # metric is now Metric | LazyLoadedPrebuiltMetric (RubricMetric)
31683189 # Mypy correctly narrows the type here, so cast is not needed.
@@ -3182,6 +3203,7 @@ def create_evaluation_metric(
31823203 display_name = display_name ,
31833204 description = description ,
31843205 metric = metric ,
3206+ encryption_spec = encryption_spec ,
31853207 config = config ,
31863208 )
31873209 # result.name is Optional[str], but we know it's always returned on creation
@@ -3776,6 +3798,7 @@ async def _create_evaluation_metric(
37763798 display_name : Optional [str ] = None ,
37773799 description : Optional [str ] = None ,
37783800 metric : Optional [types .MetricOrDict ] = None ,
3801+ encryption_spec : Optional [genai_types .EncryptionSpecOrDict ] = None ,
37793802 config : Optional [types .CreateEvaluationMetricConfigOrDict ] = None ,
37803803 ) -> types .EvaluationMetric :
37813804 """
@@ -3786,6 +3809,7 @@ async def _create_evaluation_metric(
37863809 display_name = display_name ,
37873810 description = description ,
37883811 metric = metric ,
3812+ encryption_spec = encryption_spec ,
37893813 config = config ,
37903814 )
37913815
@@ -5361,9 +5385,22 @@ async def create_evaluation_metric(
53615385 display_name : Optional [str ] = None ,
53625386 description : Optional [str ] = None ,
53635387 metric : Optional [types .MetricOrDict ] = None ,
5388+ encryption_spec : Optional [genai_types .EncryptionSpecOrDict ] = None ,
53645389 config : Optional [types .CreateEvaluationMetricConfigOrDict ] = None ,
53655390 ) -> str :
5366- """Creates an EvaluationMetric."""
5391+ """Creates an EvaluationMetric.
5392+
5393+ Args:
5394+ display_name: The display name of the EvaluationMetric.
5395+ description: The description of the EvaluationMetric.
5396+ metric: The metric configuration.
5397+ encryption_spec: Customer-managed encryption key spec. If set, this
5398+ EvaluationMetric will be secured by the provided key.
5399+ config: Optional configuration for the request.
5400+
5401+ Returns:
5402+ The resource name of the created EvaluationMetric.
5403+ """
53675404 if metric and not isinstance (metric , dict ):
53685405 resolved_metrics = _evals_common ._resolve_metrics (
53695406 [metric ], self ._api_client
@@ -5381,6 +5418,7 @@ async def create_evaluation_metric(
53815418 display_name = display_name ,
53825419 description = description ,
53835420 metric = metric ,
5421+ encryption_spec = encryption_spec ,
53845422 config = config ,
53855423 )
53865424 return cast (str , result .name )
0 commit comments