pub struct MockLlm { /* private fields */ }Expand description
Builder for an in-process mock LLM server.
Implementations§
Source§impl MockLlm
impl MockLlm
Sourcepub fn anthropic(
responder: impl Fn(&RequestFacts) -> Value + Send + Sync + 'static,
) -> Self
pub fn anthropic( responder: impl Fn(&RequestFacts) -> Value + Send + Sync + 'static, ) -> Self
Mock an Anthropic Messages endpoint (POST /v1/messages).
Sourcepub fn openai(
responder: impl Fn(&RequestFacts) -> Value + Send + Sync + 'static,
) -> Self
pub fn openai( responder: impl Fn(&RequestFacts) -> Value + Send + Sync + 'static, ) -> Self
Mock an OpenAI Chat Completions endpoint (POST /chat/completions).
Sourcepub async fn spawn(self) -> MockHandle
pub async fn spawn(self) -> MockHandle
Bind an ephemeral local port and serve until the handle’s token is cancelled.
§Panics
Panics only on OS-level port bind failure (fatal test infra condition).
Auto Trait Implementations§
impl !RefUnwindSafe for MockLlm
impl !UnwindSafe for MockLlm
impl Freeze for MockLlm
impl Send for MockLlm
impl Sync for MockLlm
impl Unpin for MockLlm
impl UnsafeUnpin for MockLlm
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