pub struct FastembedEmbedder { /* private fields */ }Implementations§
Source§impl FastembedEmbedder
impl FastembedEmbedder
Sourcepub fn new(cfg: FastembedEmbedderConfig) -> Result<Self>
pub fn new(cfg: FastembedEmbedderConfig) -> Result<Self>
Constructor that fetches model files from HuggingFace at runtime.
Requires the embedder-hub Cargo feature (pulls hf-hub + native-tls).
Embedded library consumers that load model bytes from their own
storage should use FastembedEmbedder::from_user_defined_files
instead — it works under embedder-core alone.
Sourcepub fn from_user_defined_files(
cfg: FastembedEmbedderConfig,
onnx: Vec<u8>,
tokenizer: Vec<u8>,
tokenizer_config: Vec<u8>,
model_config: Vec<u8>,
) -> Result<Self>
pub fn from_user_defined_files( cfg: FastembedEmbedderConfig, onnx: Vec<u8>, tokenizer: Vec<u8>, tokenizer_config: Vec<u8>, model_config: Vec<u8>, ) -> Result<Self>
Bytes-in constructor: caller supplies the model files directly. No
HuggingFace fetch, no hf-hub dep. Available under embedder-core.
onnx is the raw ONNX model bytes. tokenizer is the raw
tokenizer.json bytes. tokenizer_config and model_config carry
the JSON bytes from tokenizer_config.json and config.json (used to
pin pad-token / max-length tokenizer settings — same shape the
HF-fetch path uses).
Pooling is read from cfg.pooling ("cls" or "mean"). cfg.threads
controls ORT intra-threads (default 1). cfg.is_byo() is not required
— this constructor never consults cfg.hf_repo / cfg.onnx_path.
Used by embedded library consumers (e.g. AIDB pgrx extension) that load model bytes from extension-managed storage rather than fetching at runtime.
Sourcepub fn embed_seconds(&self) -> f64
pub fn embed_seconds(&self) -> f64
Cumulative wall time spent in embed() calls so far.
pub fn dim(&self) -> usize
Trait Implementations§
Source§impl BoundaryEmbedder for FastembedEmbedder
Available on crate feature chunkers only.Default in-tree implementation of crate::chunker::BoundaryEmbedder
for FastembedEmbedder. Routes through FastembedEmbedder::embed
(which already takes Vec<String> and returns Vec<Vec<f32>>) by
allocating owned Strings from the input slice. Owns one allocation per
call; negligible vs. the ORT inference cost.
impl BoundaryEmbedder for FastembedEmbedder
chunkers only.Default in-tree implementation of crate::chunker::BoundaryEmbedder
for FastembedEmbedder. Routes through FastembedEmbedder::embed
(which already takes Vec<String> and returns Vec<Vec<f32>>) by
allocating owned Strings from the input slice. Owns one allocation per
call; negligible vs. the ORT inference cost.
Present when chunkers is enabled (this module is itself embedder-core-
gated, so FastembedEmbedder is always available here). The trait lives
in crate::chunker and is always available.
Auto Trait Implementations§
impl !Freeze for FastembedEmbedder
impl !RefUnwindSafe for FastembedEmbedder
impl !UnwindSafe for FastembedEmbedder
impl Send for FastembedEmbedder
impl Sync for FastembedEmbedder
impl Unpin for FastembedEmbedder
impl UnsafeUnpin for FastembedEmbedder
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
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 more