pub struct LocalEmbeddings { /* private fields */ }Expand description
本地 SentenceTransformers 嵌入模型
注意:此实现需要 candle 或 ort 特性启用。
在纯 Rust 环境下,使用占位实现。
Implementations§
Source§impl LocalEmbeddings
impl LocalEmbeddings
pub fn new(config: EmbeddingsConfig) -> Result<Self>
pub fn with_cache( config: EmbeddingsConfig, cache: Arc<EmbeddingCache>, ) -> Result<Self>
Trait Implementations§
Source§impl Debug for LocalEmbeddings
impl Debug for LocalEmbeddings
Source§impl EmbeddingModel for LocalEmbeddings
impl EmbeddingModel for LocalEmbeddings
Source§fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed<'life0, 'life1, 'async_trait>(
&'life0 self,
text: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<f32>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
生成单个文本的嵌入向量
Source§fn embed_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn embed_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
texts: &'life1 [String],
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<f32>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
批量生成嵌入向量
Source§fn model_name(&self) -> &str
fn model_name(&self) -> &str
获取模型名称
Auto Trait Implementations§
impl !RefUnwindSafe for LocalEmbeddings
impl !UnwindSafe for LocalEmbeddings
impl Freeze for LocalEmbeddings
impl Send for LocalEmbeddings
impl Sync for LocalEmbeddings
impl Unpin for LocalEmbeddings
impl UnsafeUnpin for LocalEmbeddings
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