The reward-kit functionality is available as an optional dependency. You’ll need to install
fireworks-ai[reward-kit] to use the evaluator features described in this guide.Prerequisites
You can install the Fireworks Build SDK using pip. For developing evaluators, you’ll need to install the SDK with the reward-kit optional dependency:FIREWORKS_API_KEY environment variable to your Fireworks API key:
Your first evaluator
For this tutorial, we’ll create a new project usinguv.
pyproject.toml file and a uv.lock file.
my_first_evaluator/main.py:
my_first_evaluator/main.py:
my_first_evaluator/main.py
main.py with the following code:
main.py
Evaluating on a dataset
Now that we’ve created and tested our first evaluator, we can use it to evaluate on Fireworks infrastructure using a dataset uploaded on Fireworks. To do this, we’ll create a Dataset object and callcreate_evaluation_job. Create a new file called run_first_evaluator.py at
the root of your project and add the following code:
run_first_evaluator.py



Creating your second evaluator
Let’s create a more complex evaluator that imports a third-party library to calculate the score. Let’s add thetextblob library to our project:
pyproject.toml
or requirements.txt files in your project. Alternatively you can specify a
list of strings as you would in a requirements.txt file directly in the
@reward_function decorator itself.
Now, let’s create a new evaluator under my_second_evaluator/main.py:
my_second_evaluator/main.py:
my_second_evaluator/main.py
random_phrases.jsonl file
should be at the root of your project like this:
run_second_evaluator.py and add the following code:
run_second_evaluator.py
