pub struct LLMMiddlewareStack { /* private fields */ }Expand description
Stack of middlewares to execute in order.
Implementations§
Source§impl LLMMiddlewareStack
impl LLMMiddlewareStack
Sourcepub fn add(&mut self, middleware: Arc<dyn LLMMiddleware>)
pub fn add(&mut self, middleware: Arc<dyn LLMMiddleware>)
Add a middleware to the stack.
Sourcepub async fn before(&self, request: &LLMRequest) -> Result<()>
pub async fn before(&self, request: &LLMRequest) -> Result<()>
Execute all before hooks in registration order.
Sourcepub async fn after(
&self,
request: &LLMRequest,
response: &LLMResponse,
duration_ms: u64,
) -> Result<()>
pub async fn after( &self, request: &LLMRequest, response: &LLMResponse, duration_ms: u64, ) -> Result<()>
Execute all after hooks in reverse order.
Trait Implementations§
Source§impl Default for LLMMiddlewareStack
impl Default for LLMMiddlewareStack
Source§fn default() -> LLMMiddlewareStack
fn default() -> LLMMiddlewareStack
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for LLMMiddlewareStack
impl !RefUnwindSafe for LLMMiddlewareStack
impl Send for LLMMiddlewareStack
impl Sync for LLMMiddlewareStack
impl Unpin for LLMMiddlewareStack
impl UnsafeUnpin for LLMMiddlewareStack
impl !UnwindSafe for LLMMiddlewareStack
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