Skip to content

RewardCost metric

Bases: LMRewardsOperationalMetric

Provider cost (USD) of LM calls during reward computation.

Example:

program.compile(
    metrics=[
        synalinks.metrics.RewardCost(),
    ],
)
Source code in synalinks/src/metrics/lm_metrics.py
@synalinks_export("synalinks.metrics.RewardCost")
class RewardCost(LMRewardsOperationalMetric):
    """Provider cost (USD) of LM calls during reward computation.

    Example:

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

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

    def result(self):
        return float(self._delta("cost"))