pub type LlmConditionalFn = Arc<dyn Fn(&LlmRequest) -> Result<Option<String>> + Send + Sync>;Expand description
Decide whether an LLM call is allowed to continue.
The callback receives the current LlmRequest and can allow execution,
reject it with a guardrail reason, or return an error.
This alias is Arc-backed so the runtime can clone conditional
guardrails into an evaluation snapshot and invoke them after registry locks
are released.
§Parameters
- First argument: Current
LlmRequestbeing evaluated.
§Returns
A Result containing Ok(None) when execution is allowed or
Ok(Some(reason)) when the guardrail rejects the call.
§Errors
The callback can return any FlowError to abort
guardrail evaluation.
Aliased Type§
pub struct LlmConditionalFn { /* private fields */ }