pub enum ModelDelta {
Text(Arc<str>),
ToolCall(ToolCall),
}Expand description
One item of the streaming protocol between a LanguageModel and
LmStage: a text delta to append, or one complete tool
call.
Not a pipeline frame. Provider-specific streaming formats, tool-call
fragments, and constrained-output parsing are assembled inside the
implementation; the stage sees only normalized text and complete tool calls,
and turns them into ModelFrames. Every item is
a cancellation and barge-in preemption point.
Variants§
Text(Arc<str>)
Text to append to the current assistant response.
ToolCall(ToolCall)
One complete model tool call.
Implementations§
Source§impl ModelDelta
impl ModelDelta
Sourcepub fn tool_call(
id: impl Into<Arc<str>>,
name: impl Into<Arc<str>>,
arguments: Value,
) -> Result<Self, LmError>
pub fn tool_call( id: impl Into<Arc<str>>, name: impl Into<Arc<str>>, arguments: Value, ) -> Result<Self, LmError>
Build a ToolCall delta from structured
arguments, giving adapters a JSON-value API while the core frame keeps a
dependency-free JSON-text representation.
Fails if id or name is empty, if arguments is not a JSON object, or
if serializing the validated object fails.
Trait Implementations§
Source§impl Clone for ModelDelta
impl Clone for ModelDelta
Source§fn clone(&self) -> ModelDelta
fn clone(&self) -> ModelDelta
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more