pub struct Completion { /* private fields */ }Expand description
A mocked LLM chat/completion response, provider-agnostic
(mirrors org.mockserver.model.Completion).
MockServer re-encodes this into the wire shape of the configured provider when a request is served.
Implementations§
Source§impl Completion
impl Completion
Sourcepub fn with_tool_call(self, tool_call: ToolUse) -> Self
pub fn with_tool_call(self, tool_call: ToolUse) -> Self
Append a single tool call.
Sourcepub fn with_tool_calls(self, tool_calls: Vec<ToolUse>) -> Self
pub fn with_tool_calls(self, tool_calls: Vec<ToolUse>) -> Self
Replace all tool calls.
Sourcepub fn with_stop_reason(self, stop_reason: impl Into<String>) -> Self
pub fn with_stop_reason(self, stop_reason: impl Into<String>) -> Self
Set the stop reason.
Sourcepub fn with_usage(self, usage: Usage) -> Self
pub fn with_usage(self, usage: Usage) -> Self
Set token usage.
Sourcepub fn with_streaming(self, streaming: bool) -> Self
pub fn with_streaming(self, streaming: bool) -> Self
Set the streaming flag explicitly.
Sourcepub fn with_streaming_physics(self, physics: StreamingPhysics) -> Self
pub fn with_streaming_physics(self, physics: StreamingPhysics) -> Self
Set streaming physics. Does NOT touch the streaming flag — enable it
explicitly via with_streaming / streaming.
Sourcepub fn with_output_schema(self, output_schema: impl Into<String>) -> Self
pub fn with_output_schema(self, output_schema: impl Into<String>) -> Self
Set the structured-output JSON schema (a JSON string, matching Java).
Sourcepub fn with_model(self, model: impl Into<String>) -> Self
pub fn with_model(self, model: impl Into<String>) -> Self
Set the model name carried by the completion.
Trait Implementations§
Source§impl Clone for Completion
impl Clone for Completion
Source§fn clone(&self) -> Completion
fn clone(&self) -> Completion
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 Completion
impl Debug for Completion
Source§impl Default for Completion
impl Default for Completion
Source§fn default() -> Completion
fn default() -> Completion
Returns the “default value” for a type. Read more
Source§impl From<Completion> for LlmResponseBody
impl From<Completion> for LlmResponseBody
Source§fn from(c: Completion) -> Self
fn from(c: Completion) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Completion
impl PartialEq for Completion
Source§fn eq(&self, other: &Completion) -> bool
fn eq(&self, other: &Completion) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Completion
Auto Trait Implementations§
impl Freeze for Completion
impl RefUnwindSafe for Completion
impl Send for Completion
impl Sync for Completion
impl Unpin for Completion
impl UnsafeUnpin for Completion
impl UnwindSafe for Completion
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