pub struct NousMiddleware { /* private fields */ }Expand description
Arcan middleware that runs Nous evaluators at each hook point.
Created with a populated EvaluatorRegistry and runs the appropriate
evaluators at each lifecycle hook. Scores are accumulated and can be
retrieved after a run completes.
Implementations§
Source§impl NousMiddleware
impl NousMiddleware
Sourcepub fn new(registry: EvaluatorRegistry) -> Self
pub fn new(registry: EvaluatorRegistry) -> Self
Create a new middleware with the given evaluator registry.
Sourcepub fn with_on_score(
registry: EvaluatorRegistry,
on_score: Arc<dyn Fn(&EvalScore) + Send + Sync>,
) -> Self
pub fn with_on_score( registry: EvaluatorRegistry, on_score: Arc<dyn Fn(&EvalScore) + Send + Sync>, ) -> Self
Create a middleware with a score callback.
Sourcepub fn with_defaults() -> Result<Self, NousError>
pub fn with_defaults() -> Result<Self, NousError>
Create a middleware with the default heuristic evaluators.
Sourcepub fn registry_len(&self) -> usize
pub fn registry_len(&self) -> usize
Number of registered evaluators.
Trait Implementations§
Source§impl Middleware for NousMiddleware
impl Middleware for NousMiddleware
fn before_model_call(&self, request: &ProviderRequest) -> Result<(), CoreError>
fn after_model_call( &self, request: &ProviderRequest, response: &ModelTurn, ) -> Result<(), CoreError>
fn pre_tool_call( &self, context: &ToolContext, call: &ToolCall, ) -> Result<(), CoreError>
fn post_tool_call( &self, context: &ToolContext, result: &ToolResult, ) -> Result<(), CoreError>
fn on_run_finished(&self, output: &RunOutput) -> Result<(), CoreError>
Auto Trait Implementations§
impl !Freeze for NousMiddleware
impl !RefUnwindSafe for NousMiddleware
impl Send for NousMiddleware
impl Sync for NousMiddleware
impl Unpin for NousMiddleware
impl UnsafeUnpin for NousMiddleware
impl !UnwindSafe for NousMiddleware
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