Registry / ai-ml / reward-kit

reward-kit

JSON →
library0.4.1pypypi✓ verified 87d ago

A Python library for defining, testing, and using reward functions, particularly for RLHF and AI alignment. Version 0.4.1, pre-1.0, active development with weekly releases.

pip install reward-kit
INSTALL
IMPORT
SIG · REWARD-KIT
R
reward-kit
ai-mlpythonv0.4.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RewardFunction
from reward_kit import RewardFunction
from reward_kit.core import RewardFunction
In version 0.3+ RewardFunction moved to top-level
evaluate_reward
from reward_kit import evaluate_reward
from reward_kit.utils import evaluate_reward
API changed in 0.4.0

Initialize a reward function, load a dataset, and evaluate a sample.

from reward_kit import RewardFunction from reward_kit.data import MoralityQA import os # Use your own API key or prompt key api_key = os.environ.get('REWARD_KIT_API_KEY', 'your-key-here') reward_fn = RewardFunction(model='morality', api_key=api_key) dataset = MoralityQA() score = reward_fn.evaluate(dataset[0]) print(score)
Debug
Known issues
breakingIn version 0.4.0, the evaluate_reward function was moved from reward_kit.utils to top-level reward_kit. Old imports will break.
fix
Use 'from reward_kit import evaluate_reward' instead of 'from reward_kit.utils import evaluate_reward'
affects: >=0.4.0,<0.5
breakingThe RewardFunction class constructor 'model' parameter changed from string to enum in 0.4.1. Strings still work but are deprecated.
fix
Pass a Model enum value, e.g., reward_kit.Model.MORALITY, or keep string but expect future removal.
affects: >=0.4.1
deprecatedThe 'morality' model name is deprecated in favor of 'morality_v2' as of 0.4.0. The v1 model will be removed in 0.5.
fix
Use model='morality_v2' or reward_kit.Model.MORALITY_V2.
affects: >=0.4.0
gotchaBy default, reward functions require an internet connection to call remote APIs. Offline mode is not yet supported.
fix
Ensure you have internet access or expect ConnectionError.
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'reward_kit'
Library not installed or installed in wrong environment.
fix
Run 'pip install reward-kit' in the correct Python environment.
AttributeError: module 'reward_kit' has no attribute 'evaluate_reward'
Import path changed in version 0.4.0.
fix
Use 'from reward_kit import evaluate_reward' instead of 'from reward_kit.utils import evaluate_reward'.
ValueError: Unknown model: 'morality'
Model name 'morality' is deprecated in 0.4.0+ and removed in some versions.
fix
Use 'morality_v2' or import Model enum: reward_kit.Model.MORALITY_V2.
Upgrade
Version history
0.4.1latest on PyPI · released Jul 13, 2025
Audit
Dependencies
torchrequiredRequired for tensor operations in reward functions
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
1
Resources
reward-kit — pip install reward-kit · libregistry