pub struct CompressionPipeline { /* private fields */ }Expand description
Chains multiple compression strategies sequentially.
Each strategy receives the output of the previous one. Tracks overall statistics across the full pipeline.
Implementations§
Source§impl CompressionPipeline
impl CompressionPipeline
Sourcepub fn with(self, stage: Box<dyn Compressor>) -> Self
pub fn with(self, stage: Box<dyn Compressor>) -> Self
Add a compression stage to the end of the pipeline.
Sourcepub fn default_for_rag() -> Self
pub fn default_for_rag() -> Self
Build a sensible default pipeline for typical RAG prompts.
Applies: whitespace → repetition → sentence ranking (keep 70%)
Sourcepub fn for_conversation_history() -> Self
pub fn for_conversation_history() -> Self
Build a pipeline for long conversation history compression.
Applies: whitespace → repetition → sentence ranking (keep 50%)
Sourcepub fn compress(&self, input: &str) -> (String, f64)
pub fn compress(&self, input: &str) -> (String, f64)
Compress the input through all stages, returning the final result.
The returned ratio reflects the overall compression across all stages.
Sourcepub fn stage_count(&self) -> usize
pub fn stage_count(&self) -> usize
Return the number of stages in this pipeline.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for CompressionPipeline
impl !UnwindSafe for CompressionPipeline
impl Freeze for CompressionPipeline
impl Send for CompressionPipeline
impl Sync for CompressionPipeline
impl Unpin for CompressionPipeline
impl UnsafeUnpin for CompressionPipeline
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request