pub struct Assistant { /* private fields */ }Expand description
An assistant-output transcript record.
content is the sole source of truth. Text, thinking, and calls remain in
their original provider order rather than being flattened into parallel
collections. Record-level provider data is metadata, not another segment.
An assistant record is ModelVisibility::Visible unless
Assistant::with_visibility says otherwise: the model said it, so by
default the model may see it again. ModelVisibility::Hidden is what a hook
selects when it replaces the record through
AfterModelDecision::Modify
or supplies one through
BeforeModelDecision::ShortCircuit,
which is how a history stays complete for a user-facing timeline while the
model is sent less than all of it. Because reef propagates this record’s
visibility onto every result committed with it, hiding a record that carries
tool calls also hides their results, and the projected request stays legal.
use reef_core::transcript::item;
use reef_core::value::content;
let extensions = || content::SegmentExtensions::new(String::new(), None, None);
let item = item::Assistant::new(vec![
content::Segment::Text { text: "a".into(), extensions: extensions() },
content::Segment::Thinking { text: "b".into(), extensions: extensions() },
], Some(vec![]));
assert_eq!(item.content().len(), 2);
assert!(item.provider_data().is_some_and(<[_]>::is_empty));
assert_eq!(item.visibility(), item::ModelVisibility::Visible);
let hidden = item.with_visibility(item::ModelVisibility::Hidden);
assert_eq!(hidden.visibility(), item::ModelVisibility::Hidden);use reef_core::transcript::item;
let _forged = item::Assistant {
content: vec![], provider_data: None, visibility: item::ModelVisibility::Visible,
};Implementations§
Source§impl Assistant
impl Assistant
Sourcepub const fn new(
content: Vec<Segment>,
provider_data: Option<Vec<Envelope>>,
) -> Self
pub const fn new( content: Vec<Segment>, provider_data: Option<Vec<Envelope>>, ) -> Self
Creates a model-visible assistant record from ordered segments and record metadata.
Sourcepub const fn with_visibility(self, visibility: ModelVisibility) -> Self
pub const fn with_visibility(self, visibility: ModelVisibility) -> Self
Declares whether this record participates in model projection.
Sourcepub fn provider_data(&self) -> Option<&[Envelope]>
pub fn provider_data(&self) -> Option<&[Envelope]>
Returns ordered record-level provider metadata, preserving presence.
Sourcepub const fn visibility(&self) -> ModelVisibility
pub const fn visibility(&self) -> ModelVisibility
Returns this record’s model visibility.