pub struct AutoClassifier {
pub tracker: DenialTracker,
/* private fields */
}Expand description
LLM-based classifier that decides whether a tool call should be
auto-approved in PermissionMode::Auto.
Fields§
§tracker: DenialTrackerDenial tracker for safety limits.
Implementations§
Source§impl AutoClassifier
impl AutoClassifier
Sourcepub fn new(provider: Arc<dyn ChatProvider>) -> Self
pub fn new(provider: Arc<dyn ChatProvider>) -> Self
Create a new classifier backed by the given provider.
Sourcepub async fn classify(
&mut self,
tool_name: &str,
args_summary: &str,
transcript_snippet: &str,
) -> Result<(bool, String)>
pub async fn classify( &mut self, tool_name: &str, args_summary: &str, transcript_snippet: &str, ) -> Result<(bool, String)>
Classify whether a tool call should be blocked.
§Arguments
tool_name— name of the tool being called.args_summary— JSON string summary of the arguments.transcript_snippet— recent conversation context.
§Returns
Ok((block, reason)) — block is true if the tool should be denied.
§Behaviour
- If the denial tracker is over limit, returns
(true, "...")without calling the LLM. - On JSON parse error, defaults to
(true, "classifier parse error...")(fail-closed: err on the side of blocking).
Auto Trait Implementations§
impl !RefUnwindSafe for AutoClassifier
impl !UnwindSafe for AutoClassifier
impl Freeze for AutoClassifier
impl Send for AutoClassifier
impl Sync for AutoClassifier
impl Unpin for AutoClassifier
impl UnsafeUnpin for AutoClassifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Converts this value into a three-state builder argument.
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Converts this value into an optional builder argument.