Skip to content

ProgramCalls metric

Bases: ProgramOperationalMetric

Number of top-level program invocations during this run.

One increment per call to program(...), regardless of how many LM or EM calls the program makes internally.

Example:

program.compile(
    metrics=[
        synalinks.metrics.ProgramCalls(),
    ],
)
Source code in synalinks/src/metrics/program_metrics.py
@synalinks_export("synalinks.metrics.ProgramCalls")
class ProgramCalls(ProgramOperationalMetric):
    """Number of top-level program invocations during this run.

    One increment per call to `program(...)`, regardless of how many LM
    or EM calls the program makes internally.

    Example:

    ```python
    program.compile(
        metrics=[
            synalinks.metrics.ProgramCalls(),
        ],
    )
    ```
    """

    def __init__(self, name="program_calls"):
        super().__init__(name=name)

    def result(self):
        return int(self._delta_program("invocations"))