Skip to main content

CompactionFork

Struct CompactionFork 

Source
pub struct CompactionFork<D> { /* private fields */ }
Expand description

A compaction snapshot taken at a request boundary, asking for a D.

Implementations§

Source§

impl<D: HandoffSchema> CompactionFork<D>

Source

pub fn new( request: &LLMRequest, fork_point: u64, previous_file_index: &[String], focus: Option<&str>, skills: &[SkillCatalogEntry], attachments: &[AttachmentCatalogEntry], ) -> Result<Self, CompactionError>

Forks request — the exact request the run is about to send — into a compaction request for a D, optionally focused by focus. previous_file_index is the file index of the handoff the result will replace, and attachments the catalog of attachments the user messages below fork_point carry, which the instruction offers for the handoff to name.

The instruction D::instruction renders is appended and the tool definitions and parameters are reused untouched: everything up to the instruction is byte-for-byte what the main request sent, so the provider’s prefix cache still applies.

§Errors

Returns CompactionError::Empty when the request carries no conversation to summarize.

Source

pub fn with_file_references(self, references: Option<AnyFileReferences>) -> Self

Sets how the file index finds the files the conversation’s tool results name.

Source

pub const fn fork_point(&self) -> u64

The sequence number items must reach to survive this compaction.

Source

pub const fn request(&self) -> &LLMRequest

The request the fork replays, instruction included.

Source

pub async fn run<M: LanguageModel>( self, model: M, ) -> Result<CompletedCompaction, CompactionError>

Runs the compaction against model.

Structured output is attempted first. A schema mismatch — the common failure for models without native structured output — or a document D::validate rejects earns one corrective retry, D::retry, that quotes the failure back to the model. The accepted document is rendered with the file index and split into the handoff and its restoration.

§Errors

Returns CompactionError when the provider fails, or when the retry also fails to produce a valid document.

Trait Implementations§

Source§

impl<D> Debug for CompactionFork<D>

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<D> !RefUnwindSafe for CompactionFork<D>

§

impl<D> !UnwindSafe for CompactionFork<D>

§

impl<D> Forget for CompactionFork<D>

§

impl<D> Freeze for CompactionFork<D>
where PhantomData<fn() -> D>: Freeze,

§

impl<D> Move for CompactionFork<D>

§

impl<D> Send for CompactionFork<D>
where PhantomData<fn() -> D>: Send,

§

impl<D> Sync for CompactionFork<D>
where PhantomData<fn() -> D>: Sync,

§

impl<D> Unpin for CompactionFork<D>
where PhantomData<fn() -> D>: Unpin,

§

impl<D> UnsafeUnpin for CompactionFork<D>
where PhantomData<fn() -> D>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more