pub struct EmbeddingPipelineManager { /* private fields */ }Expand description
Multi-stage embedding pipeline manager.
Supports both text-input (process_text) and pre-computed embedding input
(process_embeddings). Thread-safe — the internal statistics are protected
by a Mutex.
Implementations§
Source§impl EmbeddingPipelineManager
impl EmbeddingPipelineManager
Sourcepub fn new(config: EpmPipelineConfig) -> Result<Self, EpmPipelineError>
pub fn new(config: EpmPipelineConfig) -> Result<Self, EpmPipelineError>
Create a new manager from the given config.
Sourcepub fn process_text(
&self,
ids: Vec<String>,
texts: Vec<String>,
corpus: Option<&[String]>,
) -> Result<EmbeddingBatch, EpmPipelineError>
pub fn process_text( &self, ids: Vec<String>, texts: Vec<String>, corpus: Option<&[String]>, ) -> Result<EmbeddingBatch, EpmPipelineError>
Process a batch of raw text strings through all pipeline stages.
corpus provides additional documents for IDF estimation; when None
the current batch is used as the corpus.
Sourcepub fn process_embeddings(
&self,
ids: Vec<String>,
embeddings: Vec<Vec<f64>>,
) -> Result<EmbeddingBatch, EpmPipelineError>
pub fn process_embeddings( &self, ids: Vec<String>, embeddings: Vec<Vec<f64>>, ) -> Result<EmbeddingBatch, EpmPipelineError>
Process pre-computed embeddings through the non-text pipeline stages.
Sourcepub fn add_stage(
&mut self,
stage: EpmPipelineStage,
) -> Result<(), EpmPipelineError>
pub fn add_stage( &mut self, stage: EpmPipelineStage, ) -> Result<(), EpmPipelineError>
Append a stage to the pipeline, then re-validate.
Sourcepub fn remove_stage(&mut self, index: usize) -> Result<(), EpmPipelineError>
pub fn remove_stage(&mut self, index: usize) -> Result<(), EpmPipelineError>
Remove the stage at index.
Sourcepub fn validate_config(&self) -> Result<(), EpmPipelineError>
pub fn validate_config(&self) -> Result<(), EpmPipelineError>
Validate the current stage configuration for ordering correctness.
Rules enforced:
TfIdfWeightingmust be preceded by at least one ofTokenize,StopWordFilter, orNGram.DimensionReducewithtarget_dim == 0is rejected.NGramwithn == 0is rejected.
Sourcepub fn benchmark(&self, texts: &[String], n_runs: usize) -> Vec<StageTiming>
pub fn benchmark(&self, texts: &[String], n_runs: usize) -> Vec<StageTiming>
Run each stage independently on texts for n_runs repetitions and
return per-stage timing information.
Sourcepub fn stats(&self) -> EpmPipelineStats
pub fn stats(&self) -> EpmPipelineStats
Return a snapshot of cumulative statistics.
Sourcepub fn config(&self) -> &EpmPipelineConfig
pub fn config(&self) -> &EpmPipelineConfig
Immutable reference to the current config.
Auto Trait Implementations§
impl Freeze for EmbeddingPipelineManager
impl RefUnwindSafe for EmbeddingPipelineManager
impl Send for EmbeddingPipelineManager
impl Sync for EmbeddingPipelineManager
impl Unpin for EmbeddingPipelineManager
impl UnsafeUnpin for EmbeddingPipelineManager
impl UnwindSafe for EmbeddingPipelineManager
Blanket Implementations§
impl<T> Allocation for T
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.