Skip to main content

ChunkingDistiller

Struct ChunkingDistiller 

Source
pub struct ChunkingDistiller<D: Distiller> { /* private fields */ }
Expand description

A Distiller decorator that bounds the size of any single prompt sent to inner.

A long transcript is split into chunks of at most max_chunk_chars (via split_on_budget), each chunk is distilled independently through inner, and the partial results are combined into one DistilledMemory (via an internal reduce step, using the configured ReduceStrategy). A transcript that already fits in one chunk — including an empty transcript — is passed through to inner unchanged, with no splitting or reducing.

max_chunk_chars is caller-supplied policy: this type has no opinion on what a safe prompt size is for any particular model or host, only on how to split, map, and reduce once a budget is given.

Implementations§

Source§

impl<D: Distiller> ChunkingDistiller<D>

Source

pub fn new(inner: D, max_chunk_chars: usize) -> Self

Wraps inner, splitting any transcript over max_chunk_chars into multiple distillation calls. Uses ReduceStrategy::Structural to combine the results; call Self::with_reduce_strategy to use ReduceStrategy::Llm instead.

Source

pub fn with_reduce_strategy(self, strategy: ReduceStrategy) -> Self

Sets the ReduceStrategy used to combine chunk results.

Trait Implementations§

Source§

impl<D: Distiller> Distiller for ChunkingDistiller<D>

Source§

fn distill(&self, transcript: &str) -> Result<DistilledMemory>

§Errors

Returns an error if any chunk’s call to inner.distill fails, or if ReduceStrategy::Llm is used and the consolidating call fails. On error, no partial result is produced: chunks already distilled successfully before the failure are discarded, not saved or returned.

Auto Trait Implementations§

§

impl<D> Freeze for ChunkingDistiller<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for ChunkingDistiller<D>
where D: RefUnwindSafe,

§

impl<D> Send for ChunkingDistiller<D>

§

impl<D> Sync for ChunkingDistiller<D>

§

impl<D> Unpin for ChunkingDistiller<D>
where D: Unpin,

§

impl<D> UnsafeUnpin for ChunkingDistiller<D>
where D: UnsafeUnpin,

§

impl<D> UnwindSafe for ChunkingDistiller<D>
where D: UnwindSafe,

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, 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.