pub struct ToolPart(/* private fields */);Expand description
A field-complete Part verified for use in tool output.
This wrapper can only be obtained through ToolPart::try_from_part.
use reef_core::value::{content, tool_call};
let _unchecked = tool_call::ToolPart(content::Part::text("result".into()));Implementations§
Source§impl ToolPart
impl ToolPart
Sourcepub fn try_from_part(part: Part) -> Result<Self, ToolPartError>
pub fn try_from_part(part: Part) -> Result<Self, ToolPartError>
Verifies that part has one of the five known kinds without changing it.
The check is deliberately narrow: ordinary Part paths remain open, and only tool output has to be one of the five interpretable kinds.
§Errors
ToolPartError::UnknownKind, carrying the rejected number, if the
part’s canonical kind is not one of the five this crate can interpret.
Tool output is the one Part consumer that narrows: every other path keeps
an unrecognised numeric kind so a provider extension survives a round
trip, but a tool result the model will act on may not carry a kind reef
cannot name. Nothing else can fail here — an accepted part is retained
whole, with every field and every presence distinction intact.