Skip to main content

Assertion

Enum Assertion 

Source
pub enum Assertion {
Show 23 variants ExpectTools(Vec<String>), ForbidTools(Vec<String>), ExpectAnyTool, ExpectNoTools, ExpectTextContains(String), ExpectTextNotContains(String), ExpectTurns(RangeInclusive<usize>), ExpectToolsWithinAllowlist, ExpectNoError, ExpectToolArgs(String, Value), ExpectToolArgsContain(String, Value), ExpectToolArg(String, String, Value), ExpectToolArgExists(String, String), ExpectToolCallCount(String, usize), ExpectToolCallOrder(Vec<String>), ExpectToolOnTurn(usize, String), ExpectToolsInTurnRange(RangeInclusive<usize>, Vec<String>), ForbidToolsInTurnRange(RangeInclusive<usize>, Vec<String>), ExpectFinalTool(String), ExpectFinalToolArg(String, String, Value), ExpectGatheringBeforeAction(Vec<String>, Vec<String>), ExpectToolOnlyOnFinalTurn(String), Custom(Box<dyn Fn(&AgentOutput) -> Result<(), String> + Send + Sync>),
}
Expand description

An assertion to evaluate against agent output.

Variants§

§

ExpectTools(Vec<String>)

§

ForbidTools(Vec<String>)

§

ExpectAnyTool

§

ExpectNoTools

§

ExpectTextContains(String)

§

ExpectTextNotContains(String)

§

ExpectTurns(RangeInclusive<usize>)

§

ExpectToolsWithinAllowlist

§

ExpectNoError

§

ExpectToolArgs(String, Value)

§

ExpectToolArgsContain(String, Value)

§

ExpectToolArg(String, String, Value)

§

ExpectToolArgExists(String, String)

§

ExpectToolCallCount(String, usize)

§

ExpectToolCallOrder(Vec<String>)

§

ExpectToolOnTurn(usize, String)

§

ExpectToolsInTurnRange(RangeInclusive<usize>, Vec<String>)

Tools must appear in the specified turn range.

§

ForbidToolsInTurnRange(RangeInclusive<usize>, Vec<String>)

Tools must NOT appear in the specified turn range.

§

ExpectFinalTool(String)

Last turn must contain this tool call.

§

ExpectFinalToolArg(String, String, Value)

Last turn’s tool call must have this argument value.

§

ExpectGatheringBeforeAction(Vec<String>, Vec<String>)

Gather tools must appear before action tools.

§

ExpectToolOnlyOnFinalTurn(String)

Tool appears on last turn and no other.

§

Custom(Box<dyn Fn(&AgentOutput) -> Result<(), String> + Send + Sync>)

Implementations§

Source§

impl Assertion

Source

pub fn is_security(&self) -> bool

Whether this is a security-related assertion.

Source

pub fn category(&self) -> Option<&str>

Category for reporting grouping.

Source

pub fn evaluate( &self, output: &AgentOutput, available_tools: &[String], ) -> AssertionResult

Evaluate this assertion against agent output.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.