Skip to content

Commit

Permalink
feat: Add a warning message for scheduled deprecation of Coherence me…
Browse files Browse the repository at this point in the history
…tric class

PiperOrigin-RevId: 658500900
  • Loading branch information
vertex-sdk-bot authored and copybara-github committed Aug 1, 2024
1 parent cff8ae0 commit 7f238fb
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions vertexai/preview/evaluation/metrics/_coherence.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,25 @@
# limitations under the License.
#
from typing import Optional
import warnings

from vertexai.preview.evaluation import constants
from vertexai.preview.evaluation.metrics import _base

_DEPRECATION_WARNING_MESSAGE = (
"After google-cloud-aiplatform>1.63.0, using metric class `Coherence` will"
" result in an error. Please use string metric name `coherence` or define"
" a PointwiseMetric instead."
)


class Coherence(_base._ModelBasedMetric):
"""The model-based pointwise metric for Coherence."""

_metric_name = constants.Metric.COHERENCE

def __init__(self, *, version: Optional[int] = None):
warnings.warn(message=_DEPRECATION_WARNING_MESSAGE)
super().__init__(
metric=Coherence._metric_name,
version=version,
Expand Down

0 comments on commit 7f238fb

Please sign in to comment.