API Reference
Complete reference for the osmosis-ai Python SDK.Decorators
@osmosis_reward
Decorator for local reward functions that compute scores without API calls. Signature:solution_str(str, required) - Text to evaluateground_truth(str, required) - Reference answerextra_info(dict, optional) - Additional context**kwargs(required) - Future compatibility (see warning below)
float - Score value
Example:
@osmosis_rubric
Decorator for LLM-based evaluation functions. Signature:solution_str(str, required) - Text to evaluateground_truth(str | None, required) - Reference answer (can be None)extra_info(dict, required) - Configuration and context**kwargs(required) - Future compatibility (see warning below)
float - Score value
Example:
Core Functions
evaluate_rubric()
Evaluate text using an LLM-based rubric. Signature:
model_info Structure:
float- Score (whenreturn_details=False)dict- Full response with score, explanation, raw payload (whenreturn_details=True)
Exceptions
MissingAPIKeyError
Raised when an API key is not found for a provider.ProviderRequestError
Raised when a provider request fails.ModelNotFoundError
Raised when a specified model is not available (subclass ofProviderRequestError).
Type Definitions
ModelInfo (TypedDict)
RewardRubricRunResult (TypedDict)
Returned whenreturn_details=True:
Complete Example
Next Steps
Quick Start
Learn with examples
Decorators & API Guide
Advanced patterns
CLI Reference
Batch evaluations