pub enum Rule {
Requires {
tool: String,
},
Order {
before: String,
after: String,
},
Forbids {
tool: String,
args_match: Option<String>,
},
Args {
tool: String,
field: String,
pattern: String,
},
MaxSteps {
model_calls: Option<u32>,
tool_calls: Option<u32>,
tokens: Option<u32>,
},
NoRepeatedFailure {
times: u32,
},
Ends,
}Expand description
One statement about what a correct path looks like.
Deserializes from TOML with a rule = "<name>" discriminator, so rule files
can live next to the code and be reviewed like any other config.
Variants§
Requires
The tool was called successfully at least once.
Order
The first successful before precedes the first after. Passes if
after is never called; fails if after runs with no earlier before.
Forbids
The tool is never called. With args_match, only calls whose
JSON-serialized args match the regex are violations.
Args
Every call to tool has a string at field (a /json/pointer, or a
top-level key) matching pattern.
MaxSteps
Upper bounds on model calls, tool calls, and total tokens.
NoRepeatedFailure
The same call (tool and args) failed times or more times: a loop.
Ends
The run ended and its last model turn produced text.