Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9559,13 +9559,12 @@ class Metric(_common.BaseModel):
_version: Optional[str] = PrivateAttr(default=None)
"""An optional string indicating the version of the metric."""

@model_validator(mode='after') # type: ignore[arg-type]
@classmethod
def validate_name(cls, model: 'Metric') -> 'Metric':
if not model.name:
@model_validator(mode='after')
def validate_name(self) -> Self:
if not self.name:
raise ValueError('Metric name cannot be empty.')
model.name = model.name.lower()
return model
self.name = self.name.lower()
return self

def to_yaml_file(self, file_path: str, version: Optional[str] = None) -> None:
"""Dumps the metric object to a YAML file.
Expand Down