pub enum AssistantOutput<'a> {
Text(&'a str),
ToolCalls(&'a [ToolCall]),
TextAndToolCalls {
text: &'a str,
tool_calls: &'a [ToolCall],
},
Empty,
}Expand description
Exhaustive alternatives carried by a typed assistant message.
This enum is a sum type (a coproduct): callers must select one branch for
every supported provider outcome. TextAndToolCalls preserves providers
that return both values rather than silently discarding either one.
use edge_completions::{AssistantMessage, AssistantOutput};
fn output_kind(message: &AssistantMessage) -> &'static str {
match message.output() {
AssistantOutput::Text(_) => "text",
AssistantOutput::ToolCalls(_) => "tools",
AssistantOutput::TextAndToolCalls { .. } => "text-and-tool-calls",
AssistantOutput::Empty => "empty",
}
}Variants§
Text(&'a str)
The assistant returned final text without tool calls.
ToolCalls(&'a [ToolCall])
The assistant proposed tool calls without text.
TextAndToolCalls
The assistant returned text and proposed one or more tool calls.
Fields
Empty
The assistant returned neither text nor tool calls.
Trait Implementations§
Source§impl<'a> Clone for AssistantOutput<'a>
impl<'a> Clone for AssistantOutput<'a>
Source§fn clone(&self) -> AssistantOutput<'a>
fn clone(&self) -> AssistantOutput<'a>
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 moreimpl<'a> Copy for AssistantOutput<'a>
Source§impl<'a> Debug for AssistantOutput<'a>
impl<'a> Debug for AssistantOutput<'a>
Source§impl<'a> PartialEq for AssistantOutput<'a>
impl<'a> PartialEq for AssistantOutput<'a>
impl<'a> StructuralPartialEq for AssistantOutput<'a>
Auto Trait Implementations§
impl<'a> Freeze for AssistantOutput<'a>
impl<'a> RefUnwindSafe for AssistantOutput<'a>
impl<'a> Send for AssistantOutput<'a>
impl<'a> Sync for AssistantOutput<'a>
impl<'a> Unpin for AssistantOutput<'a>
impl<'a> UnsafeUnpin for AssistantOutput<'a>
impl<'a> UnwindSafe for AssistantOutput<'a>
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