
    ci\              
       f    d Z ddlmZ ddlmZ ddlmZ ddlmZ 	 dde	d   d	e
d
e	eeef      fdZy)z&Transformers module for Vertex addons.    )Any)get_value_by_path   )_evals_constant)typesmetricsztypes.MetricSubclassset_default_aggregation_metricsreturnc                 r   g }| D ].  }i }t        |dg      j                         }|rddg|d<   |dk(  ri |d<   n|dk(  ri |d<   n|j                  d	      r|j                  d
d      }d|i|d<   n|t        j
                  v r||j                  d|d<   nt        |d      r|j                  rd|j                  i|d<   ndt        |d      rJ|j                  r>d|j                  i}t        |dg      }|r||d<   t        |dg      }	|	rd|	i|d<   ||d<   nt        d|       |j                  |       1 |S )a(  Prepares the metric payload for the evaluation request.

    Args:
        metrics: A list of metrics used for evaluation.
        set_default_aggregation_metrics: Whether to set default aggregation metrics.
    Returns:
        A list of resolved metric payloads for the evaluation request.
    nameAVERAGESTANDARD_DEVIATIONaggregation_metricsexact_matchexact_match_specbleu	bleu_specrouge_ 
rouge_type
rouge_spec)metric_spec_namemetric_spec_parameterspredefined_metric_specremote_custom_functionevaluation_functioncustom_code_execution_specprompt_templatemetric_prompt_templatejudge_model_system_instructionsystem_instructionreturn_raw_outputcustom_output_format_configpointwise_metric_specz0Unsupported metric type or invalid metric name: )getvlower
startswithreplacer   SUPPORTED_PREDEFINED_METRICSr   hasattrr   r   
ValueErrorappend)
r   r	   metrics_payloadmetricmetric_payload_itemmetric_namer   pointwise_specr"   r#   s
             D/tmp/pip-target-z3e9_cxr/lib/python/vertexai/_genai/_transformers.py	t_metricsr4      s    O /4.06F8,224*$: 56
 -'68 23F"/1,##G,$,,S"5J1=z0J-OHHH$/*0*G*G= 89 F45&:W:W &v'D'DA <= V./F4J4J68N8NON!%f/O.P!Q!7I34 $V.A-B C '):A<= <J 78B;-P  	23_/4`     N)F)__doc__typingr   google.genai._commonr   r&   r   r   r   listbooldictstrr4    r5   r3   <module>r>      sM     -  :  
 -2>()>%)> 
$sCx.>r5   