pub struct PartKind(/* private fields */);Expand description
The canonical, open numeric kind of a Part.
Every i64 round-trips, while only values zero through four have a known
portable interpretation.
use reef_core::value::content;
let _forged = content::PartKind(0);§Kinds this crate cannot name
A producer is free to mint its own. PartKind::from_i64 keeps every i64,
and transcript records, user input and ephemeral input all propagate an
unrecognised kind losslessly together with its complete PartFields. Two
boundaries narrow, and each says so where it is defined: a system-instruction
part must be a known KnownPartKind::Text, and
tool_call::ToolPart::try_from_part
refuses a kind this crate cannot name, because the model acts on a tool
result.
What these numbers do not come with is an allocation authority. There is no registry and no reserved range, so two independently written producers can choose the same integer for different concepts, or different integers for the same one, and this crate can neither prevent that nor notice it. A number outside 0-4 therefore identifies a kind only between parties that already agree — typically a codec and the consumer written against it.
When something has to be recognised by a party that did not choose the number,
name it in the Metadata on the same part: its keys are strings, so a
producer can qualify its own vocabulary the way Envelope does with
(namespace, kind) for provider data elsewhere in the crate. A Part carries
no Envelope of its own — PartFields::raw_payload is unnamespaced bytes —
so the metadata tree is where that naming goes.