pub struct ToolResult { /* private fields */ }Expand description
A transcript record containing one closed tool result.
Item metadata is an independent transport channel and is never reconstructed
from, or written back into, tool_call::ToolResult output metadata.
ModelVisibility is a free parameter at this constructor, because a composition
layer restoring or rewriting a history owns both halves of an exchange. The
records reef itself commits take the visibility of the Assistant record
carrying the call, so reef never authors a half-hidden exchange.
use reef_core::transcript::item;
use reef_core::value::{content, tool_call};
let item = item::ToolResult::new(
tool_call::Id::new("call-1".into()), tool_call::Name::new("search".into()),
tool_call::ToolResult::no_output(), item::ModelVisibility::Visible, Some(content::Metadata::new()),
);
assert_eq!(item.call_id().as_str(), "call-1");
assert!(item.metadata().is_some());
assert!(!item.is_business_error());ⓘ
use reef_core::transcript::item;
use reef_core::value::tool_call;
let _forged = item::ToolResult {
call_id: tool_call::Id::new("id".into()), tool_name: tool_call::Name::new("tool".into()),
result: tool_call::ToolResult::no_output(), visibility: item::ModelVisibility::Visible, metadata: None,
};Implementations§
Source§impl ToolResult
impl ToolResult
Sourcepub const fn new(
call_id: Id,
tool_name: Name,
result: ToolResult,
visibility: ModelVisibility,
metadata: Option<Metadata>,
) -> Self
pub const fn new( call_id: Id, tool_name: Name, result: ToolResult, visibility: ModelVisibility, metadata: Option<Metadata>, ) -> Self
Creates a tool-result record with independent item metadata.
Sourcepub const fn result(&self) -> &ToolResult
pub const fn result(&self) -> &ToolResult
Returns the closed tool result.
Sourcepub const fn visibility(&self) -> ModelVisibility
pub const fn visibility(&self) -> ModelVisibility
Returns this record’s model visibility.
Sourcepub const fn metadata(&self) -> Option<&Metadata>
pub const fn metadata(&self) -> Option<&Metadata>
Returns independent item-level metadata, preserving absent versus empty.
Sourcepub const fn is_business_error(&self) -> bool
pub const fn is_business_error(&self) -> bool
Reports whether the result is an explicit business error.
Trait Implementations§
Source§impl Clone for ToolResult
impl Clone for ToolResult
Source§impl Debug for ToolResult
impl Debug for ToolResult
Source§impl<'de> Deserialize<'de> for ToolResult
impl<'de> Deserialize<'de> for ToolResult
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ToolResult
impl RefUnwindSafe for ToolResult
impl Send for ToolResult
impl Sync for ToolResult
impl Unpin for ToolResult
impl UnsafeUnpin for ToolResult
impl UnwindSafe for ToolResult
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