pub struct ReplayProvider { /* private fields */ }Expand description
A provider that answers from a cassette instead of the network.
The first request that does not match a recorded request fails the run with the turn named — the cassette is not a hint, it is the test.
Implementations§
Trait Implementations§
Source§impl ChatProvider for ReplayProvider
impl ChatProvider for ReplayProvider
Source§fn chat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn chat<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Send the conversation and return the assistant’s reply (text and/or tool calls).
Source§fn chat_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
on_delta: DeltaFn<'life3>,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn chat_stream<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
on_delta: DeltaFn<'life3>,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Like
chat, but reports assistant text through on_delta as it is
generated. The returned message is always the complete reply. Providers that
cannot stream just answer normally and emit no deltas.Source§fn chat_stream_patched<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
on_delta: DeltaFn<'life3>,
_patch: &'life4 RequestPatch,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn chat_stream_patched<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
on_delta: DeltaFn<'life3>,
_patch: &'life4 RequestPatch,
) -> Pin<Box<dyn Future<Output = Result<Message>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
One streaming turn with a request patch applied. Read more
Source§fn take_usage(&self) -> Option<TurnUsage>
fn take_usage(&self) -> Option<TurnUsage>
What the most recent call cost, if the server said. Taken rather than borrowed so a
caller cannot show the same turn twice; providers that do not measure return
None.Auto Trait Implementations§
impl !Freeze for ReplayProvider
impl Forget for ReplayProvider
impl Move for ReplayProvider
impl RefUnwindSafe for ReplayProvider
impl Send for ReplayProvider
impl Sync for ReplayProvider
impl Unpin for ReplayProvider
impl UnsafeUnpin for ReplayProviderwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<RecordedRequest>: UnsafeUnpin,
Align4<u32>: UnsafeUnpin,
Align1<u8>: UnsafeUnpin,
impl UnwindSafe for ReplayProvider
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