pub struct LengthRouter {
pub threshold: usize,
pub short_idx: usize,
pub long_idx: usize,
}Expand description
Stock router: route by length. Inputs whose total chars across the
batch exceed threshold go to long_idx; otherwise short_idx.
Fields§
§threshold: usizeTotal-chars threshold for “long” routing.
short_idx: usizeProvider index used for “short” inputs.
long_idx: usizeProvider index used for “long” inputs.
Trait Implementations§
Source§impl EmbeddingRouter for LengthRouter
impl EmbeddingRouter for LengthRouter
Source§fn pick_documents(&self, texts: &[String]) -> usize
fn pick_documents(&self, texts: &[String]) -> usize
Pick a provider for this batch (
embed_documents) call.Source§fn pick_query(&self, text: &str) -> usize
fn pick_query(&self, text: &str) -> usize
Pick a provider for this single-query call.
Auto Trait Implementations§
impl Freeze for LengthRouter
impl RefUnwindSafe for LengthRouter
impl Send for LengthRouter
impl Sync for LengthRouter
impl Unpin for LengthRouter
impl UnsafeUnpin for LengthRouter
impl UnwindSafe for LengthRouter
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