Concept: Middleware | API: Evaluation API
RAILMiddleware किसी भी async function को wrap करता है जो LLM responses generate करता है, और आपकी LLM call logic को बदले बिना automatic RAIL scoring add कर देता है।
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | str | — | RAIL API key |
generate_fn | async callable | — | आपका LLM function |
threshold | float | None | इस score से नीचे block/regenerate करें |
policy | str | "block" | "block" या "regenerate" |
eval_input | bool | False | Input messages को भी score करें |
input_threshold | float | None | Input scoring के लिए threshold |
max_iterations | int | 3 | Maximum regeneration attempts |