pub struct LlmResponse {
pub message: Message,
pub stop_reason: StopReason,
pub usage: Usage,
pub model: Option<String>,
}Expand description
A model’s reply.
Fields§
§message: MessageThe assistant turn, blocks intact — prose and tool calls together.
stop_reason: StopReasonWhy generation ended. Checked before the text is trusted —
see Self::reject_non_answers.
usage: UsageToken accounting for this one call.
model: Option<String>Which model actually served this, which may differ from the one asked for when a provider-side fallback kicked in.
Implementations§
Source§impl LlmResponse
impl LlmResponse
Sourcepub fn reject_non_answers(&self, node_id: &str) -> Result<()>
pub fn reject_non_answers(&self, node_id: &str) -> Result<()>
Fail unless this reply is actually an answer.
Two ways a turn can end are not answers: the model was cut off
mid-sentence, or it declined. Both leave message populated with
something that reads like a reply, so a step that only parses the
text turns them into a confident wrong result — a truncated JSON
object that fails to parse and scores 0.0, a half-written plan
treated as the whole plan. Neither is recoverable by reading harder,
so every step calls this before it looks at the text.
node_id names the failing node in the error.
Trait Implementations§
Source§impl Clone for LlmResponse
impl Clone for LlmResponse
Source§fn clone(&self) -> LlmResponse
fn clone(&self) -> LlmResponse
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more