Class Metric (1.130.0)

  Metric 
 ( 
 * 
 , 
 name 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 customFunction 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Callable 
 [[ 
 ... 
 ], 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 promptTemplate 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 judgeModel 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 judgeModelGenerationConfig 
 : 
 typing 
 . 
 Optional 
 [ 
 google 
 . 
 genai 
 . 
 types 
 . 
 GenerationConfig 
 ] 
 = 
 None 
 , 
 judgeModelSamplingCount 
 : 
 typing 
 . 
 Optional 
 [ 
 int 
 ] 
 = 
 None 
 , 
 judgeModelSystemInstruction 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 returnRawOutput 
 : 
 typing 
 . 
 Optional 
 [ 
 bool 
 ] 
 = 
 None 
 , 
 parseAndReduceFn 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Callable 
 [[ 
 ... 
 ], 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 aggregateSummaryFn 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Callable 
 [[ 
 ... 
 ], 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 rubricGroupName 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 metricSpecParameters 
 : 
 typing 
 . 
 Optional 
 [ 
 dict 
 [ 
 str 
 , 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 ** 
 extra_data 
 : 
 typing 
 . 
 Any 
 ) 
 

The metric used for evaluation.

Methods

Metric

  Metric 
 ( 
 * 
 , 
 name 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 customFunction 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Callable 
 [[ 
 ... 
 ], 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 promptTemplate 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 judgeModel 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 judgeModelGenerationConfig 
 : 
 typing 
 . 
 Optional 
 [ 
 google 
 . 
 genai 
 . 
 types 
 . 
 GenerationConfig 
 ] 
 = 
 None 
 , 
 judgeModelSamplingCount 
 : 
 typing 
 . 
 Optional 
 [ 
 int 
 ] 
 = 
 None 
 , 
 judgeModelSystemInstruction 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 returnRawOutput 
 : 
 typing 
 . 
 Optional 
 [ 
 bool 
 ] 
 = 
 None 
 , 
 parseAndReduceFn 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Callable 
 [[ 
 ... 
 ], 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 aggregateSummaryFn 
 : 
 typing 
 . 
 Optional 
 [ 
 typing 
 . 
 Callable 
 [[ 
 ... 
 ], 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 rubricGroupName 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 , 
 metricSpecParameters 
 : 
 typing 
 . 
 Optional 
 [ 
 dict 
 [ 
 str 
 , 
 typing 
 . 
 Any 
 ]] 
 = 
 None 
 , 
 ** 
 extra_data 
 : 
 typing 
 . 
 Any 
 ) 
 

Create a new model by parsing and validating input data from keyword arguments.

Raises [ ValidationError ][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

model_post_init

  model_post_init 
 ( 
 context 
 : 
 Any 
 , 
 / 
 ) 
 - 
> None 
 

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that's what pydantic-core passes when calling it.

to_yaml_file

  to_yaml_file 
 ( 
 file_path 
 : 
 str 
 , 
 version 
 : 
 typing 
 . 
 Optional 
 [ 
 str 
 ] 
 = 
 None 
 ) 
 - 
> None 
 

Dumps the metric object to a YAML file.

Exceptions
Type
Description
ImportError
If the pyyaml library is not installed.

validate_name

  validate_name 
 ( 
 model 
 : 
 vertexai 
 . 
 _genai 
 . 
 types 
 . 
 common 
 . 
 Metric 
 , 
 ) 
 - 
> vertexai 
 . 
 _genai 
 . 
 types 
 . 
 common 
 . 
 Metric 
 

API documentation for validate_name method.

Design a Mobile Site
View Site in Mobile | Classic
Share by: