pub struct HuggingFaceEmbeddings { /* private fields */ }Expand description
HuggingFace 嵌入模型
Implementations§
Source§impl HuggingFaceEmbeddings
impl HuggingFaceEmbeddings
pub fn new(config: EmbeddingsConfig) -> Result<Self>
pub fn with_cache( config: EmbeddingsConfig, cache: Arc<EmbeddingCache>, ) -> Result<Self>
Trait Implementations§
Source§impl Debug for HuggingFaceEmbeddings
impl Debug for HuggingFaceEmbeddings
Source§impl EmbeddingModel for HuggingFaceEmbeddings
impl EmbeddingModel for HuggingFaceEmbeddings
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 HuggingFaceEmbeddings
impl !UnwindSafe for HuggingFaceEmbeddings
impl Freeze for HuggingFaceEmbeddings
impl Send for HuggingFaceEmbeddings
impl Sync for HuggingFaceEmbeddings
impl Unpin for HuggingFaceEmbeddings
impl UnsafeUnpin for HuggingFaceEmbeddings
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