How to add Metrics to the GenAI Model?

This section describes how to add a new metric to the model.

First navigate to model overview, click on "Model Management" dropdown, and then click "Metric":

This will open the model metrics page:

If model has default rules they're not editable here:

You can add a new metric by clicking "+ Metric" button. This will open the form to create a new metric:

In the form enter the following:

  1. A name for the metric.
  2. Metric type.

There are multiple metric types:

  • Toxicity, which is measuring toxicity in generated content. See the guide Toxicity.
  • PII, which is detecting personally identifiable information.
  • Sensitive Data, which is detecting potential sensitive data in model inputs/outputs. See the guide Sensitive Data Leakage.
  • Prompt Injection, which is detecting potential prompt injection attempts.See the guide Prompt Injection.
  • Hallucination, enhanced detection of model hallucination. See the guide Hallucination.
  • Keyword, which is detecting specific terms, applied by user.
  • Regex, which is detecting specific patterns, applied by user.

Toxicity

Apart from name, the only thing needed to be configured is threshold. You can do it by toggle, or by typing in the input on the right side manually:

Metric can be applied to both prompt and response.

PII

Apart from name, you can select from the list which PII data should be detected, and which shouldn't:

Metric can be applied to both prompt and response.

Sensitive Data

Apart from name, you can enter multiple data and assign it as being sensitive ,or not (true/false):

Metric can be applied only to prompt.

Prompt Injection

Metric can be applied only to prompt.

Hallucination

Metric can be applied only to response.

Keyword

Apart from name, enter keywords that should be detected:

Metric can be applied to both prompt and response.

Regex

Apart from name, enter specific regex you want to use:

Metric can be applied to both prompt and response.


All added metrics will be visible here:

At this point all added metrics will be enabled, as long as they won't be saved first:

It's possible to remove, or edit every added metric:

Finally when everything is configured as intended click "Save" button. Saving it will allow you to disable/enable by toggle on the left side of added metrics if needed.