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 LlmProvider>) -> Self
pub fn new(provider: Arc<dyn LlmProvider>) -> 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
(false, "classifier parse error...")(conservative: err on the side of allowing).
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more