Skip to main content

Documentation Index

Fetch the complete documentation index at: https://wb-21fd5541-python-sdk-testing.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

*,
event_type: Literal[RUN_METRIC_THRESHOLD, RUN_METRIC_CHANGE, RUN_METRIC_ZSCORE],
scope: wandb.automations.scopes.ProjectScope,
filter: typing.Annotated[wandb.automations.events.RunMetricFilter, Json, BeforeValidator(func=<function ensure_json at 0x108cdcae0>, json_schema_input_type=PydanticUndefined), PlainSerializer(func=<function to_json at 0x106c66a20>, return_type=PydanticUndefined, when_used='always')]

Description

A run metric satisfies a user-defined condition.

Examples:

Define an event that triggers for any run in project “my-project” when the average of the last 5 values of metric “my-metric” exceeds 123.45:
from wandb import Api
from wandb.automations import OnRunMetric, RunEvent

api = Api()
project = api.project(name="my-project")

event = OnRunMetric(
    scope=project,
    filter=RunEvent.metric("my-metric").avg(5).gt(123.45),
)

Args:

  • event_type:
  • scope:
  • filter:

Methods:

construct

copy

Returns a copy of the model. !!! warning “Deprecated” This method is now deprecated; use model_copy instead. If you need include or exclude, use:
data = self.model_dump(include=include, exclude=exclude, round_trip=True)
data = {**data, **(update or {})}
copied = self.model_validate(data)

dict

from_orm

json

model_construct

Creates a new instance of the Model class with validated data. Creates a new model setting __dict__ and __pydantic_fields_set__ from trusted or pre-validated data. Default values are respected, but no other validation is performed. !!! note model_construct() generally respects the model_config.extra setting on the provided model. That is, if model_config.extra == 'allow', then all extra passed values are added to the model instance’s __dict__ and __pydantic_extra__ fields. If model_config.extra == 'ignore' (the default), then all extra passed values are ignored. Because no validation is performed with a call to model_construct(), having model_config.extra == 'forbid' does not result in an error if extra values are passed, but they will be ignored.

model_copy

!!! abstract “Usage Documentation” model_copy Returns a copy of the model. !!! note The underlying instance’s [__dict__][object.dict] attribute is copied. This might have unexpected side effects if you store anything in it, on top of the model fields (e.g. the value of [cached properties][functools.cached_property]).

model_dump

!!! abstract “Usage Documentation” model_dump Generate a dictionary representation of the model, optionally specifying which fields to include or exclude.

model_dump_json

!!! abstract “Usage Documentation” model_dump_json Generates a JSON representation of the model using Pydantic’s to_json method.

model_json_schema

Generates a JSON schema for a model class.

model_parametrized_name

Compute the class name for parametrizations of generic classes. This method can be overridden to achieve a custom naming scheme for generic BaseModels.

model_post_init

Override this method to perform additional initialization after __init__ and model_construct. This is useful if you want to do some validation that requires the entire model to be initialized.

model_rebuild

Try to rebuild the pydantic-core schema for the model. This may be necessary when one of the annotations is a ForwardRef which could not be resolved during the initial attempt to build the schema, and automatic rebuilding fails.

model_validate

Validate a pydantic model instance.

model_validate_json

!!! abstract “Usage Documentation” JSON Parsing Validate the given JSON data against the Pydantic model.

model_validate_strings

Validate the given object with string data against the Pydantic model.

parse_file

parse_obj

parse_raw

schema

schema_json

then

Define a new Automation in which this event triggers the given action.

update_forward_refs

validate