Skip to main content

Understanding Decorators

@osmosis_reward vs @osmosis_rubric

Key Difference: Parameter requirements

Type Enforcement

Both decorators enforce strict signatures at decoration time:

Advanced Reward Functions

Keyword Matching with Weights

Regex Pattern Matching

Advanced Rubric Patterns

Multi-Provider Fallback

Custom Score Ranges

Context-Rich Evaluation

Integration Patterns

Flask API

Async Batch Processing

Logging and Monitoring

Best Practices

When to Use Each Decorator

Use @osmosis_reward:
  • Deterministic evaluation (exact match, regex)
  • No API calls needed
  • Fast, local computation
  • Simple scoring rules
Use @osmosis_rubric:
  • Subjective evaluation (helpfulness, tone)
  • Semantic understanding required
  • Nuanced judgment needed
  • Natural language criteria

Error Handling

API Key Management

Next Steps

API Reference

Complete API documentation

CLI Reference

Batch evaluation with CLI