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 text(text: impl Into<String>) -> MockTurn
Available on crate features test-utils only.
pub fn text(text: impl Into<String>) -> MockTurn
test-utils only.Create a text response turn.
Sourcepub fn tool_call(
id: impl Into<String>,
name: impl Into<String>,
arguments: Value,
) -> MockTurn
Available on crate features test-utils only.
pub fn tool_call( id: impl Into<String>, name: impl Into<String>, arguments: Value, ) -> MockTurn
test-utils only.Create a tool-call response turn.
Sourcepub fn error(message: impl Into<String>) -> MockTurn
Available on crate features test-utils only.
pub fn error(message: impl Into<String>) -> MockTurn
test-utils only.Create a provider-error response turn.
Sourcepub fn request_error(message: impl Into<String>) -> MockTurn
Available on crate features test-utils only.
pub fn request_error(message: impl Into<String>) -> MockTurn
test-utils only.Create a request-error response turn.
Sourcepub fn from_content(content: AssistantContent) -> MockTurn
Available on crate features test-utils only.
pub fn from_content(content: AssistantContent) -> MockTurn
test-utils only.Create a response turn from one assistant content item.
Sourcepub fn from_contents(
content: impl IntoIterator<Item = AssistantContent>,
) -> Result<MockTurn, EmptyListError>
Available on crate features test-utils only.
pub fn from_contents( content: impl IntoIterator<Item = AssistantContent>, ) -> Result<MockTurn, EmptyListError>
test-utils only.Create a response turn from multiple assistant content items.
Sourcepub fn with_call_id(self, call_id: impl Into<String>) -> MockTurn
Available on crate features test-utils only.
pub fn with_call_id(self, call_id: impl Into<String>) -> MockTurn
test-utils only.Attach a provider-specific call ID to a tool-call response turn.
Sourcepub fn with_usage(self, usage: Usage) -> MockTurn
Available on crate features test-utils only.
pub fn with_usage(self, usage: Usage) -> MockTurn
test-utils only.Override usage for this turn.
Sourcepub fn with_message_id(self, message_id: impl Into<String>) -> MockTurn
Available on crate features test-utils only.
pub fn with_message_id(self, message_id: impl Into<String>) -> MockTurn
test-utils only.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