Reward Kit API Reference
This API reference provides detailed documentation for the key classes, functions, and data models in the Reward Kit.Core Components
Classes and Decorators
- RewardFunction Class: Core class for wrapping and calling reward functions
- reward_function Decorator: Decorator for creating deployable reward functions
Data Models
- Data Models: Documentation for Message, EvaluateResult, MetricResult, and other data models
Modules
reward_function Module
Thereward_function
module contains the core functionality for creating and using reward functions.
evaluation Module
Theevaluation
module provides the Evaluator
class for managing evaluation configurations and functions for creating and previewing evaluations.
Evaluator
class: Manages metric loading, sample loading, and evaluator creation on the platform.preview_evaluation
: Previews an evaluation with sample data before deployment.create_evaluation
: Creates and deploys an evaluator to the platform.
config Module
Theconfig
module handles loading and managing configurations for the Reward Kit, typically from a rewardkit.yaml
file.
load_config()
/get_config()
: Load the global Reward Kit configuration.RewardKitConfig
: Pydantic model for the main configuration structure.- Other models like
GCPCloudRunConfig
,AWSLambdaConfig
.
models Module
Themodels
module contains data models used throughout the Reward Kit.
rewards Module
Therewards
module contains specialized reward functions for specific use cases.
server Module
Theserver
module provides the RewardServer
class and serve
function to host reward functions as a FastAPI application.
RewardServer
class: A class to encapsulate a reward function and run it as a server.serve()
function: A utility to quickly serve a given reward function.
auth Module
Theauth
module provides utility functions to retrieve authentication credentials, primarily for Fireworks AI.
get_fireworks_api_key()
: Retrieves the Fireworks API key.get_fireworks_account_id()
: Retrieves the Fireworks account ID.
gcp_tools Module
Thegcp_tools
module offers utilities for working with Google Cloud Platform, such as building and pushing Docker images to Artifact Registry and deploying to Cloud Run.
packaging Module
Thepackaging
module assists in preparing reward functions for deployment, for example, by generating Dockerfile content.
platform_api Module
Theplatform_api
module provides functions for direct interaction with the Fireworks AI platform API, such as managing secrets.
rl_processing Module
Therl_processing
module contains tools for processing data for Reinforcement Learning workflows, such as the RLDataAligner
.
mcp Module (reward_kit.mcp
)
This sub-package contains components related to the Model Context Protocol (MCP).
reward_kit.mcp.clients
: Provides clients for interacting with MCP-compliant servers.
mcp_agent Module (reward_kit.mcp_agent
)
This sub-package provides a framework for building and running agents that interact with MCP servers. It includes orchestration logic, various backend implementations, and a collection of pre-built MCP servers for common tasks (e.g., filesystem, git).
Command Line Interface
The Reward Kit provides a command-line interface for common operations:Common Patterns
Creating a Basic Reward Function
Using a Deployed Reward Function
Next Steps
- Explore the Examples for practical implementations
- Follow the Tutorials for step-by-step guidance
- Review the Developer Guide for conceptual understanding