Skip to main content
You can load Graders that have been previously created in the platform automatically using the Grader class from adaptive_harmony.parameters (excluding Recipe Graders, which only exist as code within your custom recipe).

Include Grader in InputConfig

In order to do this, you must only make sure that one or more Grader parameters can be passed to your recipe as input:
from pydantic import Field
from typing import Annotated, Set

from adaptive_harmony.runtime import InputConfig
from adaptive_harmony.parameters import Grader

class GraderRecipeConfig(InputConfig):
    graders: Annotated[
        Set[Grader],
        Field(
            description="The graders to load.",
            title="Graders",
        ),
    ]
The Grader object will contain all the configuration necessary to instantiate a grader in code, with the exact same properties you’ve defined in the Adaptive platform.

Load with Grader.load()

You can then automatically load and setup your graders with await grader.load(ctx):
from adaptive_harmony.runtime import RecipeContext, recipe_main

@recipe_main
async def main(config: GraderRecipeConfig, ctx: RecipeContext):
    graders = []
    for grader_param in config.graders:
        grader = await grader_param.load(ctx)
        graders.append(grader)
Now the Graders are ready to use for training, evaluation, or anything else you find use for!