Class PointwiseMetric (1.71.0)

PointwiseMetric(
    *,
    metric: str,
    metric_prompt_template: typing.Union[
        vertexai.evaluation.metrics.metric_prompt_template.PointwiseMetricPromptTemplate,
        str,
    ]
)

A Model-based Pointwise Metric.

A model-based evaluation metric that evaluate a single generative model's response.

For more details on when to use model-based pointwise metrics, see Evaluation methods and metrics.

Usage Examples:

```
candidate_model = GenerativeModel("gemini-1.5-pro")
eval_dataset = pd.DataFrame({
    "prompt"  : [...],
})
fluency_metric = PointwiseMetric(
    metric="fluency",
    metric_prompt_template=MetricPromptTemplateExamples.get_prompt_template('fluency'),
)
pointwise_eval_task = EvalTask(
    dataset=eval_dataset,
    metrics=[
        fluency_metric,
        MetricPromptTemplateExamples.Pointwise.GROUNDEDNESS,
    ],
)
pointwise_result = pointwise_eval_task.evaluate(
    model=candidate_model,
)
```

Methods

PointwiseMetric

PointwiseMetric(
    *,
    metric: str,
    metric_prompt_template: typing.Union[
        vertexai.evaluation.metrics.metric_prompt_template.PointwiseMetricPromptTemplate,
        str,
    ]
)

Initializes a pointwise evaluation metric.