#[non_exhaustive]pub struct AgentOutput {
pub content: AgentOutputContent,
pub usage: RunUsage,
}Expand description
Output from an agent run.
This struct is marked #[non_exhaustive] — new fields may be added in
future releases without breaking changes.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.content: AgentOutputContentThe response content.
usage: RunUsageUsage statistics for this run.
Implementations§
Source§impl AgentOutput
impl AgentOutput
Sourcepub fn text_with_usage(text: String, usage: RunUsage) -> Self
pub fn text_with_usage(text: String, usage: RunUsage) -> Self
Create a text output with usage.
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
Get the text content if this is a text output.
Returns an empty string for Structured and Error variants.
Use structured() or Display for those.
Sourcepub fn error_message(&self) -> Option<&str>
pub fn error_message(&self) -> Option<&str>
Get the error message if this is an error output.
Sourcepub fn structured(&self) -> Option<&Value>
pub fn structured(&self) -> Option<&Value>
Get the structured JSON value if this is a structured output.
Trait Implementations§
Source§impl Clone for AgentOutput
impl Clone for AgentOutput
Source§fn clone(&self) -> AgentOutput
fn clone(&self) -> AgentOutput
Returns a duplicate of the value. Read more
1.0.0 · 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 AgentOutput
impl Debug for AgentOutput
Auto Trait Implementations§
impl Freeze for AgentOutput
impl RefUnwindSafe for AgentOutput
impl Send for AgentOutput
impl Sync for AgentOutput
impl Unpin for AgentOutput
impl UnsafeUnpin for AgentOutput
impl UnwindSafe for AgentOutput
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