#[non_exhaustive]pub enum ScriptedReply {
Json(Value),
Text(String),
ToolCall {
id: CallId,
name: String,
arguments: Value,
},
MalformedJson(String),
Refusal(String),
Timeout,
RateLimited {
retry_after: Option<Duration>,
},
Fail(ProviderError),
Stream(Vec<StreamEvent>),
Chunks(Vec<String>),
FromSchema(fn(&Value) -> Value),
}Expand description
What one scripted call answers with.
The variants cover the answers a turn has to survive: the plan you meant, the plan you did not mean, a body that is not JSON at all, a refusal, and the three transport failures whose handling differs (timeout, rate limit, anything else).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Json(Value)
An arbitrary JSON document, for the shapes no typed value can express — an act with a field the schema forbids, a plan missing a required field.
Text(String)
Prose.
ToolCall
A single tool call, the shape a native function-schema transport produces.
Fields
MalformedJson(String)
A body that is not JSON. Sent verbatim, so the test decides how broken it is.
Refusal(String)
The model declined. A semantic outcome
(FinishReason::Refusal), not a transport failure — the difference a
runtime must not lose.
Timeout
The call did not answer in time.
RateLimited
The provider refused the call and asked the caller to wait.
Fail(ProviderError)
Any other normalized failure.
Stream(Vec<StreamEvent>)
Exactly these stream events, in this order.
Chunks(Vec<String>)
This text, delivered in these chunks. Equivalent to a Self::Stream
of one text delta per chunk followed by a stop, and shorter to write.
FromSchema(fn(&Value) -> Value)
A document built from the request’s output schema, for a task whose schema depends on its input.
Implementations§
Source§impl ScriptedReply
impl ScriptedReply
Sourcepub fn written(text: impl Into<String>) -> Self
pub fn written(text: impl Into<String>) -> Self
What the acknowledge and answer tasks write: a document holding text.
Sourcepub fn cannot_answer(reason: impl Into<String>) -> Self
pub fn cannot_answer(reason: impl Into<String>) -> Self
The answer task saying the facts do not answer the question.
Sourcepub fn review_passes() -> Self
pub fn review_passes() -> Self
A review that passes the reply: each check it was asked answered in its favour.
Sourcepub fn review_fails() -> Self
pub fn review_fails() -> Self
A review that finds the reply claims what its material does not hold.
Sourcepub fn rate_limited_after(seconds: u64) -> Self
pub fn rate_limited_after(seconds: u64) -> Self
A rate limit with a Retry-After hint in seconds.