Skip to main content

Module timeout_middleware

Module timeout_middleware 

Source
Expand description

Timeout middleware — enforces a per-call time limit on LLM completions.

Wraps each complete() call with tokio::time::timeout. If the call exceeds the deadline, returns PeError::Timeout.

§Example

use std::time::Duration;
use pe_core::timeout_middleware::TimeoutMiddleware;

let timeout = TimeoutMiddleware::new(Duration::from_secs(30));
let stack = MiddlewareStack::new(provider).with(timeout);

Structs§

TimeoutMiddleware
Enforces a per-call time limit on LLM completion requests.