pub struct MockTurn { /* private fields */ }Available on crate feature
test-utils only.Expand description
A scripted non-streaming mock completion turn.
Implementations§
Source§impl MockTurn
impl MockTurn
Sourcepub fn tool_call(
id: impl Into<String>,
name: impl Into<String>,
arguments: Value,
) -> Self
pub fn tool_call( id: impl Into<String>, name: impl Into<String>, arguments: Value, ) -> Self
Create a tool-call response turn.
Sourcepub fn request_error(message: impl Into<String>) -> Self
pub fn request_error(message: impl Into<String>) -> Self
Create a request-error response turn.
Sourcepub fn from_content(content: AssistantContent) -> Self
pub fn from_content(content: AssistantContent) -> Self
Create a response turn from one assistant content item.
Sourcepub fn from_contents(
content: impl IntoIterator<Item = AssistantContent>,
) -> Result<Self, EmptyListError>
pub fn from_contents( content: impl IntoIterator<Item = AssistantContent>, ) -> Result<Self, EmptyListError>
Create a response turn from multiple assistant content items.
Sourcepub fn with_call_id(self, call_id: impl Into<String>) -> Self
pub fn with_call_id(self, call_id: impl Into<String>) -> Self
Attach a provider-specific call ID to a tool-call response turn.
Sourcepub fn with_usage(self, usage: Usage) -> Self
pub fn with_usage(self, usage: Usage) -> Self
Override usage for this turn.
Sourcepub fn with_message_id(self, message_id: impl Into<String>) -> Self
pub fn with_message_id(self, message_id: impl Into<String>) -> Self
Set a provider-assigned assistant message ID for this turn.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MockTurn
impl RefUnwindSafe for MockTurn
impl Send for MockTurn
impl Sync for MockTurn
impl Unpin for MockTurn
impl UnsafeUnpin for MockTurn
impl UnwindSafe for MockTurn
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
Source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> CloneableStorage for T
impl<T> CloneableStorage for T
fn clone_storage(&self) -> Box<dyn CloneableStorage>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more