pub struct ScriptedModelClient;Expand description
In-process model client used by tests / dev. Inspects the most recent
User message in input.messages and either fires a deterministic
tool call (if a prior Tool result hasn’t landed yet) or emits a
summary text reply (once it has).
Implements stream natively so the agent loop exercises the
streaming code path even in tests; the chunk sequence it produces
matches what OpenAiCompatibleModelClient would emit for the same
logical response.
Trait Implementations§
Source§impl Clone for ScriptedModelClient
impl Clone for ScriptedModelClient
Source§fn clone(&self) -> ScriptedModelClient
fn clone(&self) -> ScriptedModelClient
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ScriptedModelClient
impl Debug for ScriptedModelClient
Source§impl Default for ScriptedModelClient
impl Default for ScriptedModelClient
Source§fn default() -> ScriptedModelClient
fn default() -> ScriptedModelClient
Returns the “default value” for a type. Read more
Source§impl ModelClient for ScriptedModelClient
impl ModelClient for ScriptedModelClient
Source§fn stream<'life0, 'async_trait>(
&'life0 self,
input: ModelTurnInput,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<ModelChunk, ModelClientError>>, ModelClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stream<'life0, 'async_trait>(
&'life0 self,
input: ModelTurnInput,
) -> Pin<Box<dyn Future<Output = Result<BoxStream<'static, Result<ModelChunk, ModelClientError>>, ModelClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stream the model’s response as a sequence of
ModelChunks. Production
ScriptedModelClient / OpenAiCompatibleModelClient implement this;
next() is provided as a folding convenience for callers that don’t
need token-level events.Source§fn next<'life0, 'async_trait>(
&'life0 self,
input: ModelTurnInput,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ModelClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn next<'life0, 'async_trait>(
&'life0 self,
input: ModelTurnInput,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ModelClientError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Buffer the stream into a single
ModelResponse. Default impl
awaits every chunk and then runs collect_model_response. Override
only if a provider has a cheaper non-streaming path (none today —
even OpenAI’s non-stream call still goes through the same SSE-or-not
branch on our side).Auto Trait Implementations§
impl Freeze for ScriptedModelClient
impl RefUnwindSafe for ScriptedModelClient
impl Send for ScriptedModelClient
impl Sync for ScriptedModelClient
impl Unpin for ScriptedModelClient
impl UnsafeUnpin for ScriptedModelClient
impl UnwindSafe for ScriptedModelClient
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