The unify.Experiment class is a very simple convenience class for logging experiments. It simply creates a parameter with the name "experiment", and automatically increments the value as an ascending integer for each new experiment, if an explicit name is not provided.

with unify.Experiment(), unify.Params(
    sys_msg="You are a helpful assistant."
):
    for _ in range(5):
        unify.log(
            question_number=random.randint(1, 20),
            score=random.random()
        )

This will show in the table like so:

Let’s run another experiment, but give it an explicit name.

with unify.Experiment("my_experiment"), unify.Params(
    sys_msg="You are a helpful assistant."
):
    for _ in range(5):
        unify.log(
            question_number=random.randint(1, 20),
            score=random.random()
        )

This will show in the table like so:

You can also use negative indexing, and the overwrite argument. For example, the following will overwrite the previous experiment. Integers are interpreted as the experiment version, and strings are interpreted as the experiment name.

with unify.Experiment(-1, overwrite=True), unify.Params(
    sys_msg="You are a helpful assistant."
):
    for _ in range(5):
        unify.log(
            question_number=random.randint(1, 20),
            score=random.random()
        )

The overwrite can be seen in the table, after pressing the refresh button: